private void ChartToCreate(String item) { List <String[]> originalData = ChartData(); String[] dataPicker = new String[originalData.Count]; for (int i = 0; i < originalData.Count; i++) { dataPicker[i] = originalData[i][1]; } _customChart.ChartView.Chart.Series.RemoveAllSeries(); var imageButton = ((((this.Children[0] as ContentPage).Content as ScrollView).Content as StackLayout).Children[1] as Grid).Children[2] as Button; switch (item) { case "AREA": Area area = new Area(); area.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(area); _customChart.ImageSource = dataPicker[0]; imageButton.ImageSource = dataPicker[0]; break; #if !TEE_STD case "ARROW": Arrow arrow = new Arrow(); arrow.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(arrow); _customChart.ImageSource = dataPicker[1]; imageButton.ImageSource = dataPicker[1]; break; #endif case "BAR": Bar bar = new Bar(); bar.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(bar); _customChart.ImageSource = dataPicker[2]; imageButton.ImageSource = dataPicker[2]; break; #if !TEE_STD case "BARJOIN": BarJoin barjoin = new BarJoin(); barjoin.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(barjoin); _customChart.ImageSource = dataPicker[3]; imageButton.ImageSource = dataPicker[3]; break; case "BEZIER": Bezier bezier = new Bezier(); bezier.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(bezier); _customChart.ImageSource = dataPicker[4]; imageButton.ImageSource = dataPicker[4]; break; case "BOX": Box box = new Box(); box.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(box); _customChart.ImageSource = dataPicker[5]; imageButton.ImageSource = dataPicker[5]; break; #endif case "BUBBLES": Bubble bubble = new Bubble(); bubble.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(bubble); _customChart.ImageSource = dataPicker[6]; imageButton.ImageSource = dataPicker[6]; break; #if !TEE_STD case "CANDLE": Candle candle = new Candle(); candle.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(candle); _customChart.ImageSource = dataPicker[7]; imageButton.ImageSource = dataPicker[7]; break; case "CONTOUR": Contour countour = new Contour(); countour.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(countour); _customChart.ImageSource = dataPicker[8]; imageButton.ImageSource = dataPicker[8]; break; case "DARVAS": Darvas darvas = new Darvas(); darvas.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(darvas); _customChart.ImageSource = dataPicker[9]; imageButton.ImageSource = dataPicker[9]; break; #endif case "DONUT": Donut donut = new Donut(); donut.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(donut); _customChart.ImageSource = dataPicker[10]; imageButton.ImageSource = dataPicker[10]; break; #if !TEE_STD case "ERROR": Error error = new Error(); error.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(error); _customChart.ImageSource = dataPicker[11]; imageButton.ImageSource = dataPicker[11]; break; case "ERRORBAR": ErrorBar errorbar = new ErrorBar(); errorbar.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(errorbar); _customChart.ImageSource = dataPicker[12]; imageButton.ImageSource = dataPicker[12]; break; case "ERRORPOINT": ErrorPoint errorPoint = new ErrorPoint(); errorPoint.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(errorPoint); _customChart.ImageSource = dataPicker[13]; imageButton.ImageSource = dataPicker[13]; break; #endif case "FASTLINE": FastLine fastLine = new FastLine(); fastLine.FillSampleValues(2); _customChart.ChartView.Chart.Series.Add(fastLine); _customChart.ImageSource = dataPicker[14]; imageButton.ImageSource = dataPicker[14]; break; #if !TEE_STD case "HIGHLOW": HighLow highLow = new HighLow(); highLow.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(highLow); _customChart.ImageSource = dataPicker[15]; imageButton.ImageSource = dataPicker[15]; break; case "HISTOGRAM": Histogram histogram = new Histogram(); histogram.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(histogram); _customChart.ImageSource = dataPicker[16]; imageButton.ImageSource = dataPicker[16]; break; #endif case "HORIZAREA": HorizArea horizArea = new HorizArea(); horizArea.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizArea); _customChart.ImageSource = dataPicker[17]; imageButton.ImageSource = dataPicker[17]; break; case "HORIZBAR": HorizBar horizBar = new HorizBar(); horizBar.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizBar); _customChart.ImageSource = dataPicker[18]; imageButton.ImageSource = dataPicker[18]; break; case "HORIZLINE": HorizLine horizLine = new HorizLine(); horizLine.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizLine); _customChart.ImageSource = dataPicker[19]; imageButton.ImageSource = dataPicker[19]; break; #if !TEE_STD case "ISOSURFACE": IsoSurface isoSurface = new IsoSurface(); isoSurface.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(isoSurface); _customChart.ImageSource = dataPicker[20]; imageButton.ImageSource = dataPicker[20]; break; #endif case "LINE": Line line = new Line(); line.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(line); _customChart.ImageSource = dataPicker[21]; imageButton.ImageSource = dataPicker[21]; break; #if !TEE_STD case "LINEPOINT": LinePoint linePoint = new LinePoint(); linePoint.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(linePoint); _customChart.ImageSource = dataPicker[22]; imageButton.ImageSource = dataPicker[22]; break; #endif case "PIE": Pie pie = new Pie(); pie.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(pie); _customChart.ImageSource = dataPicker[23]; imageButton.ImageSource = dataPicker[23]; break; #if !TEE_STD case "SURFACE": Surface surface = new Surface(); surface.FillSampleValues(10); //surface. _customChart.ChartView.Chart.Series.Add(surface); _customChart.ImageSource = dataPicker[24]; imageButton.ImageSource = dataPicker[24]; break; case "TOWER": Tower tower = new Tower(); tower.FillSampleValues(8); _customChart.ChartView.Chart.Series.Add(tower); _customChart.ImageSource = dataPicker[25]; imageButton.ImageSource = dataPicker[25]; break; case "VOLUME": Volume volume = new Volume(); volume.FillSampleValues(9); _customChart.ChartView.Chart.Series.Add(volume); _customChart.ImageSource = dataPicker[26]; imageButton.ImageSource = dataPicker[26]; break; #endif } _customChart.ChartView.Chart.Axes.Left.Automatic = true; _customChart.ChartView.Chart.Axes.Bottom.Automatic = true; }
public HorizontalAreaChart(ChartView BaseChart) { horizArea1 = new HorizArea(); var = new Variables.Variables(); tool_dataPointSelect = new DataPointSelection(BaseChart); BaseChart.Chart.Header.Text = "People in different countries"; BaseChart.Chart.Series.Add(horizArea1); BaseChart.Chart.Legend.Visible = false; horizArea1.SeriesColor = var.GetPaletteBasic[0]; horizArea1.Chart.Zoom.Allow = false; horizArea1.Chart.Panning.Allow = ScrollModes.None; horizArea1.RecalcOptions = RecalcOptions.OnModify; horizArea1.DefaultNullValue = 0; horizArea1.AreaLines.Visible = false; horizArea1.Pointer.Visible = true; horizArea1.ClickableLine = true; horizArea1.LinePen.Width = 5; horizArea1.ClickPointer += tool_dataPointSelect.PointValue_Click; horizArea1.GetSeriesMark += tool_dataPointSelect.Serie_GetSeriesMark; horizArea1.Pointer.Style = PointerStyles.Nothing; horizArea1.Pointer.InflateMargins = false; horizArea1.ClickTolerance = 30; horizArea1.LinePen.Style = DashStyle.Solid; horizArea1.LinePen.EndCap = PenLineCap.Flat; horizArea1.LinePen.DashCap = PenLineCap.Flat; horizArea1.LinePen.Color = var.GetPaletteBasic[0].AddLuminosity(-0.2); horizArea1.VertAxis = VerticalAxis.Both; horizArea1.HorizAxis = HorizontalAxis.Both; for (int i = 0; i < var.GetValorHorizArea1.Length; i++) { horizArea1.Add(var.GetValorHorizArea1[i], var.GetValorHorizAreaX[i]); } BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 0.001, BaseChart.Chart.Axes.Left.MaxYValue + 0.01); BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 20000); BaseChart.Chart.Axes.Bottom.Increment = 30000; BaseChart.Chart.Axes.Left.Labels.ValueFormat = "0"; BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0K"; BaseChart.Chart.Axes.Left.Title.Pen = new ChartPen { Color = Color.Black, Width = 15 }; BaseChart.Chart.Axes.Left.Visible = true; BaseChart.Chart.Axes.Left.AxisPen.Visible = true; BaseChart.Chart.Axes.Left.Ticks = new Axis.TicksPen { Width = 2, Visible = true, Color = Color.FromArgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10, }; BaseChart.Chart.Axes.Bottom.Visible = true; BaseChart.Chart.Axes.Left.Title.Angle = 90; BaseChart.Chart.Axes.Left.Grid.Visible = false; BaseChart.Chart.Axes.Bottom.Grid.Visible = false; BaseChart.Chart.Axes.Left.Title.Text = "Countries"; BaseChart.Chart.Axes.Bottom.Title.Text = "People (K)"; BaseChart.Chart.Axes.Left.Title.Font.Size = 14; BaseChart.Chart.Axes.Bottom.Title.Font.Size = 14; BaseChart.Chart.Axes.Left.Title.CustomSize = 50; BaseChart.Chart.Axes.Left.LabelsOnAxis = true; BaseChart.Chart.Axes.Left.Labels.AutoSize = true; BaseChart.Chart.Title.AutoSize = true; BaseChart.Chart.Axes.Left.StartPosition = 1; BaseChart.Chart.ClickSeries += null; BaseChart.Chart.Panel.MarginLeft = 6; BaseChart.Chart.Axes.Left.Title.Visible = false; Themes.AplicarMarksTheme1(BaseChart); BaseChart.Chart.Series[0].Marks.Height = 35; BaseChart.Chart.Series[0].Marks.Width = 110; BaseChart.Chart.Series[0].Marks.Font.Size = 12; }