public override Android.Content.Intent Execute(Android.Content.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"); }
public void AddXYSeries(XYMultipleSeriesDataset dataset, String[] titles, IList<double[]> xValues, IList<double[]> yValues, int scale) { int length = titles.Length; for (int i = 0; i < length; i++) { XYSeries series = new XYSeries(titles[i], scale); double[] xV = xValues[i]; double[] yV = yValues[i]; int seriesLength = xV.Length; for (int j = 0; j < seriesLength; j++) { series.Add(xV[j], yV[j]); } dataset.AddSeries(series); } }
private XYMultipleSeriesDataset GetDemoDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); const int nr = 10; Random r = new Random(); for (int i = 0; i < SERIES_NR; i++) { XYSeries series = new XYSeries("Demo series " + (i + 1)); for (int k = 0; k < nr; k++) { series.Add(k, 20 + r.Next() % 100); } dataset.AddSeries(series); } return dataset; }
private XYMultipleSeriesDataset GetDateDemoDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); const int nr = 10; long value = new Java.Util.Date().Time - 3 * TimeChart.Day; Random r = new Random(); for (int i = 0; i < SERIES_NR; i++) { TimeSeries series = new TimeSeries("Demo series " + (i + 1)); for (int k = 0; k < nr; k++) { series.Add(new Java.Util.Date(value + k * TimeChart.Day / 4), 20 + r.Next() % 100); } dataset.AddSeries(series); } return dataset; }
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"); }
protected XYMultipleSeriesDataset BuildDateDataset(String[] titles, IList<Date[]> xValues, IList<double[]> yValues) { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); int length = titles.Length; for (int i = 0; i < length; i++) { TimeSeries series = new TimeSeries(titles[i]); Date[] xV = xValues[i]; double[] yV = yValues[i]; int seriesLength = xV.Length; for (int j = 0; j < seriesLength; j++) { series.Add(xV[j], yV[j]); } dataset.AddSeries(series); } return dataset; }
protected XYMultipleSeriesDataset BuildBarDataset(String[] title, IList<double[]> values) { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); int length = title.Length; for (int i = 0; i < length; i++) { CategorySeries series = new CategorySeries(title[i]); double[] v = values[i]; int seriesLength = v.Length; for (int k = 0; k < seriesLength; k++) { series.Add(v[k]); } dataset.AddSeries(series.ToXYSeries()); } return dataset; }