void InitPerformanceGraph(ReportGraphData pData) { this.pData = pData; mView.FindViewById <ScrollView>(Resource.Id.scrollView).ScrollTo(0, 0); if (pData == null) { return; } var chartContent = mView.FindViewById <LinearLayout>(Resource.Id.chartContent); chartContent.RemoveAllViews(); try { mPChart = new FlexChart(this.Activity); LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mPChart.LayoutParameters = params1; chartContent.AddView(mPChart); #region configure mPChart.SetPalette(Palettes.Modern); mPChart.SetBackgroundColor(Color.Transparent); mPChart.ChartType = ChartType.Splinearea; mPChart.BindingX = pData.categoryField; mPChart.Animated = false; #endregion #region regend mPChart.Legend.Position = ChartPositionType.None; #endregion #region axis mPChart.AxisX.LabelsVisible = false; mPChart.AxisX.MajorTickWidth = 0; mPChart.AxisX.LineWidth = 0.5f; mPChart.AxisY.LabelsVisible = false; mPChart.AxisY.LineColor = new Color(Color.Orange.R, Color.Orange.G, Color.Orange.B, ALPHA_AXIS); mPChart.AxisY.LineWidth = 2; for (int i = 0; i < pData.valueAxes.Count; i++) { var axis = pData.valueAxes[i]; ChartAxis cAxis = new ChartAxis(mPChart, i % 2 == 0 ? ChartPositionType.Left : ChartPositionType.Right); cAxis.Name = axis.id; cAxis.LineColor = Color.ParseColor(axis.axisColor); cAxis.MajorTickWidth = 0; cAxis.MajorGridVisible = false; cAxis.LabelsVisible = false; cAxis.AxisLineVisible = false; mPChart.Axes.Add(cAxis); } #endregion #region series foreach (var series in pData.graphs) { ChartSeries cSeries = new ChartSeries(mPChart, series.title, series.valueField); cSeries.AxisY = series.valueAxis; Color sColor = Color.ParseColor(series.lineColor); var sRGBA = new Color(sColor.R, sColor.G, sColor.B, ALPHA_FILL); cSeries.SetColor(new Java.Lang.Integer(sRGBA.ToArgb())); ImageView imgSymbol = new ImageView(this.Context); switch (series.valueField) { case "tsb": imgSymbol = mView.FindViewById <ImageView>(Resource.Id.symTSB); break; case "atl": imgSymbol = mView.FindViewById <ImageView>(Resource.Id.symATL); break; case "ctl": imgSymbol = mView.FindViewById <ImageView>(Resource.Id.symCTL); break; case "dayliTss": imgSymbol = mView.FindViewById <ImageView>(Resource.Id.symDailyTSS); break; case "dayliIf": imgSymbol = mView.FindViewById <ImageView>(Resource.Id.symDailyIF); break; } imgSymbol.SetBackgroundColor(sColor); if (series.lineAlpha.Equals(0)) { cSeries.ChartType = ChartType.Scatter; cSeries.SymbolSize = new Java.Lang.Float(1.5f); cSeries.SymbolColor = new Java.Lang.Integer(sColor); cSeries.SetColor(new Java.Lang.Integer(sColor)); } else { cSeries.BorderWidth = 0.5f; cSeries.SetColor(new Java.Lang.Integer(sRGBA.ToArgb())); } mPChart.Series.Add(cSeries); } #endregion #region annotation if (pData.TodayIndex() != -1) { ChartRectangleAnnotation today = new ChartRectangleAnnotation(); today.Attachment = ChartAnnotationAttachment.DataIndex; today.PointIndex = pData.TodayIndex(); today.Width = 3; today.Height = 10000; today.Color = Color.Black; today.BorderWidth = 0; today.FontSize = 10; today.TextColor = Color.White.ToArgb(); today.TooltipText = "Future planned performance"; mPChart.Annotations.Add(today); } annoFocused.Attachment = ChartAnnotationAttachment.DataIndex; annoFocused.PointIndex = pData.TodayIndex(); annoFocused.Width = 1; annoFocused.Height = 10000; annoFocused.Color = Color.White; annoFocused.BorderWidth = 0; annoFocused.Visible = false; annoFocused.FontSize = 12; annoFocused.TextColor = Color.White.ToArgb(); mPChart.Annotations.Add(annoFocused); #endregion mPChart.ItemsSource = pData.GetSalesDataList(); #region custom tooltip mPChart.Tooltip.Content = new MyTooltip(mPChart, this, pData, annoFocused); #endregion mPChart.ZoomMode = ZoomMode.X; mPChart.AxisX.Scale = 1; } catch (Exception err) { Toast.MakeText(Activity, err.ToString(), ToastLength.Long).Show(); } }