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 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)
        {
            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 override Android.Content.Intent Execute(Android.Content.Context context)
        {
            String[] titles = new String[] { "Crete Air Temperature", "Skiathos 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 });
            values.Add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 });
            int[] colors = new int[] { Color.Green, Color.Rgb(200, 150, 0) };
            PointStyle[] styles = new PointStyle[] { PointStyle.Circle, PointStyle.Diamond };
            XYMultipleSeriesRenderer renderer = BuildRenderer(colors, styles);
            renderer.PointSize = 5.5f;
            int length = renderer.SeriesRendererCount;
            for (int i = 0; i < length; i++)
            {
                XYSeriesRenderer r = (XYSeriesRenderer)renderer.GetSeriesRendererAt(i);
                r.LineWidth = 5;
                r.FillPoints = true;
            }
            SetChartSettings(renderer, "Weather data", "Month", "Temperature", 0.5, 12.5, 0, 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 });

            XYValueSeries sunSeries = new XYValueSeries("Sunshine hours");
            sunSeries.Add(1f, 35, 4.3);
            sunSeries.Add(2f, 35, 4.9);
            sunSeries.Add(3f, 35, 5.9);
            sunSeries.Add(4f, 35, 8.8);
            sunSeries.Add(5f, 35, 10.8);
            sunSeries.Add(6f, 35, 11.9);
            sunSeries.Add(7f, 35, 13.6);
            sunSeries.Add(8f, 35, 12.8);
            sunSeries.Add(9f, 35, 11.4);
            sunSeries.Add(10f, 35, 9.5);
            sunSeries.Add(11f, 35, 7.5);
            sunSeries.Add(12f, 35, 5.5);
            XYSeriesRenderer lightRenderer = new XYSeriesRenderer();
            lightRenderer.Color = Color.Yellow;

            XYSeries waterSeries = new XYSeries("Water Temperature");
            waterSeries.Add(1, 16);
            waterSeries.Add(2, 15);
            waterSeries.Add(3, 16);
            waterSeries.Add(4, 17);
            waterSeries.Add(5, 20);
            waterSeries.Add(6, 23);
            waterSeries.Add(7, 25);
            waterSeries.Add(8, 25.5);
            waterSeries.Add(9, 26.5);
            waterSeries.Add(10, 24);
            waterSeries.Add(11, 22);
            waterSeries.Add(12, 18);
            renderer.BarSpacing = 0.5;
            XYSeriesRenderer waterRenderer = new XYSeriesRenderer();
            waterRenderer.Color = Color.Argb(250, 0, 210, 250);

            XYMultipleSeriesDataset dataset = BuildDataset(titles, x, values);
            dataset.AddSeries(0, sunSeries);
            dataset.AddSeries(0, waterSeries);
            renderer.AddSeriesRenderer(0, lightRenderer);
            renderer.AddSeriesRenderer(0, waterRenderer);
            waterRenderer.DisplayChartValues = true;
            waterRenderer.ChartValuesTextSize = 10;

            String[] types = new String[] { "Bar", BubbleChart.Type, LineChart.Type, CubicLineChart.Type };
            Intent intent = ChartFactory.GetCombinedXYChartIntent(context, dataset, renderer, types, "Weather parameters");
            return intent;
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.xy_chart);

            mX = FindViewById<EditText>(Resource.Id.xValue);
            mY = FindViewById<EditText>(Resource.Id.yValue);
            mAdd = FindViewById<Button>(Resource.Id.add);

            mRenderer.ApplyBackgroundColor = true;
            mRenderer.BackgroundColor = Color.Argb(100, 50, 50, 50);
            mRenderer.AxisTitleTextSize = 16;
            mRenderer.ChartTitleTextSize = 20;
            mRenderer.LabelsTextSize = 15;
            mRenderer.LegendTextSize = 15;
            mRenderer.SetMargins(new int[] { 20, 30, 15, 0 });
            mRenderer.ZoomButtonsVisible = true;
            mRenderer.PointSize = 5;

            mNewSeries = FindViewById<Button>(Resource.Id.new_series);
            mNewSeries.Click += (e, s) =>
            {
                String seriesTitle = "Series " + mDataset.SeriesCount + 1;
                XYSeries series = new XYSeries(seriesTitle);
                mDataset.AddSeries(series);
                mCurrentSeries = series;
                XYSeriesRenderer renderer = new XYSeriesRenderer();
                mRenderer.AddSeriesRenderer(renderer);
                renderer.PointStyle = PointStyle.Circle;
                renderer.FillPoints = true;
                renderer.DisplayChartValues = true;
                renderer.DisplayChartValuesDistance = 10;
                mCurrentRenderer = renderer;
                SetSeriesWidgetsEnabled(true);
                mChartView.Repaint();
            };

            mAdd.Click += (e, s) =>
            {
                double x = 0;
                double y = 0;
                try
                {
                    x = Double.Parse(mX.Text);
                }
                catch (Exception)
                {
                    mX.RequestFocus();
                    return;
                }
                try
                {
                    y = double.Parse(mY.Text);
                }
                catch (Exception)
                {
                    mY.RequestFocus();
                    return;
                }
                mCurrentSeries.Add(x, y);
                mX.Text = "";
                mY.Text = "";
                mX.RequestFocus();
                mChartView.Repaint();
            };
        }
 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;
 }