/// <summary> /// Builds an XY multiple series renderer. /// </summary> /// <param name="colors"> the series rendering colors </param> /// <param name="styles"> the series point styles </param> /// <returns> the XY multiple series renderers </returns> protected internal virtual XYMultipleSeriesRenderer buildRenderer(int[] colors, PointStyle[] styles) { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); setRenderer(renderer, colors, styles); return(renderer); }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int count = 20; int length = titles.Length; Random r = new Random(); for (int i = 0; i < length; i++) { double[] xValues = new double[count]; double[] yValues = new double[count]; for (int k = 0; k < count; k++) { xValues[k] = k + r.Next() % 10; yValues[k] = k * 2 + r.Next() % 10; } x.Add(xValues); values.Add(yValues); } int[] colors = new int[] { Color.Blue, Color.Cyan, Color.Magenta, Color.LightGray, Color.Green }; PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.Diamond, PointStyle.Triangle, PointStyle.Square, PointStyle.Circle }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.Gray, Color.LightGray); renderer.XLabels = 10; renderer.YLabels = 10; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.GetSeriesRendererAt(i)).FillPoints = true; } return(ChartFactory.GetScatterChartIntent(context, BuildDataset(titles, x, values), renderer)); }
/// <summary> /// Executes the chart demo. </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "sin", "cos" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int step = 4; int count = 360 / step + 1; x.Add(new double[count]); x.Add(new double[count]); double[] sinValues = new double[count]; double[] cosValues = new double[count]; values.Add(sinValues); values.Add(cosValues); for (int i = 0; i < count; i++) { int angle = i * step; x[0][i] = angle; x[1][i] = angle; double rAngle = Math.toRadians(angle); sinValues[i] = Math.Sin(rAngle); cosValues[i] = Math.Cos(rAngle); } int[] colors = new int[] { Color.BLUE, Color.CYAN }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.GRAY, Color.LTGRAY); renderer.XLabels = 20; renderer.YLabels = 10; return(ChartFactory.getLineChartIntent(context, buildDataset(titles, x, values), renderer)); }
protected XYMultipleSeriesRenderer BuildRenderer(int[] colors, PointStyle[] styles) { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); SetRenderer(renderer, colors, styles); return(renderer); }
private XYMultipleSeriesRenderer GetDemoRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.PointSize = 5f; renderer.SetMargins(new int[] { 20, 30, 15, 0 }); XYSeriesRenderer r = new XYSeriesRenderer(); r.Color = Color.Blue; r.PointStyle = PointStyle.Square; r.FillBelowLine = true; r.SetFillBelowLineColor(Color.White); r.FillPoints = true; renderer.AddSeriesRenderer(r); r = new XYSeriesRenderer(); r.PointStyle = PointStyle.Circle; r.Color = Color.Green; r.FillPoints = true; renderer.AddSeriesRenderer(r); renderer.AxesColor = Color.DarkGray; renderer.LabelsColor = Color.LightGray; return(renderer); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Series 1", "Series 2", "Series 3", "Series 4", "Series 5" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int count = 20; int length = titles.Length; Random r = new Random(); for (int i = 0; i < length; i++) { double[] xValues = new double[count]; double[] yValues = new double[count]; for (int k = 0; k < count; k++) { xValues[k] = k + r.Next() % 10; yValues[k] = k * 2 + r.Next() % 10; } x.Add(xValues); values.Add(yValues); } int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.MAGENTA, Color.LTGRAY, Color.GREEN }; PointStyle[] styles = new PointStyle[] { PointStyle.X, PointStyle.DIAMOND, PointStyle.TRIANGLE, PointStyle.SQUARE, PointStyle.CIRCLE }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Scatter chart", "X", "Y", -10, 30, -10, 51, Color.GRAY, Color.LTGRAY); renderer.XLabels = 10; renderer.YLabels = 10; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.getSeriesRendererAt(i)).FillPoints = true; } return(ChartFactory.getScatterChartIntent(context, buildDataset(titles, x, values), renderer)); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "2007", "2008" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500 }); values.Add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000 }); int[] colors = new int[] { Color.CYAN, Color.BLUE }; XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); renderer.Orientation = XYMultipleSeriesRenderer.Orientation.VERTICAL; setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5, 12.5, 0, 24000, Color.GRAY, Color.LTGRAY); renderer.XLabels = 1; renderer.YLabels = 10; renderer.addXTextLabel(1, "Jan"); renderer.addXTextLabel(3, "Mar"); renderer.addXTextLabel(5, "May"); renderer.addXTextLabel(7, "Jul"); renderer.addXTextLabel(10, "Oct"); renderer.addXTextLabel(12, "Dec"); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { SimpleSeriesRenderer seriesRenderer = renderer.getSeriesRendererAt(i); seriesRenderer.DisplayChartValues = true; } return(ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer, Type.DEFAULT)); }
protected override void OnListItemClick(ListView l, View v, int position, long id) { base.OnListItemClick(l, v, position, id); switch (position) { case 0: Intent intent = ChartFactory.GetLineChartIntent(this, DemoDataset, DemoRenderer); StartActivity(intent); break; case 1: intent = ChartFactory.GetScatterChartIntent(this, DemoDataset, DemoRenderer); StartActivity(intent); break; case 2: intent = ChartFactory.GetTimeChartIntent(this, DateDemoDataset, DemoRenderer, null); StartActivity(intent); break; case 3: XYMultipleSeriesRenderer renderer = BarDemoRenderer; ChartSettings = renderer; intent = ChartFactory.GetBarChartIntent(this, BarDemoDataset, renderer, BarChart.Type.Default); StartActivity(intent); break; } }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "sin", "cos" }; IList <double[]> x = new List <double[]>(); IList <double[]> values = new List <double[]>(); int step = 4; int count = 360 / step + 1; x.Add(new double[count]); x.Add(new double[count]); double[] sinValues = new double[count]; double[] cosValues = new double[count]; values.Add(sinValues); values.Add(cosValues); for (int i = 0; i < count; i++) { int angle = i * step; x[0][i] = angle; x[1][i] = angle; double rAngle = Math.Tan(angle); sinValues[i] = Math.Sin(rAngle); cosValues[i] = Math.Cos(rAngle); } int[] colors = new int[] { Color.Blue, Color.Cyan }; PointStyle[] styles = new PointStyle[] { PointStyle.Point, PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.Gray, Color.LightGray); renderer.XLabels = 20; renderer.YLabels = 10; return(ChartFactory.GetLineChartIntent(context, BuildDataset(titles, x, values), renderer)); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "2007", "2008" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500 }); values.Add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000 }); int[] colors = new int[] { Color.Cyan, Color.Blue }; XYMultipleSeriesRenderer renderer = BuildBarRenderer(colors); renderer.SetOrientation(XYMultipleSeriesRenderer.Orientation.Vertical); SetChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5, 12.5, 0, 24000, Color.Gray, Color.LightGray); renderer.XLabels = 1; renderer.YLabels = 10; renderer.AddXTextLabel(1, "Jan"); renderer.AddXTextLabel(3, "Mar"); renderer.AddXTextLabel(5, "May"); renderer.AddXTextLabel(7, "Jul"); renderer.AddXTextLabel(10, "Oct"); renderer.AddXTextLabel(12, "Dec"); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { SimpleSeriesRenderer seriesRenderer = renderer.GetSeriesRendererAt(i); seriesRenderer.DisplayChartValues = true; } return(ChartFactory.GetBarChartIntent(context, BuildBarDataset(titles, values), renderer, global::AChartEngine.Charts.BarChart.Type.Default)); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Sales growth January 1995 to December 2000" }; IList <DateTime[]> dates = new List <DateTime[]>(); IList <double[]> values = new List <double[]>(); DateTime[] dateValues = new DateTime[] { new DateTime(95, 0, 1), new DateTime(95, 3, 1), new DateTime(95, 6, 1), new DateTime(95, 9, 1), new DateTime(96, 0, 1), new DateTime(96, 3, 1), new DateTime(96, 6, 1), new DateTime(96, 9, 1), new DateTime(97, 0, 1), new DateTime(97, 3, 1), new DateTime(97, 6, 1), new DateTime(97, 9, 1), new DateTime(98, 0, 1), new DateTime(98, 3, 1), new DateTime(98, 6, 1), new DateTime(98, 9, 1), new DateTime(99, 0, 1), new DateTime(99, 3, 1), new DateTime(99, 6, 1), new DateTime(99, 9, 1), new DateTime(100, 0, 1), new DateTime(100, 3, 1), new DateTime(100, 6, 1), new DateTime(100, 9, 1), new DateTime(100, 11, 1) }; dates.Add(dateValues); values.Add(new double[] { 4.9, 5.3, 3.2, 4.5, 6.5, 4.7, 5.8, 4.3, 4, 2.3, -0.5, -2.9, 3.2, 5.5, 4.6, 9.4, 4.3, 1.2, 0, 0.4, 4.5, 3.4, 4.5, 4.3, 4 }); int[] colors = new int[] { Color.BLUE }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Sales growth", "Date", "%", dateValues[0].Ticks, dateValues[dateValues.Length - 1].Ticks, -4, 11, Color.GRAY, Color.LTGRAY); renderer.YLabels = 10; renderer.XRoundedLabels = false; XYSeriesRenderer xyRenderer = (XYSeriesRenderer)renderer.getSeriesRendererAt(0); XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE); fill.Color = Color.GREEN; xyRenderer.addFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_BELOW); fill.Color = Color.MAGENTA; xyRenderer.addFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ABOVE); fill.Color = Color.argb(255, 0, 200, 100); fill.FillRange = new int[] { 10, 19 }; xyRenderer.addFillOutsideLine(fill); return(ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values), renderer, "MMM yyyy")); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "Sales growth January 1995 to December 2000" }; IList <Java.Util.Date[]> dates = new List <Java.Util.Date[]>(); IList <double[]> values = new List <double[]>(); Java.Util.Date[] dateValues = new Java.Util.Date[] { new Java.Util.Date(95, 0, 1), new Java.Util.Date(95, 3, 1), new Java.Util.Date(95, 6, 1), new Java.Util.Date(95, 9, 1), new Java.Util.Date(96, 0, 1), new Java.Util.Date(96, 3, 1), new Java.Util.Date(96, 6, 1), new Java.Util.Date(96, 9, 1), new Java.Util.Date(97, 0, 1), new Java.Util.Date(97, 3, 1), new Java.Util.Date(97, 6, 1), new Java.Util.Date(97, 9, 1), new Java.Util.Date(98, 0, 1), new Java.Util.Date(98, 3, 1), new Java.Util.Date(98, 6, 1), new Java.Util.Date(98, 9, 1), new Java.Util.Date(99, 0, 1), new Java.Util.Date(99, 3, 1), new Java.Util.Date(99, 6, 1), new Java.Util.Date(99, 9, 1), new Java.Util.Date(100, 0, 1), new Java.Util.Date(100, 3, 1), new Java.Util.Date(100, 6, 1), new Java.Util.Date(100, 9, 1), new Java.Util.Date(100, 11, 1) }; dates.Add(dateValues); values.Add(new double[] { 4.9, 5.3, 3.2, 4.5, 6.5, 4.7, 5.8, 4.3, 4, 2.3, -0.5, -2.9, 3.2, 5.5, 4.6, 9.4, 4.3, 1.2, 0, 0.4, 4.5, 3.4, 4.5, 4.3, 4 }); int[] colors = new int[] { Color.Blue }; PointStyle[] styles = new PointStyle[] { PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Sales growth", "Date", "%", dateValues[0].Time, dateValues[dateValues.Length - 1].Time, -4, 11, Color.Gray, Color.LightGray); renderer.YLabels = 10; renderer.XRoundedLabels = false; XYSeriesRenderer xyRenderer = (XYSeriesRenderer)renderer.GetSeriesRendererAt(0); XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsAbove); fill.Color = Color.Green; xyRenderer.AddFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsBelow); fill.Color = Color.Magenta; xyRenderer.AddFillOutsideLine(fill); fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.FillOutsideLineType.BoundsAbove); fill.Color = Color.Argb(255, 0, 200, 100); fill.SetFillRange(new int[] { 10, 19 }); xyRenderer.AddFillOutsideLine(fill); return(ChartFactory.GetTimeChartIntent(context, BuildDateDataset(titles, dates, values), renderer, "MMM yyyy")); }
protected override void OnRestoreInstanceState(Android.OS.Bundle savedInstanceState) { base.OnRestoreInstanceState(savedInstanceState); mDataset = savedInstanceState.GetSerializable("dataset") as XYMultipleSeriesDataset; mRenderer = savedInstanceState.GetSerializable("renderer") as XYMultipleSeriesRenderer; mCurrentSeries = savedInstanceState.GetSerializable("current_series") as XYSeries; mCurrentRenderer = savedInstanceState.GetSerializable("current_renderer") as XYSeriesRenderer; }
protected override void OnRestoreInstanceState(Bundle savedState) { base.OnRestoreInstanceState(savedState); // restore the current data, for instance when changing the screen // orientation mDataset = (XYMultipleSeriesDataset)savedState.GetSerializable("dataset"); mRenderer = (XYMultipleSeriesRenderer)savedState.GetSerializable("renderer"); mCurrentSeries = (XYSeries)savedState.GetSerializable("current_series"); mCurrentRenderer = (XYSeriesRenderer)savedState.GetSerializable("current_renderer"); }
private void SetChartSettings(XYMultipleSeriesRenderer renderer) { renderer.ChartTitle = "Chart demo"; renderer.XTitle = "x values"; renderer.YTitle = "y values"; renderer.XAxisMin = 0.5; renderer.XAxisMax = 10.5; renderer.YAxisMin = 0; renderer.YAxisMax = 210; }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Air temperature" }; IList <double[]> x = new List <double[]>(); for (int i = 0; i < titles.Length; i++) { x.Add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); } IList <double[]> values = new List <double[]>(); values.Add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 }); int[] colors = new int[] { Color.BLUE, Color.YELLOW }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT }; XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2); setRenderer(renderer, colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { XYSeriesRenderer r = (XYSeriesRenderer)renderer.getSeriesRendererAt(i); r.LineWidth = 3f; } setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32, Color.LTGRAY, Color.LTGRAY); renderer.XLabels = 12; renderer.YLabels = 10; renderer.ShowGrid = true; renderer.XLabelsAlign = Align.RIGHT; renderer.YLabelsAlign = Align.RIGHT; renderer.ZoomButtonsVisible = true; renderer.PanLimits = new double[] { -10, 20, -10, 40 }; renderer.ZoomLimits = new double[] { -10, 20, -10, 40 }; renderer.ZoomRate = 1.05f; renderer.LabelsColor = Color.WHITE; renderer.XLabelsColor = Color.GREEN; renderer.setYLabelsColor(0, colors[0]); renderer.setYLabelsColor(1, colors[1]); renderer.setYTitle("Hours", 1); renderer.setYAxisAlign(Align.RIGHT, 1); renderer.setYLabelsAlign(Align.LEFT, 1); XYMultipleSeriesDataset dataset = buildDataset(titles, x, values); values.Clear(); values.Add(new double[] { 4.3, 4.9, 5.9, 8.8, 10.8, 11.9, 13.6, 12.8, 11.4, 9.5, 7.5, 5.5 }); addXYSeries(dataset, new string[] { "Sunshine hours" }, x, values, 1); Intent intent = ChartFactory.getCubicLineChartIntent(context, dataset, renderer, 0.3f, "Average temperature"); return(intent); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "Air temperature" }; IList <double[]> x = new List <double[]>(); for (int i = 0; i < titles.Length; i++) { x.Add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); } IList <double[]> values = new List <double[]>(); values.Add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 }); int[] colors = new int[] { Color.Blue, Color.Yellow }; PointStyle[] styles = new PointStyle[] { PointStyle.Point, PointStyle.Point }; XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2); SetRenderer(renderer, colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { XYSeriesRenderer r = (XYSeriesRenderer)renderer.GetSeriesRendererAt(i); r.LineWidth = 3f; } SetChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32, Color.LightGray, Color.LightGray); renderer.XLabels = 12; renderer.YLabels = 10; renderer.SetShowGrid(true); renderer.XLabelsAlign = Android.Graphics.Paint.Align.Right; renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Right); renderer.ZoomButtonsVisible = true; renderer.SetPanLimits(new double[] { -10, 20, -10, 40 }); renderer.SetZoomLimits(new double[] { -10, 20, -10, 40 }); renderer.ZoomRate = 1.05f; renderer.LabelsColor = Color.White; renderer.XLabelsColor = Color.Green; renderer.SetYLabelsColor(0, colors[0]); renderer.SetYLabelsColor(1, colors[1]); renderer.SetYTitle("Hours", 1); renderer.SetYAxisAlign(Android.Graphics.Paint.Align.Right, 1); renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Left, 1); XYMultipleSeriesDataset dataset = BuildDataset(titles, x, values); values.Clear(); values.Add(new double[] { 4.3, 4.9, 5.9, 8.8, 10.8, 11.9, 13.6, 12.8, 11.4, 9.5, 7.5, 5.5 }); AddXYSeries(dataset, new string[] { "Sunshine hours" }, x, values, 1); Intent intent = ChartFactory.GetCubicLineChartIntent(context, dataset, renderer, 0.3f, "Average temperature"); return(intent); }
/// <summary> /// Sets a few of the series renderer settings. /// </summary> /// <param name="renderer"> the renderer to set the properties to </param> /// <param name="title"> the chart title </param> /// <param name="xTitle"> the title for the X axis </param> /// <param name="yTitle"> the title for the Y axis </param> /// <param name="xMin"> the minimum value on the X axis </param> /// <param name="xMax"> the maximum value on the X axis </param> /// <param name="yMin"> the minimum value on the Y axis </param> /// <param name="yMax"> the maximum value on the Y axis </param> /// <param name="axesColor"> the axes color </param> /// <param name="labelsColor"> the labels color </param> protected internal virtual void SetChartSettings(XYMultipleSeriesRenderer renderer, string title, string xTitle, string yTitle, double xMin, double xMax, double yMin, double yMax, int axesColor, int labelsColor) { renderer.ChartTitle = title; renderer.XTitle = xTitle; renderer.YTitle = yTitle; renderer.XAxisMin = xMin; renderer.XAxisMax = xMax; renderer.YAxisMin = yMin; renderer.YAxisMax = yMax; renderer.AxesColor = axesColor; renderer.LabelsColor = labelsColor; }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] {"Air temperature"}; IList<double[]> x = new List<double[]>(); for (int i = 0; i < titles.Length; i++) { x.Add(new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); } IList<double[]> values = new List<double[]>(); values.Add(new double[] {12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9}); int[] colors = new int[] {Color.BLUE, Color.YELLOW}; PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT}; XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(2); setRenderer(renderer, colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(i); r.LineWidth = 3f; } setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, 0, 32, Color.LTGRAY, Color.LTGRAY); renderer.XLabels = 12; renderer.YLabels = 10; renderer.ShowGrid = true; renderer.XLabelsAlign = Align.RIGHT; renderer.YLabelsAlign = Align.RIGHT; renderer.ZoomButtonsVisible = true; renderer.PanLimits = new double[] {-10, 20, -10, 40}; renderer.ZoomLimits = new double[] {-10, 20, -10, 40}; renderer.ZoomRate = 1.05f; renderer.LabelsColor = Color.WHITE; renderer.XLabelsColor = Color.GREEN; renderer.setYLabelsColor(0, colors[0]); renderer.setYLabelsColor(1, colors[1]); renderer.setYTitle("Hours", 1); renderer.setYAxisAlign(Align.RIGHT, 1); renderer.setYLabelsAlign(Align.LEFT, 1); XYMultipleSeriesDataset dataset = buildDataset(titles, x, values); values.Clear(); values.Add(new double[] {4.3, 4.9, 5.9, 8.8, 10.8, 11.9, 13.6, 12.8, 11.4, 9.5, 7.5, 5.5}); addXYSeries(dataset, new string[] {"Sunshine hours"}, x, values, 1); Intent intent = ChartFactory.getCubicLineChartIntent(context, dataset, renderer, 0.3f, "Average temperature"); return intent; }
public XYMultipleSeriesRenderer GetBarDemoRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.SetMargins(new int[] { 20, 30, 15, 0 }); SimpleSeriesRenderer r = new SimpleSeriesRenderer(); r.Color = Color.Blue; renderer.AddSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.Color = Color.Green; renderer.AddSeriesRenderer(r); return(renderer); }
protected XYMultipleSeriesRenderer BuildBarRenderer(int[] colors) { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; int length = colors.Length; for (int i = 0; i < length; i++) { SimpleSeriesRenderer r = new SimpleSeriesRenderer(); r.Color = colors[i]; renderer.AddSeriesRenderer(r); } return(renderer); }
protected void SetRenderer(XYMultipleSeriesRenderer renderer, int[] colors, PointStyle[] styles) { renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.PointSize = 5f; renderer.SetMargins(new[] { 20, 30, 15, 20 }); int length = colors.Length; for (int i = 0; i < length; i++) { XYSeriesRenderer r = new XYSeriesRenderer(); r.Color = colors[i]; r.PointStyle = styles[i]; renderer.AddSeriesRenderer(r); } }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "Sales for 2008", "Sales for 2007", "Difference between 2008 and 2007 sales" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 14230, 12300, 14240, 15244, 14900, 12200, 11030, 12000, 12500, 15500, 14600, 15000 }); values.Add(new double[] { 10230, 10900, 11240, 12540, 13500, 14200, 12530, 11200, 10500, 12500, 11600, 13500 }); int length = values[0].Length; double[] diff = new double[length]; for (int i = 0; i < length; i++) { diff[i] = values[0][i] - values[1][i]; } values.Add(diff); int[] colors = new int[] { Color.Blue, Color.Cyan, Color.Green }; PointStyle[] styles = new PointStyle[] { PointStyle.Point, PointStyle.Point, PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Monthly sales int the last 2 years", "Month", "Units sold", 0.75, 12.25, -5000, 19000, Color.Gray, Color.LightGray); renderer.XLabels = 12; renderer.YLabels = 10; renderer.ChartTitleTextSize = 20; renderer.SetTextTypeface("sans_serif", (int)TypefaceStyle.Bold); renderer.LabelsTextSize = 14f; renderer.AxisTitleTextSize = 15; renderer.LegendTextSize = 15; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { XYSeriesRenderer seriesRenderer = (XYSeriesRenderer)renderer.GetSeriesRendererAt(i); if (i == length - 1) { Org.Achartengine.Renderer.XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(Org.Achartengine.Renderer.XYSeriesRenderer.FillOutsideLine.Type.BoundsAll); fill.Color = Color.Green; seriesRenderer.AddFillOutsideLine(fill); } seriesRenderer.LineWidth = 2.5f; seriesRenderer.DisplayChartValues = true; seriesRenderer.ChartValuesTextSize = 10f; } return(ChartFactory.GetCubicLineChartIntent(context, BuildBarDataset(titles, values), renderer, 0.5f)); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Sales for 2008", "Sales for 2007", "Difference between 2008 and 2007 sales" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 14230, 12300, 14240, 15244, 14900, 12200, 11030, 12000, 12500, 15500, 14600, 15000 }); values.Add(new double[] { 10230, 10900, 11240, 12540, 13500, 14200, 12530, 11200, 10500, 12500, 11600, 13500 }); int length = values[0].Length; double[] diff = new double[length]; for (int i = 0; i < length; i++) { diff[i] = values[0][i] - values[1][i]; } values.Add(diff); int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN }; PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT, PointStyle.POINT }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.75, 12.25, -5000, 19000, Color.GRAY, Color.LTGRAY); renderer.XLabels = 12; renderer.YLabels = 10; renderer.ChartTitleTextSize = 20; renderer.setTextTypeface("sans_serif", Typeface.BOLD); renderer.LabelsTextSize = 14f; renderer.AxisTitleTextSize = 15; renderer.LegendTextSize = 15; length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { XYSeriesRenderer seriesRenderer = (XYSeriesRenderer)renderer.getSeriesRendererAt(i); if (i == length - 1) { XYSeriesRenderer.FillOutsideLine fill = new XYSeriesRenderer.FillOutsideLine(XYSeriesRenderer.FillOutsideLine.Type.BOUNDS_ALL); fill.Color = Color.GREEN; seriesRenderer.addFillOutsideLine(fill); } seriesRenderer.LineWidth = 2.5f; seriesRenderer.DisplayChartValues = true; seriesRenderer.ChartValuesTextSize = 10f; } return(ChartFactory.getCubicLineChartIntent(context, buildBarDataset(titles, values), renderer, 0.5f)); }
public override Android.Content.Intent Execute(Android.Content.Context context) { double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 }; double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 }; XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); RangeCategorySeries series = new RangeCategorySeries("Temperature"); int length = minValues.Length; for (int k = 0; k < length; k++) { series.Add(minValues[k], maxValues[k]); } dataset.AddSeries(series.ToXYSeries()); int[] colors = new int[] { Color.Cyan }; XYMultipleSeriesRenderer renderer = BuildBarRenderer(colors); SetChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5, -30, 45, Color.Gray, Color.LightGray); renderer.BarSpacing = 0.5; renderer.XLabels = 0; renderer.YLabels = 10; renderer.AddXTextLabel(1, "Jan"); renderer.AddXTextLabel(3, "Mar"); renderer.AddXTextLabel(5, "May"); renderer.AddXTextLabel(7, "Jul"); renderer.AddXTextLabel(10, "Oct"); renderer.AddXTextLabel(12, "Dec"); renderer.AddYTextLabel(-25, "Very cold"); renderer.AddYTextLabel(-10, "Cold"); renderer.AddYTextLabel(5, "OK"); renderer.AddYTextLabel(20, "Noci"); renderer.SetMargins(new int[] { 30, 70, 10, 0 }); renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Right); SimpleSeriesRenderer r = renderer.GetSeriesRendererAt(0); r.DisplayChartValues = true; r.ChartValuesTextSize = 12; r.ChartValuesSpacing = 3; r.GradientEnabled = true; r.SetGradientStart(-20, Color.Blue); r.SetGradientStop(20, Color.Green); return(ChartFactory.GetRangeBarChartIntent(context, dataset, renderer, BarChart.Type.Default, "Temperatur range")); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "New tickets", "Fixed tickets" }; IList <Java.Util.Date[]> dates = new List <Java.Util.Date[]>(); IList <double[]> values = new List <double[]>(); int length = titles.Length; for (int i = 0; i < length; i++) { dates.Add(new Java.Util.Date[12]); dates[i][0] = new Java.Util.Date(108, 9, 1); dates[i][1] = new Java.Util.Date(108, 9, 8); dates[i][2] = new Java.Util.Date(108, 9, 15); dates[i][3] = new Java.Util.Date(108, 9, 22); dates[i][4] = new Java.Util.Date(108, 9, 29); dates[i][5] = new Java.Util.Date(108, 10, 5); dates[i][6] = new Java.Util.Date(108, 10, 12); dates[i][7] = new Java.Util.Date(108, 10, 19); dates[i][8] = new Java.Util.Date(108, 10, 26); dates[i][9] = new Java.Util.Date(108, 11, 3); dates[i][10] = new Java.Util.Date(108, 11, 10); dates[i][11] = new Java.Util.Date(108, 11, 17); } values.Add(new double[] { 142, 123, 142, 152, 149, 122, 110, 120, 125, 155, 146, 150 }); values.Add(new double[] { 102, 90, 112, 105, 125, 112, 125, 112, 105, 115, 116, 135 }); length = values[0].Length; int[] colors = new int[] { Color.Blue, Color.Green }; PointStyle[] styles = new PointStyle[] { PointStyle.Point, PointStyle.Point }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); SetChartSettings(renderer, "Project work status", "Date", "Tickets", dates[0][0].Time, dates[0][11].Time, 50, 190, Color.Gray, Color.LightGray); renderer.XLabels = 0; renderer.YLabels = 10; renderer.AddYTextLabel(100, "test"); length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { SimpleSeriesRenderer seriesRenderer = renderer.GetSeriesRendererAt(i); seriesRenderer.DisplayChartValues = true; } renderer.XRoundedLabels = false; return(ChartFactory.GetTimeChartIntent(context, BuildDateDataset(titles, dates, values), renderer, "MM/dd/yyyy")); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { XYMultipleSeriesDataset series = new XYMultipleSeriesDataset(); XYValueSeries newTicketSeries = new XYValueSeries("New Tickets"); newTicketSeries.Add(1f, 2, 14); newTicketSeries.Add(2f, 2, 12); newTicketSeries.Add(3f, 2, 18); newTicketSeries.Add(4f, 2, 5); newTicketSeries.Add(5f, 2, 1); series.AddSeries(newTicketSeries); XYValueSeries fixedTicketSeries = new XYValueSeries("Fixed Tickets"); fixedTicketSeries.Add(1f, 1, 7); fixedTicketSeries.Add(2f, 1, 4); fixedTicketSeries.Add(3f, 1, 18); fixedTicketSeries.Add(4f, 1, 3); fixedTicketSeries.Add(5f, 1, 1); series.AddSeries(fixedTicketSeries); XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.SetMargins(new int[] { 20, 30, 15, 0 }); XYSeriesRenderer newTicketRenderer = new XYSeriesRenderer(); newTicketRenderer.Color = Color.Blue; renderer.AddSeriesRenderer(newTicketRenderer); XYSeriesRenderer fixedTicketRenderer = new XYSeriesRenderer(); fixedTicketRenderer.Color = Color.Green; renderer.AddSeriesRenderer(fixedTicketRenderer); SetChartSettings(renderer, "Project work status", "Priority", "", 0.5, 5.5, 0, 5, Color.Gray, Color.LightGray); renderer.XLabels = 7; renderer.YLabels = 0; renderer.SetShowGrid(false); return(ChartFactory.GetBubbleChartIntent(context, series, renderer, "Project tickets")); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent execute(Context context) { string[] titles = new string[] { "Crete", "Corfu", "Thassos", "Skiathos" }; IList <double[]> x = new List <double[]>(); for (int i = 0; i < titles.Length; i++) { x.Add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); } IList <double[]> values = new List <double[]>(); values.Add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 }); values.Add(new double[] { 10, 10, 12, 15, 20, 24, 26, 26, 23, 18, 14, 11 }); values.Add(new double[] { 5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6 }); values.Add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 }); int[] colors = new int[] { Color.BLUE, Color.GREEN, Color.CYAN, Color.YELLOW }; PointStyle[] styles = new PointStyle[] { PointStyle.CIRCLE, PointStyle.DIAMOND, PointStyle.TRIANGLE, PointStyle.SQUARE }; XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.getSeriesRendererAt(i)).FillPoints = true; } setChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, -10, 40, Color.LTGRAY, Color.LTGRAY); renderer.XLabels = 12; renderer.YLabels = 10; renderer.ShowGrid = true; renderer.XLabelsAlign = Align.RIGHT; renderer.YLabelsAlign = Align.RIGHT; renderer.ZoomButtonsVisible = true; renderer.PanLimits = new double[] { -10, 20, -10, 40 }; renderer.ZoomLimits = new double[] { -10, 20, -10, 40 }; XYMultipleSeriesDataset dataset = buildDataset(titles, x, values); XYSeries series = dataset.getSeriesAt(0); series.addAnnotation("Vacation", 6, 30); Intent intent = ChartFactory.getLineChartIntent(context, dataset, renderer, "Average temperature"); return(intent); }
/// <summary> /// Executes the chart demo. /// </summary> /// <param name="context"> the context </param> /// <returns> the built intent </returns> public override Intent Execute(Context context) { string[] titles = new string[] { "Crete", "Corfu", "Thassos", "Skiathos" }; IList <double[]> x = new List <double[]>(); for (int i = 0; i < titles.Length; i++) { x.Add(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); } IList <double[]> values = new List <double[]>(); values.Add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 }); values.Add(new double[] { 10, 10, 12, 15, 20, 24, 26, 26, 23, 18, 14, 11 }); values.Add(new double[] { 5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6 }); values.Add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 }); int[] colors = new int[] { Color.Blue, Color.Green, Color.Cyan, Color.Yellow }; PointStyle[] styles = new PointStyle[] { PointStyle.Circle, PointStyle.Diamond, PointStyle.Triangle, PointStyle.Square }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.GetSeriesRendererAt(i)).FillPoints = true; } SetChartSettings(renderer, "Average temperature", "Month", "Temperature", 0.5, 12.5, -10, 40, Color.LightGray, Color.LightGray); renderer.XLabels = 12; renderer.YLabels = 10; renderer.SetShowGrid(true); renderer.XLabelsAlign = Android.Graphics.Paint.Align.Right; renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Right); renderer.ZoomButtonsVisible = true; renderer.SetPanLimits(new double[] { -10, 20, -10, 40 }); renderer.SetZoomLimits(new double[] { -10, 20, -10, 40 }); XYMultipleSeriesDataset dataset = BuildDataset(titles, x, values); XYSeries series = dataset.GetSeriesAt(0); series.AddAnnotation("Vacation", 6, 30); Intent intent = ChartFactory.GetLineChartIntent(context, dataset, renderer, "Average temperature"); return(intent); }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "2008", "2007" }; IList <double[]> values = new List <double[]>(); values.Add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500, 12600, 14000 }); values.Add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500, 11600, 13500 }); int[] colors = new int[] { Color.Blue, Color.Cyan }; XYMultipleSeriesRenderer renderer = BuildBarRenderer(colors); SetChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5, 12.5, 0, 24000, Color.Gray, Color.LightGray); renderer.GetSeriesRendererAt(0).DisplayChartValues = true; renderer.GetSeriesRendererAt(1).DisplayChartValues = true; renderer.XLabels = 12; renderer.YLabels = 10; renderer.XLabelsAlign = Android.Graphics.Paint.Align.Left; renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Left); renderer.ZoomRate = 1.1f; renderer.BarSpacing = 0.5f; return(ChartFactory.GetBarChartIntent(context, BuildBarDataset(titles, values), renderer, BarChart.Type.Stacked)); }
public override Android.Content.Intent Execute(Android.Content.Context context) { String[] titles = new String[] { "Inside", "Outside" }; long now = new Date().Time / DAY * DAY; IList <Date[]> x = new List <Date[]>(); for (int i = 0; i < titles.Length; i++) { Date[] dates = new Date[HOURS]; for (int j = 0; j < HOURS; j++) { dates[j] = new Date(now - (HOURS - j) * HOUR); } x.Add(dates); } IList <double[]> values = new List <double[]>(); values.Add(new double[] { 21.2, 21.5, 21.7, 21.5, 21.4, 21.4, 21.3, 21.1, 20.6, 20.3, 20.2, 19.9, 19.7, 19.6, 19.9, 20.3, 20.6, 20.9, 21.2, 21.6, 21.9, 22.1, 21.7, 21.5 }); values.Add(new double[] { 1.9, 1.2, 0.9, 0.5, 0.1, -0.5, -0.6, MathHelper.NullValue, MathHelper.NullValue, -1.8, -0.3, 1.4, 3.4, 4.9, 7.0, 6.4, 3.4, 2.0, 1.5, 0.9, -0.5, MathHelper.NullValue, -1.9, -2.5, -4.3 }); int[] colors = new int[] { Color.Green, Color.Blue }; PointStyle[] styles = new PointStyle[] { PointStyle.Circle, PointStyle.Diamond }; XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles); int length = renderer.SeriesRendererCount; for (int i = 0; i < length; i++) { ((XYSeriesRenderer)renderer.GetSeriesRendererAt(i)).FillPoints = true; } SetChartSettings(renderer, "Sensor temperature", "Hour", "Celsius degrees", x[0][0].Time, x[0][HOURS - 1].Time, -5, 30, Color.LightGray, Color.LightGray); renderer.XLabels = 10; renderer.YLabels = 10; renderer.SetShowGrid(true); renderer.XLabelsAlign = Android.Graphics.Paint.Align.Center; renderer.SetYLabelsAlign(Android.Graphics.Paint.Align.Right); return(ChartFactory.GetTimeChartIntent(context, BuildDateDataset(titles, x, values), renderer, "h:mm a")); }
/// <summary> /// Sets a few of the series renderer settings. /// </summary> /// <param name="renderer"> the renderer to set the properties to </param> /// <param name="title"> the chart title </param> /// <param name="xTitle"> the title for the X axis </param> /// <param name="yTitle"> the title for the Y axis </param> /// <param name="xMin"> the minimum value on the X axis </param> /// <param name="xMax"> the maximum value on the X axis </param> /// <param name="yMin"> the minimum value on the Y axis </param> /// <param name="yMax"> the maximum value on the Y axis </param> /// <param name="axesColor"> the axes color </param> /// <param name="labelsColor"> the labels color </param> protected internal virtual void setChartSettings(XYMultipleSeriesRenderer renderer, string title, string xTitle, string yTitle, double xMin, double xMax, double yMin, double yMax, int axesColor, int labelsColor) { renderer.ChartTitle = title; renderer.XTitle = xTitle; renderer.YTitle = yTitle; renderer.XAxisMin = xMin; renderer.XAxisMax = xMax; renderer.YAxisMin = yMin; renderer.YAxisMax = yMax; renderer.AxesColor = axesColor; renderer.LabelsColor = labelsColor; }
/// <summary> /// Builds a bar multiple series renderer to use the provided colors. /// </summary> /// <param name="colors"> the series renderers colors </param> /// <returns> the bar multiple series renderer </returns> protected internal virtual XYMultipleSeriesRenderer buildBarRenderer(int[] colors) { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; int length = colors.Length; for (int i = 0; i < length; i++) { SimpleSeriesRenderer r = new SimpleSeriesRenderer(); r.Color = colors[i]; renderer.addSeriesRenderer(r); } return renderer; }
protected internal override void onListItemClick(ListView l, View v, int position, long id) { base.onListItemClick(l, v, position, id); switch (position) { case 0: Intent intent = ChartFactory.getLineChartIntent(this, DemoDataset, DemoRenderer); startActivity(intent); break; case 1: intent = ChartFactory.getScatterChartIntent(this, DemoDataset, DemoRenderer); startActivity(intent); break; case 2: intent = ChartFactory.getTimeChartIntent(this, DateDemoDataset, DemoRenderer, null); startActivity(intent); break; case 3: XYMultipleSeriesRenderer renderer = BarDemoRenderer; ChartSettings = renderer; intent = ChartFactory.getBarChartIntent(this, BarDemoDataset, renderer, Type.DEFAULT); startActivity(intent); break; } }
/// <summary> /// Builds an XY multiple series renderer. /// </summary> /// <param name="colors"> the series rendering colors </param> /// <param name="styles"> the series point styles </param> /// <returns> the XY multiple series renderers </returns> protected internal virtual XYMultipleSeriesRenderer buildRenderer(int[] colors, PointStyle[] styles) { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); setRenderer(renderer, colors, styles); return renderer; }
protected internal virtual void setRenderer(XYMultipleSeriesRenderer renderer, int[] colors, PointStyle[] styles) { renderer.AxisTitleTextSize = 16; renderer.ChartTitleTextSize = 20; renderer.LabelsTextSize = 15; renderer.LegendTextSize = 15; renderer.PointSize = 5f; renderer.Margins = new int[] {20, 30, 15, 20}; int length = colors.Length; for (int i = 0; i < length; i++) { XYSeriesRenderer r = new XYSeriesRenderer(); r.Color = colors[i]; r.PointStyle = styles[i]; renderer.addSeriesRenderer(r); } }