public DynamicChartsSample(ChartSample chartSample) : base() { chart = new AdaptiveFlexChart(); chart.BindingX = "Name"; chart.IsAnimated = false; chart.ChartType = Xuni.Xamarin.FlexChart.ChartType.Line; //bug on android, path rendering cant happen with hardware acceleration on Device.OnPlatform(Android: () => chart.ChartType = Xuni.Xamarin.FlexChart.ChartType.Line); chart.Series.Add(new ChartSeries(chart, "Trucks", "Trucks")); chart.Series.Add(new ChartSeries(chart, "Ships", "Ships")); chart.Series.Add(new ChartSeries(chart, "Planes", "Planes")); for (int i = 0; i < 8; i++) { list.Add(getItem()); } chart.ItemsSource = list; Content = chart; }
public static StackLayout GetCountryRenderChartTooltip(FlexChart flexChart) { Image image = new Image(); Label title = new Label(); Label content = new Label(); StackLayout container = new StackLayout(); container.Padding = 5; container.BackgroundColor = Color.FromHex("#FFFFCA"); title.SetBinding(Label.TextProperty, "SeriesName"); title.TextColor = Color.Black; title.FontAttributes = FontAttributes.Bold; title.FontSize = 14; image.SetBinding(Image.SourceProperty, "XValue", BindingMode.OneWay, new FlagConverter()); StackLayout horizontalContainer = new StackLayout(); horizontalContainer.Orientation = StackOrientation.Horizontal; content.SetBinding(Label.TextProperty, "YValue"); content.TextColor = Color.Black; content.FontSize = 14; horizontalContainer.Children.Add(image); horizontalContainer.Children.Add(title); container.Children.Add(horizontalContainer); container.Children.Add(content); return container; //((RelativeLayout)flexChart.Parent).Children.Add(this, Constraint.Constant(50), Constraint.Constant(50)); }
public ZoomingAndScrolling(ChartSample chartSample) { StackLayout grid = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand }; StackLayout stackMode = new StackLayout() { Orientation = StackOrientation.Horizontal }; stackMode.Children.Add(new Label() { Text = "Zoom Mode", HorizontalOptions = LayoutOptions.Start,VerticalOptions=LayoutOptions.Center }); Picker picker = this.CreateZoomModePicker(); picker.VerticalOptions = LayoutOptions.Start; stackMode.Children.Add(picker); chart = ChartSampleFactory.GetFlexChartSample(chartSample); chart.ZoomMode = ZoomMode.XY; chart.ChartType = ChartType.Area; chart.Stacking = ChartStackingType.Stacked; grid.Children.Add(stackMode); grid.Children.Add(chart); chart.VerticalOptions = LayoutOptions.FillAndExpand; picker.SelectedIndex = 0; Content = grid; chart.AxisX.Scale = 0.5; chart.AxisY.DisplayedRange = 16000; chart.ChartTooltip.ShowTooltip = false; }
public ToggleSeriesSample(ChartSample chartSample) : base() { chart = ChartSampleFactory.GetFlexChartSample(chartSample); chart.LegendToggle = true; chart.SeriesVisibilityChanged += chart_SeriesVisibilityChanged; RelativeLayout mainRelativeLayout = new RelativeLayout(); StackLayout pickerStack = new StackLayout(); pickerStack.Orientation = StackOrientation.Vertical; salesSwitch = new Switch(); salesSwitch.IsToggled = true; salesSwitch.Toggled += sales_Toggled; pickerStack.Children.Add(GetSwitchAndLabel("Sales", salesSwitch)); expensesSwitch = new Switch(); expensesSwitch.IsToggled = true; expensesSwitch.Toggled += expenses_Toggled; pickerStack.Children.Add(GetSwitchAndLabel("Expenses", expensesSwitch)); downloadsSwitch = new Switch(); downloadsSwitch.IsToggled = true; downloadsSwitch.Toggled += downloads_Toggled; pickerStack.Children.Add(GetSwitchAndLabel("Downloads", downloadsSwitch)); mainRelativeLayout.Children.Add(pickerStack, Constraint.Constant(0), Constraint.Constant(0)); mainRelativeLayout.Children.Add(chart, Constraint.Constant(0), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return sibling.Y + sibling.Height; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Width; }), Constraint.RelativeToView(pickerStack, (parent, sibling) => { return parent.Height - sibling.Height; })); // On Windows Phone,StackLayout and Picker will shrink automatically. // http://forums.xamarin.com/discussion/22436/picker-is-shrink-on-windows-phone-8 mainRelativeLayout.SizeChanged += (s, e) => { pickerStack.WidthRequest = mainRelativeLayout.Width; }; Content = mainRelativeLayout; }
public ThemingSample(ChartSample chartSample) : base() { StackLayout grid = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand }; Picker picker = this.CreatePalettesPicker(); picker.VerticalOptions = LayoutOptions.Start; grid.Children.Add(picker); chart = ChartSampleFactory.GetFlexChartSample(chartSample); grid.Children.Add(chart); chart.VerticalOptions = LayoutOptions.FillAndExpand; picker.SelectedIndex = 0; Content = grid; }
void InitPerformanceGraph() { foreach (var chart in chartContent.Subviews) { chart.RemoveFromSuperview(); } chartContent.LayoutIfNeeded(); pData = GetPerformance(); if (pData == null) { return; } mPChart = new FlexChart(); mPChart.Frame = new CGRect(0, 0, chartContent.Frame.Width, chartContent.Frame.Height); chartContent.AddSubview(mPChart); mPChart.Palette = XuniPalettes.Modern; mPChart.BackgroundColor = UIColor.Clear; mPChart.ChartType = ChartType.SplineArea; mPChart.BindingX = pData.categoryField; mPChart.IsAnimated = false; mPChart.ItemsSource = pData.GetSalesDataList(); mPChart.SymbolSize = 3; mPChart.Legend.Position = Position.None; mPChart.Tooltip.IsVisible = false; mPChart.AxisX.LabelsVisible = false; mPChart.AxisX.MajorTickWidth = 0; mPChart.AxisX.LineWidth = 0.5f; mPChart.AxisY.LabelsVisible = false; mPChart.AxisY.LineColor = UIColor.Orange.ColorWithAlpha(ALPHA_AXIS); mPChart.AxisY.MajorTickWidth = 0; mPChart.AxisY.MajorGridVisible = false; mPChart.AxisY.LabelsVisible = false; mPChart.AxisY.LineWidth = 2; for (int i = 0; i < pData.valueAxes.Count; i++) { var axis = pData.valueAxes[i]; Axis cAxis = new Axis(i % 2 == 0 ? Position.Left : Position.Right, mPChart); cAxis.AxisName = axis.id; cAxis.LineColor = FromHexString(axis.axisColor); cAxis.MajorTickWidth = 0; cAxis.MajorGridVisible = false; cAxis.LabelsVisible = false; cAxis.AxisLineVisible = false; mPChart.AxesArray.Add(cAxis); } foreach (var series in pData.graphs) { Series cSeries = new Series(mPChart, series.valueField, series.title); cSeries.AxisYname = series.valueAxis; UIColor sColor = FromHexString(series.lineColor); switch (series.valueField) { case "tsb": symTSB.BackgroundColor = sColor; break; case "atl": symATL.BackgroundColor = sColor; break; case "ctl": symCTL.BackgroundColor = sColor; break; case "dayliTss": symDailyLoad.BackgroundColor = sColor; break; case "dayliIf": symDailyIF.BackgroundColor = sColor; break; } if (series.lineAlpha.Equals(0)) { cSeries.ChartType = ChartType.Scatter; cSeries.SymbolColor = sColor; cSeries.Color = sColor; } else { cSeries.BorderWidth = 1; cSeries.BorderColor = sColor; cSeries.Color = sColor; cSeries.Opacity = ALPHA_FILL; } mPChart.Series.Add(cSeries); } mPChart.ItemsSource = pData.GetSalesDataList(); if (pData.TodayIndex() != -1) { var start = new XuniPoint(pData.TodayPosition() * mPChart.AxisX.ActualDataMax, mPChart.AxisY.ActualDataMax); var end = new XuniPoint(pData.TodayPosition() * mPChart.AxisX.ActualDataMax, mPChart.AxisY.ActualDataMin); XuniChartLineAnnotation today = new XuniChartLineAnnotation(mPChart) { IsVisible = true, Attachment = XuniChartAnnotationAttachment.DataCoordinate, Start = start, End = end, LineWidth = 3, TooltipText = "Future planned performance", Color = UIColor.Black, }; mPChart.Annotations.Add(today); } var annoFocused = new XuniChartRectangleAnnotation(mPChart) { IsVisible = false, Position = XuniChartAnnotationPosition.Center, Attachment = XuniChartAnnotationAttachment.DataCoordinate, Width = 2, Height = mPChart.AxisY.ActualDataMax, BorderWidth = 0, Text = DateTime.Now.ToString(), TextColor = UIColor.White, Color = UIColor.White, }; mPChart.Annotations.Add(annoFocused); #region custom line marker MyMarkerView view = new MyMarkerView(mPChart.LineMarker); view.MarkerRender = new MyMarkerRender(view, txtTSB, txtATL, txtCTL, txtDailyTSS, txtDailyIF); mPChart.LineMarker.Content = view; mPChart.LineMarker.IsVisible = true; mPChart.LineMarker.Alignment = XuniChartMarkerAlignment.BottomRight; mPChart.LineMarker.Lines = XuniChartMarkerLines.Vertical; mPChart.LineMarker.Interaction = XuniChartMarkerInteraction.Move; mPChart.LineMarker.DragContent = false; mPChart.LineMarker.SeriesIndex = -1; mPChart.LineMarker.VerticalLineColor = UIColor.White; mPChart.LineMarker.VerticalPosition = 10; mPChart.AddSubview(view); #endregion mPChart.ZoomMode = ZoomMode.Disabled; mPChart.AxisX.Scale = 1; zoomSlider.LowerValueChanged += HanelerGraphZoomChanged; zoomSlider.UpperValueChanged += HanelerGraphZoomChanged; zoomSlider.LowerValue = 0; zoomSlider.UpperValue = pData.dataProvider.Count; zoomSlider.MinimumValue = 0; zoomSlider.MaximumValue = pData.dataProvider.Count; zoomSlider.MinimumRange = 1; }
public SinglePagePrintControl(FlexChart flexChart) { InitializeComponent(); this.FlexChart = flexChart; comboPrintScale = ControlFactory.EnumBasedCombo(typeof(ChartPrinter.PrintScale), "PrintScale"); comboPrintScale.Location = new Point(15, 17); labX = new LabelEx("X:") { Location = new Point(188, 17) }; txtX = new TextBox() { Bounds = new Rectangle(211, 17, 50, 21) }; labWidth = new LabelEx("Width:") { Location = new Point(280, 17) }; txtWidth = new TextBox() { Bounds = new Rectangle(330, 17, 50, 21) }; chkGrayScale = new CheckBoxEx("Use GrayScale") { Location = new Point(15, 65) }; labY = new LabelEx("Y:") { Location = new Point(188, 65) }; txtY = new TextBox() { Bounds = new Rectangle(211, 65, 50, 21) }; labHeight = new LabelEx("Height") { Location = new Point(280, 65) }; txtHeight = new TextBox() { Bounds = new Rectangle(330, 65, 50, 21) }; chkPreview = new CheckBoxEx("Preview") { Location = new Point(15, 113), Checked = true }; btnClear = new ButtonEx("Clear") { Bounds = new Rectangle(188, 113, 100, 25) }; btnPrint = new ButtonEx("Print") { Bounds = new Rectangle(15, 160, 100, 25) }; comboPrintScale.SelectedIndexChanged += (s, e) => { FlexChart.Header.Content = comboPrintScale.Text; }; txtX.Validating += NumerTextValidate; txtY.Validating += NumerTextValidate; txtWidth.Validating += NumerTextValidate; txtHeight.Validating += NumerTextValidate; btnPrint.Click += btnPrint_Click; btnClear.Click += btnClear_Click; this.Controls.Add(comboPrintScale); this.Controls.Add(labX); this.Controls.Add(txtX); this.Controls.Add(labWidth); this.Controls.Add(txtWidth); this.Controls.Add(chkGrayScale); this.Controls.Add(labY); this.Controls.Add(txtY); this.Controls.Add(labHeight); this.Controls.Add(txtHeight); this.Controls.Add(chkPreview); this.Controls.Add(btnClear); this.Controls.Add(btnPrint); DrawingRectangle = new Rectangle(100, 200, 400, 400); FlexChart.Header.Content = "PrintScale: None"; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_styling_series); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.stylingSeries); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mChart.BindingX = "Name"; // initialize series elements and set the binding to variables of // ChartPoint ChartSeries seriesSales = new ChartSeries(); seriesSales.Chart = mChart; seriesSales.SeriesName = "Sales"; seriesSales.Binding = "Sales"; ChartSeries seriesExpenses = new ChartSeries(); seriesExpenses.Chart = mChart; seriesExpenses.SeriesName = "Expenses"; seriesExpenses.Binding = "Expenses"; ChartSeries seriesDownloads = new ChartSeries(); seriesDownloads.Chart = mChart; seriesDownloads.SeriesName = "Downloads"; seriesDownloads.Binding = "Downloads"; // style series sales seriesSales.Style = new ChartStyle() { Fill = Android.Graphics.Color.ParseColor("#009400"), Stroke = Android.Graphics.Color.Green, StrokeThickness = 3 }; // style series expenses seriesExpenses.Style = new ChartStyle() { Fill = Android.Graphics.Color.ParseColor("#C40000"), Stroke = Android.Graphics.Color.Red, StrokeThickness = 3 }; // style series downloads seriesDownloads.ChartType = ChartType.LineSymbols; seriesDownloads.Style = new ChartStyle() { Stroke = Android.Graphics.Color.Blue, StrokeThickness = 10 }; seriesDownloads.SymbolStyle = new ChartStyle() { Fill = Android.Graphics.Color.Yellow, Stroke = Android.Graphics.Color.Cyan, StrokeThickness = 3 }; // add series to list mChart.Series.Add(seriesSales); mChart.Series.Add(seriesExpenses); mChart.Series.Add(seriesDownloads); // setting the source of data/items in FlexChart mChart.ItemsSource = (ChartPoint.GetList()); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. XuniLicenseManager.Key = License.Key; FlexChart chart = new FlexChart(); chart.Tag = 1; // set title/footer chart.Header = "FlexChart Sales"; chart.Footer = "GrapeCity Xuni"; chart.Legend.BorderWidth = 1; chart.Legend.BorderColor = UIColor.Gray; // set palette chart.Palette = XuniPalettes.Coral; // set data source chart.ItemsSource = SalesData.GetSalesDataList(); // bind X axis to display category names chart.BindingX = (NSString)"Date"; chart.Legend.Position = Position.None; // configure default axes chart.AxisX.LabelAngle = 45; chart.AxisX.Format = "d"; chart.AxisY.Format = "c0"; chart.AxisY.Title = "Dollars"; // add second Y axis Axis y2 = new Axis(Position.Right, chart); y2.MajorGridVisible = false; y2.MinorGridVisible = false; y2.LabelsVisible = true; y2.Title = "Downloads"; chart.AxesArray.Add(y2); // create series with binding Series sales = new Series(chart, (NSString)"Sales", (NSString)"Sales"); Series expenses = new Series(chart, (NSString)"Expenses", (NSString)"Expenses"); Series downloads = new Series(chart, (NSString)"Downloads", (NSString)"Downloads"); downloads.AxisY = y2; downloads.ChartType = ChartType.Line; chart.Series.Add(sales); chart.Series.Add(expenses); chart.Series.Add(downloads); // customize tooltip //MyTooltip t = new MyTooltip(); //t.BackgroundColor = UIColor.Blue; //chart.Tooltip.Content = t; chart.Tooltip.IsVisible = true; // customize plot element chart.DataLabel.Content = (NSString)"{y}"; chart.DataLabel.DataLabelFormat = (NSString)"C0"; chart.DataLabel.DataLabelBackgroundColor = UIColor.White; chart.DataLabel.DataLabelFontColor = UIColor.Red; chart.DataLabel.DataLabelBorderColor = UIColor.Gray; chart.DataLabel.DataLabelBorderWidth = 0.1; chart.DataLabel.Position = ChartDataLabelPosition.Top; // configure animation chart.LoadAnimation.AnimationMode = AnimationMode.Point; View.AddSubview(chart); }
public ActionResult uphistorychart(string select) { if(select.EndsWith(",")) select=select.Substring(0,select.Length-1); FlexChart chart = new FlexChart(); chart = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "历史查询", select); #region 图表 //chart.charttype = chart.standardtype + getsel.Length.ToString(); chart.customercode = Masterpage.CurrUser.client_code; chart.customername = Masterpage.CurrUser.client_name; chart.url = Utils.GetFlexAddress(); chart.processparms = select; chart.title = "历史查询"; #endregion var result = new { chart = chart }; return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// Deserializes a FlexChart control from an XML string. /// </summary> /// <param name="flexChart">The instance of the FlexChart control into which the serialized chart data is to be loaded.</param> /// <param name="flexChartString">A string containing the XML string with serialized chart information.</param> public static void DeserializeFlexChartFromXml(FlexChart flexChart, string flexChartString) { DeserializeFlexChartFromData(flexChart, flexChartString, "xml"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); LicenseManager.Key = License.Key; // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // get chart from view chart = FindViewById<FlexChart>(Resource.Id.flexchart); // set title/footer chart.Header = "FlexChart Sales"; chart.Footer = "GrapeCity Xuni"; chart.Legend.BorderWidth = 1; chart.Legend.BorderColor = System.Drawing.Color.Gray.ToArgb(); // set palette chart.SetPalette(Palettes.Modern); // bind X axis to display category names chart.BindingX = "Date"; // create series with binding ChartSeries sales = new ChartSeries(chart, "Sales", "Sales"); // new Series(chart, legend name, binding property) ChartSeries expenses = new ChartSeries(chart, "Expenses", "Expenses"); ChartSeries downloads = new ChartSeries(chart, "Downloads", "Downloads"); downloads.ChartType = ChartType.Line; chart.Series.Add(sales); chart.Series.Add(expenses); chart.Series.Add(downloads); // set data source chart.ItemsSource = SalesData.GetSalesDataList(); // configure default axes chart.AxisX.LabelAngle = 45; chart.AxisX.Format = "d"; chart.AxisY.Format = "c0"; chart.AxisY.Title = "Dollars"; // add second Y axis ChartAxis y2 = new ChartAxis(chart, ChartPositionType.Right); y2.Name = "y2"; y2.Format = "n0"; y2.MajorGridVisible = false; y2.MinorGridVisible = false; y2.LabelsVisible = true; y2.Title = "Downloads"; chart.Axes.Add(y2); downloads.AxisY = "y2"; // customize tooltip chart.Tooltip.Content = new MyTooltip(chart, chart.Context); // customize plot element chart.PlotElementLoading += chart_PlotElementLoading; // configure animation chart.LoadAnimation.AnimationMode = AnimationMode.Point; }
/// <summary> /// Serializes a FlexChart control to an JSON string. /// </summary> /// <param name="flexChart">The instance of the FlexChart control to serialize to an JSON string.</param> /// <returns>A string containing a formatted JSON string.</returns> public static string SerializeFlexChartToJson(FlexChart flexChart) { return(SerializeObjectModelToJson(new ChartModel(flexChart))); }
/// <summary> /// Serializes a FlexChart control to a byte array. /// </summary> /// <param name="flexChart">The instance of the FlexChart control to serialize to a byte array.</param> /// <returns>A byte array containing the serialized chart.</returns> public static byte[] SerializeFlexChartToBytes(FlexChart flexChart) { return(SerializeObjectModelToBytes(new ChartModel(flexChart))); }
public BubbleChartSample(ChartSample chartSample) { FlexChart chart = ChartSampleFactory.GetFlexChartSample(chartSample); Content = chart; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_annotation); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.annotation); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widgets mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mChart.ChartType = ChartType.Line; mChart.BindingX = "X"; mChart.Series.Add(new ChartSeries() { SeriesName = "Base dataList", Binding = "Y,Y" }); mChart.ItemsSource = new AnnotationViewModel().Data; mChart.LegendPosition = ChartPositionType.None; Text text = new Text() { Content = "Relative", Location = new C1Point(0.5, 0.5), Attachment = AnnotationAttachment.Relative }; text.AnnotationStyle = new ChartStyle() { FontSize = 15, FontFamily = "GenericSansSerif" }; Ellipse ellipse = new Ellipse() { Content = "Relative", Location = new C1Point(0.4, 0.45), Width = 60, Height = 40, Attachment = AnnotationAttachment.Relative }; ellipse.AnnotationStyle = new ChartStyle() { Fill = Color.Goldenrod, Stroke = Color.Argb(1 * 255, (int)(0.75 * 255), (int)(0.55 * 255), (int)(0.06 * 255)), FontAttributes = TypefaceStyle.Bold, FontSize = 10, FontFamily = "GenericSansSerif" }; Circle circle = new Circle() { Content = "DataIndex", Radius = 40, SeriesIndex = 0, PointIndex = 27, Attachment = AnnotationAttachment.DataIndex }; circle.AnnotationStyle = new ChartStyle() { Fill = Color.LightSeaGreen, Stroke = Color.Argb((int)(1.0 * 255), (int)(0.13 * 255), (int)(0.58 * 255), (int)(0.58 * 255)), FontFamily = "GenericSansSerif", FontAttributes = TypefaceStyle.Bold }; Rectangle rectangle = new Rectangle() { Content = "DataCoordinate", Width = 100, Height = 50, Location = new C1Point(37, 80), Attachment = AnnotationAttachment.DataCoordinate }; rectangle.AnnotationStyle = new ChartStyle() { Fill = Color.SlateBlue, Stroke = Color.Argb((int)(1.0 * 255), (int)(0.29 * 255), (int)(0.25 * 255), (int)(0.57 * 255)), FontFamily = "GenericSansSerif", FontSize = 10 }; Square square = new Square() { Content = "DataIndex", Length = 70, SeriesIndex = 0, PointIndex = 40, Attachment = AnnotationAttachment.DataIndex }; square.AnnotationStyle = new ChartStyle() { Fill = Color.SandyBrown, Stroke = Color.Chocolate, FontAttributes = TypefaceStyle.Bold, FontFamily = "GenericSansSerif" }; Polygon polygon = new Polygon() { Content = "polygonAnno", Attachment = AnnotationAttachment.Absolute }; polygon.Points = CreatePoints(); polygon.AnnotationStyle = new ChartStyle() { Fill = Color.Red, StrokeThickness = 3, Stroke = Color.DarkRed, FontAttributes = TypefaceStyle.Bold, FontFamily = "GenericSansSerif" }; Line line = new Line() { Content = "Absolute", Start = new C1Point(50, 200), End = new C1Point(300, 350), Attachment = AnnotationAttachment.Absolute }; line.AnnotationStyle = new ChartStyle() { StrokeThickness = 4, FontSize = 10, FontAttributes = TypefaceStyle.Bold, Stroke = Color.Argb((int)(1.0 * 255), (int)(0.20 * 255), (int)(0.81 * 255), (int)(0.82 * 255)), FontFamily = "GenericSansSerif" }; Image image = new Image() { Location = new C1Point(12, 20), Attachment = AnnotationAttachment.DataCoordinate, Width = 30, Height = 30 }; image.Source = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.xuni_butterfly); AnnotationLayer layer = new AnnotationLayer(ApplicationContext); layer.Annotations.Add(text); layer.Annotations.Add(ellipse); layer.Annotations.Add(circle); layer.Annotations.Add(rectangle); layer.Annotations.Add(square); layer.Annotations.Add(polygon); layer.Annotations.Add(line); layer.Annotations.Add(image); mChart.Layers.Add(layer); }
public ActionResult chartfullscreen(string title,string s1,string s2, string t, string w,string h, string m) { dynamic data = new System.Dynamic.ExpandoObject(); string type = ""; if (s2 != "") type = "line2"; else type = "line1"; #region 图表 //var point = centerService.GetOneCustomerCollection(s1); //var chart = centerService.GetParamsQueryFlexChart("C03"); //chart.charttype = type; //chart.customercode = Masterpage.CurrUser.client_code; //chart.customername = Masterpage.CurrUser.client_name; //chart.height = int.Parse(h); //chart.width = int.Parse(w); //#region 上下限 //if (point.CustomerCollectionLowerLimit.HasValue) //{ // chart.needlower = 1; // chart.lowerlimit = point.CustomerCollectionLowerLimit.Value; //} //else chart.needlower = 0; //if (point.CustomerCollectionLowLimit.HasValue) //{ // chart.needlow = 1; // chart.lowlimit = point.CustomerCollectionLowLimit.Value; //} //else chart.needlow = 0; //if (point.CustomerCollectionUpLimit.HasValue) //{ // chart.needup = 1; // chart.uplimit = point.CustomerCollectionUpLimit.Value; //} //else chart.needup = 0; //if (point.CustomerCollectionUpperLimit.HasValue) //{ // chart.needuper = 1; // chart.uperlimit = point.CustomerCollectionUpperLimit.Value; //} //else chart.needuper = 0; //#endregion //chart.processparms = s1 + (s2 != "" ? ("," + s2) : ""); //chart.title = title + "变化趋势"; //chart.queryparms = t; #endregion #region 图表 FlexChart chart = new FlexChart(); string select = s1 +(s2 != "" ? ("," + s2) : ""); chart = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, title, select); chart.charttype = type; chart.customercode = Masterpage.CurrUser.client_code; chart.customername = Masterpage.CurrUser.client_name; chart.height = int.Parse(h); chart.width = int.Parse(w); chart.title = title + "变化趋势"; chart.queryparms = t + "|" + m; chart.url = Utils.GetFlexAddress(); #endregion data.chart = JsonHelper.ToJson(chart); LogHelper.Info(Masterpage.CurrUser.alias, "702011:客户," + Masterpage.CurrUser.client_code + ",查看全屏图表,采集点为:" + s1); return View("chartfullscreen", data); }
protected override void InitializeControls() { flexChart1 = new FlexChart(); this.Chart = flexChart1; }
/// <summary> /// Deserializes a FlexChart control from a JSON string. /// </summary> /// <param name="flexChart">The instance of the FlexChart control into which the serialized chart data is to be loaded.</param> /// <param name="flexChartString">A string containing the JSON string with serialized chart information.</param> public static void DeserializeFlexChartFromJson(FlexChart flexChart, string flexChartString) { DeserializeFlexChartFromData(flexChart, flexChartString, "json"); }
public MyTooltip(FlexChart chart, Context context) : base(chart) { txtLabelX = new TextView(context); txtLabelY = new TextView(context); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; layout.SetBackgroundColor(Android.Graphics.Color.Gray); layout.SetPadding(5, 5, 5, 5); layout.AddView(txtLabelX); layout.AddView(txtLabelY); AddView(layout); }
/// <summary> /// Deserializes a FlexChart control from a byte array. /// </summary> /// <param name="flexChart">The instance of the FlexChart control into which the serialized chart data is to be loaded.</param> /// <param name="flexChartBytes">A byte array containing the serialized chart information.</param> public static void DeserializeFlexChartFromBytes(FlexChart flexChart, byte[] flexChartBytes) { DeserializeFlexChartFromData(flexChart, flexChartBytes, "binary"); }
public GettingStartedSample(ChartSample chartSample) : base() { chart = ChartSampleFactory.GetFlexChartSample(chartSample); Content = chart; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_zones); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.zones); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.zonesFlexchart); mChart.BindingX = "Number"; mChart.ChartType = ChartType.Scatter; int nStudents = 20; int nMaxPoints = 100; IList <object> data = ZonesData.getZonesList(nStudents, nMaxPoints); mChart.ItemsSource = data; mChart.Tapped += MChart_Tapped; mChart.AxisX.Title = "student number"; mChart.AxisY.Title = "student accumulated points"; double mean = this.FindMean(data); double stdDev = this.FindStdDev(data, mean); List <double> scores = new List <double>(); foreach (ZonesData item in data) { scores.Add(item.Score); } scores.Sort((x, y) => y.CompareTo(x)); var zones = new double[] { scores[this.GetBoundingIndex(scores, 0.85)], scores[this.GetBoundingIndex(scores, 0.75)], scores[this.GetBoundingIndex(scores, 0.25)], scores[this.GetBoundingIndex(scores, 0.05)] }; Integer[] colors = new Integer[] { new Integer(Color.Argb(255, 255, 192, 192)), new Integer(Color.Argb(255, 55, 228, 228)), new Integer(Color.Argb(255, 255, 228, 128)), new Integer(Color.Argb(255, 128, 255, 128)), new Integer(Color.Argb(255, 128, 128, 255)), }; for (var i = 4; i >= 0; i--) { float y = (float)(i == 4 ? mean + 2 * stdDev : zones[i]); PointF[] sdata = new PointF[data.Count]; for (int j = 0; j < data.Count; j++) { sdata[j] = new PointF(j, y); if (i == 0) { System.Console.WriteLine(j + "=" + y); } } string seriesName = ((char)((short)'A' + 4 - i)).ToString(); var series = new ChartSeries(); series.Chart = mChart; series.SeriesName = seriesName; series.Binding = "Y"; series.ItemsSource = sdata; series.BindingX = "X"; series.ChartType = ChartType.Area; series.Style = new ChartStyle(); series.Style.Fill = new Color(colors[i].IntValue()); mChart.Series.Add(series); } ChartSeries scoreSeries = new ChartSeries(); scoreSeries.Chart = mChart; scoreSeries.SeriesName = "raw score"; scoreSeries.Binding = "Score"; scoreSeries.BindingX = "Number"; mChart.Series.Add(scoreSeries); for (var i = -2; i <= 2; i++) { var y = mean + i * stdDev; string seriesName = string.Empty; if (i > 0) { seriesName = "m+" + i + "s"; } else if (i < 0) { seriesName = "m" + i + "s"; } else { seriesName = "mean"; } PointF[] sdata = new PointF[data.Count]; for (int j = 0; j < data.Count; j++) { sdata[j] = new PointF(j, (float)y); } var series = new ChartSeries(); series.Chart = mChart; series.SeriesName = seriesName; series.Binding = "Y"; series.ItemsSource = sdata; series.BindingX = "X"; series.ChartType = ChartType.Line; series.Style = new ChartStyle(); series.Style.StrokeThickness = 2; series.Style.Stroke = Color.Rgb(0x20, 0x20, 0x20); mChart.Series.Add(series); } }
public ActionResult upchartandgrid(string select, string title, string t, string m) { #region 统计数据 if (select.EndsWith(",")) select = select.Substring(0, select.Length - 1); string[] getsel = select.Split(','); if (getsel.Length < 1) { return Json("", JsonRequestBehavior.AllowGet); } #region 读取 DateTime start; DateTime end; if (m == null || m == "") { start = DateTime.Now.Date.AddMonths(-1); } else { start = Convert.ToDateTime(m); } end = start.AddMonths(1); var l = WebAccountHelper.ProcessStatistic(select, start, end, t); #endregion #endregion #region 图表 FlexChart chart = new FlexChart(); chart = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, title, select); chart.url = Utils.GetFlexAddress(); chart.title = title + "变化趋势"; chart.queryparms = t + "|" + m; #endregion var result = new { grid = l, chart = chart }; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult savenewconfig(int number, string unitname, string select1, string select2) { #region 保存配置 var r = accountService.SavePlatChartPartConfig(number, Masterpage.CurrUser.client_code, Masterpage.CurrUser.IsEmployee, Masterpage.CurrUser.guid, Masterpage.CurrUser.config1, unitname, select1, select2); LogHelper.Info(Masterpage.CurrUser.alias, "101011:保存工作台三个图表的用户配置config1,单元为" + unitname + ",两个配置为" + select1 + "," + select2 + ",结果:" + r.status); if (r.status == "ok") { Masterpage.CurrUser.config1 = r.value; SessionHelper.SetSession("LoginUser", Masterpage.CurrUser); var nc = Masterpage.CurrUser.config1; } #endregion #region 图表 FlexChart chart = new FlexChart(); if (select1 != "" || select2 != "") { if (select1 == null) select1 = ""; if (select2 == null) select2 = ""; var select = select1 + (select2 != "" ? "," + select2 : ""); chart = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "历史查询", select); chart.processparms = select; chart.title = "工作台图表"; chart.queryparms = ""; chart.url = Utils.GetFlexAddress(); } #endregion var back = new { save = r, chart = chart }; return Json(JsonHelper.ToJson(back), JsonRequestBehavior.AllowGet); }
public ActionResult HistoryProcessQuery(int? page, int? pagesize, string key, string select) { dynamic data = new System.Dynamic.ExpandoObject(); string[] type = centerService.GetCollectionType(); //var list = centerService.GetCustomerCollectionPageMode(Masterpage.CurrUser.client_code, key,""); var list = centerService.GetHistoryProcessList(Masterpage.CurrUser.client_code, key); var list2 = list.OrderBy(x => x.collent_point_order).ToList(); int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 13; var vs = list2.ToPagedList(_page, _pagesize); data.customercode = Masterpage.CurrUser.client_code; data.type = type; data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; if(select==null) select=""; if(select.EndsWith(",")) select=select.Substring(0,select.Length-1); #region 图表 if (select != "" ) { FlexChart chart = new FlexChart(); chart = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "历史查询", select); chart.url = Utils.GetFlexAddress(); chart.processparms = select; chart.title = "历史查询"; chart.queryparms = ""; data.chart =JsonHelper.ToJson( chart); } #endregion if(select==null) select=""; data.select = select; data.key = key; LogHelper.Info(Masterpage.CurrUser.alias, "201012:客户," + Masterpage.CurrUser.client_code + ",查看采集点" + select + "历史查看图表"); return PartialView("HistoryProcessQuery", data); }
private void Loading_Load(object sender, EventArgs e) { var chart = new FlexChart(); chart.Legend.Position = Position.Bottom; chart.Dock = DockStyle.Fill; chart.AxisX.MajorGrid = false; chart.AxisX.MinorGrid = true; chart.AxisX.MajorTickMarks = TickMark.None; chart.AxisX.AxisLine = false; chart.AxisX.MinorGridStyle.StrokeColor = Color.LightGray; chart.AxisY.MajorGrid = false; chart.AxisY.MinorGrid = true; chart.AxisY.MinorGridStyle.StrokeColor = Color.LightGray; chart.Header.Content = "Weekly traffic intensity"; chart.Header.Style.Font = new Font("Seqoe UI", 16); chart.ToolTip.Content = "{item:0.0}%"; var scale = new DiscreteColorScale() { Intervals = new List <DiscreteColorScale.Interval>() }; scale.Intervals.Add(new DiscreteColorScale.Interval(0, 10, Color.FromArgb(unchecked ((int)0xFF0571B0)), "Very Low")); scale.Intervals.Add(new DiscreteColorScale.Interval(10, 25, Color.FromArgb(unchecked ((int)0xFF92C5DE)), "Low")); scale.Intervals.Add(new DiscreteColorScale.Interval(25, 75, Color.FromArgb(unchecked ((int)0xFFF7F7F7)), "Normal")); scale.Intervals.Add(new DiscreteColorScale.Interval(75, 90, Color.FromArgb(unchecked ((int)0xFFF4A582)), "High")); scale.Intervals.Add(new DiscreteColorScale.Interval(90, 100, Color.FromArgb(unchecked ((int)0xFFCA0020)), "Critical")); // generated some random data var rnd = new Random(); var data = new double[24, 7]; for (var j = 0; j < 7; j++) { for (var i = 0; i < 24; i++) { data[i, j] = 10 * Math.Exp(-(i - 12) * (i - 12) / (2 * 4.0 * 4.0)) / Math.Sqrt(2 * Math.PI * 4.0 * 4.0) * ((j == 5 || j == 6) ? 50 : 100) * rnd.NextDouble(); } } var hmap = new Heatmap(); hmap.DataSource = data; hmap.ColorScale = scale; chart.Series.Add(hmap); var times = new string[24]; for (var i = 0; i < 24; i++) { times[i] = new DateTime(2000, 1, 1, i, 0, 0).ToShortTimeString(); } chart.AxisX.DataSource = times; chart.AxisX.LabelAngle = 45; chart.AxisY.DataSource = new string[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; chart.AxisY.Reversed = true; Controls.Add(chart); }
public AnnotationEx(FlexChart chart, AnnotationBase anno, RectangleF rect) { this.flexChart = chart; this.annotation = anno; this.BoundingRectangle = rect; }
FlexChart CreateChart1() { var pts = new SampleData.DataPoint[10]; for (var i = 0; i < pts.Length; i++) { pts[i] = new SampleData.DataPoint() { X = i, Y1 = i * i, Y2 = i * i * i } } ; var chart = new FlexChart() { BindingX = "X", Binding = "Y1", ChartType = C1.Chart.ChartType.LineSymbols, DataSource = pts, Dock = DockStyle.Fill }; chart.Series.Add(new Series() { Name = "y=f(x)" }); chart.Click += Chart_Click; var designer = new ChartDesigner(chart); return(chart); } FlexChart CreateChart2() { var chart = new FlexChart() { BindingX = "Country", DataSource = SampleData.GetCountryData(), Dock = DockStyle.Fill }; chart.Series.Add(new Series() { Name = "Sales", Binding = "Sales" }); chart.Series.Add(new Series() { Name = "Expenses", Binding = "Expenses" }); chart.Click += Chart_Click; var designer = new ChartDesigner(chart); return(chart); } FlexPie CreateChart3() { var chart = new FlexPie() { BindingName = "Country", Binding = "Sales", DataSource = SampleData.GetCountryData(), Dock = DockStyle.Fill }; chart.Click += Chart_Click; var designer = new ChartDesigner(chart); return(chart); } FlexChart CreateChart4() { var rnd = new Random(); var pts = new SampleData.DataPoint[10]; for (var i = 0; i < pts.Length; i++) { pts[i] = new SampleData.DataPoint() { X = i, Y1 = i * i, Y2 = rnd.NextDouble() } } ; var chart = new FlexChart() { BindingX = "X", Binding = "Y1,Y1", ChartType = C1.Chart.ChartType.Bubble, DataSource = pts, Dock = DockStyle.Fill }; chart.Series.Add(new Series() { Name = "bubbles" }); chart.Click += Chart_Click; var designer = new ChartDesigner(chart); return(chart); }
public ActionResult savematerialconfig(string number, string material, string materialn) { #region 保存配置 var r = accountService.SavePlatChartFourConfig(Masterpage.CurrUser.client_code, Masterpage.CurrUser.IsEmployee, Masterpage.CurrUser.guid, Masterpage.CurrUser.config3, number, material); LogHelper.Info(Masterpage.CurrUser.alias, "101011:保存工作台第四个耗材图表的用户配置config3,图表编号为" + number + ",配置耗材为" + material + ",结果:" + r.status); if (r.status == "ok") { Masterpage.CurrUser.config3 = r.value; SessionHelper.SetSession("LoginUser", Masterpage.CurrUser); var nc = Masterpage.CurrUser.config3; } #endregion #region 第四个小图表 FlexChart chart4 = new FlexChart(); chart4 = centerService.GetFlexChartByChartNumber(number); chart4.customercode = Masterpage.CurrUser.client_code; chart4.customername = Masterpage.CurrUser.client_name; chart4.processparms = material + "|" + DateTime.Now.Year.ToString(); chart4.url = Utils.GetFlexAddress(); #endregion var back = new { save = r, chart = chart4 }; return Json(JsonHelper.ToJson(back), JsonRequestBehavior.AllowGet); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. XuniLicenseManager.Key = License.Key; FlexChart chart = new FlexChart(); chart.Tag = 1; // set title/footer chart.Header = "FlexChart Sales"; chart.Footer = "GrapeCity Xuni"; chart.Legend.BorderWidth = 1; chart.Legend.BorderColor = UIColor.Gray; // set palette chart.Palette = XuniPalettes.Coral(); // set data source chart.ItemsSource = SalesData.GetSalesDataList(); // bind X axis to display category names chart.BindingX = (NSString)"Date"; chart.Legend.Position = Position.PositionNone; // configure default axes chart.AxisX.LabelAngle = 45; chart.AxisX.Format = "d"; chart.AxisY.Format = "c0"; chart.AxisY.Title = "Dollars"; // add second Y axis Axis y2 = new Axis(Position.PositionRight, chart); y2.MajorGridVisible = false; y2.MinorGridVisible = false; y2.LabelsVisible = true; y2.Title = "Downloads"; chart.AxesArray.Add(y2); // create series with binding Series sales = new Series(chart, (NSString)"Sales", (NSString)"Sales"); Series expenses = new Series(chart, (NSString)"Expenses", (NSString)"Expenses"); Series downloads = new Series(chart, (NSString)"Downloads", (NSString)"Downloads"); downloads.AxisY = y2; downloads.ChartType = ChartType.ChartTypeLine; chart.Series.Add(sales); chart.Series.Add(expenses); chart.Series.Add(downloads); // customize tooltip //MyTooltip t = new MyTooltip(); //t.BackgroundColor = UIColor.Blue; //chart.Tooltip.Content = t; chart.Tooltip.IsVisible = true; // customize plot element chart.DataLabel.Content = (NSString)"{y}"; chart.DataLabel.DataLabelFormat = (NSString)"C0"; chart.DataLabel.DataLabelBackgroundColor = UIColor.White; chart.DataLabel.DataLabelFontColor = UIColor.Red; chart.DataLabel.DataLabelBorderColor = UIColor.Gray; chart.DataLabel.DataLabelBorderWidth = 0.1; chart.DataLabel.Position = ChartDataLabelPosition.ChartDataLabelPositionTop; // configure animation chart.LoadAnimation.AnimationMode = AnimationMode.AnimationModePoint; View.AddSubview(chart); }
public ActionResult default1() { LogHelper.Info(Masterpage.CurrUser.alias, "101011:客户," + Masterpage.CurrUser.client_code + "打开工作台"); dynamic data = new System.Dynamic.ExpandoObject(); data.code = Masterpage.CurrUser.client_code; var chartconfig = centerService.GetPlatFormThreeChartCode(Masterpage.CurrUser.client_code, Masterpage.CurrUser.config1); #region 工艺三个小图表 var str1 = chartconfig.chart1_1 + (chartconfig.chart1_2 != "" ? "," + chartconfig.chart1_2 : ""); var str2 = chartconfig.chart2_1 + (chartconfig.chart2_2 != "" ? "," + chartconfig.chart2_2 : ""); var str3 = chartconfig.chart3_1 + (chartconfig.chart3_2 != "" ? "," + chartconfig.chart3_2 : ""); data.str1 = str1; data.str2 = str2; data.str3 = str3; data.chart1_1 = chartconfig.chart1_1; data.chart1_2 = chartconfig.chart1_2; data.chart2_1 = chartconfig.chart2_1; data.chart2_2 = chartconfig.chart2_2; data.chart3_1 = chartconfig.chart3_1; data.chart3_2 = chartconfig.chart3_2; data.unitname1 = chartconfig.unitname1; data.unitname2 = chartconfig.unitname2; data.unitname3 = chartconfig.unitname3; FlexChart chart1 = new FlexChart(); FlexChart chart2 = new FlexChart(); FlexChart chart3 = new FlexChart(); if (str1 != null && str1 != "") { chart1 = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "", str1); chart1.url = Utils.GetFlexAddress(); } if (str2 != null && str2 != "") { chart2 = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "", str2); chart2.url = Utils.GetFlexAddress(); } if (str3 != null && str3 != "") { chart3 = centerService.GetFlexChartBySelects(Masterpage.CurrUser.client_code, Masterpage.CurrUser.client_name, "", str3); chart3.url = Utils.GetFlexAddress(); } data.chart1 = JsonHelper.ToJson(chart1); data.chart2 = JsonHelper.ToJson(chart2); data.chart3 = JsonHelper.ToJson(chart3); #endregion #region 工艺三个图表的下拉单元 List<long> long1 = new List<long> { 7, 8, 9 }; List<long> long2 = new List<long> { 10, 11, 12, 13 }; List<long> long3 = new List<long> { 14, 15, 16 }; var units1 = centerService.GetThreeChartStandardProcessUnit(Masterpage.CurrUser.client_code, long1); var units2 = centerService.GetThreeChartStandardProcessUnit(Masterpage.CurrUser.client_code, long2); var units3 = centerService.GetThreeChartStandardProcessUnit(Masterpage.CurrUser.client_code, long3); data.units1 = JsonHelper.ToJson(units1.Select(p => new { text = p, id = p }).ToList()); data.units2 = JsonHelper.ToJson(units2.Select(p => new { text = p, id = p }).ToList()); data.units3 = JsonHelper.ToJson(units3.Select(p => new { text = p, id = p }).ToList()); #endregion #region 每四个图表的耗材 var hc = materialService.GetMaterialSpecification(Masterpage.CurrUser.client_code).Distinct().ToList(); data.material = hc; #endregion #region 进水监管链接的参数 int selc = 0; int isic = 0; if (chartconfig.chart1_1 != "") { if (chartconfig.chart1_1.Contains("_IC-")) { isic = 1; selc++; if (chartconfig.chart1_2 != "") { if (chartconfig.chart1_2.Contains("_IC-")) { selc++; } } } else { isic = 0; selc++; if (chartconfig.chart1_2 != "") { if (!chartconfig.chart1_2.Contains("_IC-")) { selc++; } } } } data.selc = selc; data.isic = isic; #endregion #region 第四个小图表 var config3 = centerService.GetPlatFormFourthChart(Masterpage.CurrUser.client_code, Masterpage.CurrUser.config3); FlexChart chart4 = new FlexChart(); string chart4_1 = ""; string chart4_2 = ""; string chart4name = ""; if (config3.number != null && config3.number != "") { chart4 = centerService.GetFlexChartByChartNumber(config3.number); chart4.customercode = Masterpage.CurrUser.client_code; chart4.customername = Masterpage.CurrUser.client_name; chart4.processparms = config3.material + "|" + DateTime.Now.Year.ToString(); chart4.queryparms = config3.material; chart4_1 = config3.material; chart4_2 = config3.number; chart4.url = Utils.GetFlexAddress(); if (config3.material != null && config3.material != "") { var m = materialService.GetOneMaterialSpecification(config3.material); chart4name = m.MaterialSpecificationName; } } data.chart4_1 = chart4_1; data.chart4_2 = chart4_2; data.chart4name = chart4name; data.chart4 = JsonHelper.ToJson(chart4); #endregion #region 工艺报警 //var alarms = WebAccountHelper.GetCollectionAlarm(Masterpage.CurrUser.client_code); var alarms = managementService.GetCustomerCollectionAlarmRes(Masterpage.CurrUser.client_code, "").Where(p => p.Status.HasValue && !p.Status.Value).ToList(); data.alarms = alarms; #endregion #region 操作建议 var option = centerService.GetSystemOptimization(Masterpage.CurrUser.client_code); //var s2 = centerService.GetSystemDiagnostic(Masterpage.CurrUser.client_code); //var s3 = centerService.GetLastOptimizationSuggestion(Masterpage.CurrUser.client_code, 1); data.option = option; //data.s2 = s2; #endregion #region 流程图采集点 //var vs = centerService.GetProcessCollectionValue(Masterpage.CurrUser.client_code).Select(p => new { code = p.CustomerCollectionCode.Replace("-", "$"), value = p.CustomerCollectionAvgValue }); var date = DateTime.Now.AddDays(-1);// DateTime.Parse("2013-07-04");// var nalarms = alarms.Where(x => DateTime.Compare(x.CustomerAlaramHappenTime.Value.Date, date.Date) == 0).ToList(); var vs = centerService.GetProcessPlatCollection(Masterpage.CurrUser.client_code, date).Select(p => new ProcessPlatCollection { code = p.code.Replace("-", "$"), value = p.value, low = p.low, up = p.up, alarm = 0 }).ToList(); foreach (var item in nalarms) { var ha = vs.FirstOrDefault(p => p.code == item.CustomerCollectionCode.Replace("-", "$")); if (ha != null) { ha.alarm = 1; } } data.list = JsonHelper.ToJson(vs); #endregion #region 流程图开关量 //var switchs = centerService.GetProcessSwitchValue(Masterpage.CurrUser.client_code).Select(p => new { code = p.CustomerCollectionCode.Replace("-", "$"), value = p.CustomerCollectionAvgValue.HasValue ? (int)p.CustomerCollectionAvgValue.Value : 0 }); data.switchs = "";// JsonHelper.ToJson(switchs); #endregion data.date = date; return View(data); }
protected override void InitializeControls() { flexChart1 = new FlexChart(); this.Chart = flexChart1; _toolStrip = new ToolStrip(); //Annotations _tsRectangle = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsRectangle_Image, Text = "Add Rectangle Annotation", Tag = "Rectangle", }; _tsSquare = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsSquare_Image, Text = "Add Square Annotation", Tag = "Square", }; _tsCircle = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsCircle_Image, Text = "Add Circle Annotation", Tag = "Circle", }; _tsEllipse = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsEllipse_Image, Text = "Add Ellipse Annotation", Tag = "Ellipse", }; _tsLine = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsLine_Image, Text = "Add Line Annotation", Tag = "Line", }; _tsPoly = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsPolygon_Image, Text = "Add Polygon Annotation", Tag = "Polygon", }; _tsText = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsText_Image, Text = "Add Text Annotation", Tag = "Text", }; //Attachments _tsAbsolute = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsAbsolute_Image, Text = "Absolute Attachment", Tag = AnnotationAttachment.Absolute, }; _tsRelative = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsRelative_Image, Text = "Relative Attachment", Tag = AnnotationAttachment.Relative, }; _tsDataCord = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsDataCoordinate_Image, Text = "DataCoordinate Attachment", Tag = AnnotationAttachment.DataCoordinate, }; //Allow Move and Separators _tsMove = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.Image, Image = Properties.Resources.tsAllowMove_Image, Text = "Allow Move", Tag = "Move", }; _tsSeparator1 = new ToolStripSeparator(); _tsSeparator2 = new ToolStripSeparator(); //Context Menu _flexChartContextMenu = new ContextMenu(new MenuItem[] { new MenuItem("Delete", OnDeleteClicked) }); _lsAnnotationGroup = new List <ToolStripButton> { _tsRectangle, _tsSquare, _tsCircle, _tsEllipse, _tsLine, _tsPoly, _tsText }; _lsAttachmentGroup = new List <ToolStripButton> { _tsAbsolute, _tsRelative, _tsDataCord }; _toolStrip.ItemClicked += _toolStrip_ItemClicked; _tsAbsolute.Checked = true; _tsMove.Checked = true; _toolStrip.Items.AddRange(new ToolStripItem[] { _tsAbsolute, _tsRelative, _tsDataCord, _tsSeparator1, _tsLine, _tsRectangle, _tsSquare, _tsCircle, _tsEllipse, _tsPoly, _tsText, _tsSeparator2, _tsMove }); this.pnlControls.Controls.Add(_toolStrip); }