public ChartTypesViewModel() { LineConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.Line, Color.White); BarConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.Bar, Color.White); RadarConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.Radar, Color.White); DoughnutConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.Doughnut, Color.White); PieConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.Pie, Color.White); PolarAreaConfig = RandomChartBuilder.GetChartConfig(Plugin.XamarinChartJS.ChartTypes.PolarArea, Color.White); BubbleConfig = RandomChartBuilder.GetBubbleChartConfig(Color.White); ScatterConfig = RandomChartBuilder.GetScatterChartConfig(Color.White); }
public void OnChartTypeChanged(object sender, EventArgs e) { var selectedChartType = (string)chartTypePicker.SelectedItem; if (selectedChartType != null) { ChartViewConfig newConfig; if (selectedChartType == ChartTypes.Bubble) { newConfig = RandomChartBuilder.GetBubbleChartConfig(Color.White); } else if (selectedChartType == ChartTypes.Scatter) { newConfig = RandomChartBuilder.GetScatterChartConfig(Color.White); } else { newConfig = RandomChartBuilder.GetChartConfig(selectedChartType, Color.White); } dynamicChart.Config.ChartConfig = newConfig.ChartConfig; } }