Exemplo n.º 1
0
        //---------------------------------------------------------------------

        private void diagramTypeSettingBtn_Click(object sender, EventArgs e)//+
        {
            using (DataSettingForm dsf = new DataSettingForm())
            {
                dsf.NameGroupBox = "Настройка типа диаграммы";
                dsf.TypeSettings = "diagramType";
                dsf.SeriesItem   = visualChart.Series[0];
                dsf.ShowDialog();
                if (dsf.Status)
                {
                    string selectedType = dsf.SelectedItem as string;
                    if (seriesTypeMap[selectedType] == SeriesChartType.Pie || seriesTypeMap[selectedType] == SeriesChartType.Doughnut)
                    {
                        Series series = visualChart.Series[0];

                        visualChart.Series.Clear();
                        visualChart.Series.Add(series);
                        foreach (var item in legendItems)
                        {
                            legend.CustomItems.Add(item);
                        }
                        series.IsVisibleInLegend = false;
                    }
                    else
                    {
                        foreach (var item in visualChart.Series)
                        {
                            item.ChartType = seriesTypeMap[selectedType];
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void pointsSettingBtn_Click(object sender, EventArgs e)//+
        {
            using (DataSettingForm dsf = new DataSettingForm())
            {
                dsf.NameGroupBox = "Настройка цвета точек";
                dsf.TypeSettings = "color";
                dsf.SeriesItem   = visualChart.Series[0];
                dsf.ShowDialog();
                if (dsf.Status)
                {
                    string selectedPointName = dsf.SelectedItem as string;
                    Color  selectedColor     = dsf.Color;

                    DataPoint selectedPoint = visualChart.Series[0].Points.SingleOrDefault(x => x.AxisLabel == selectedPointName);

                    selectedPoint.Color = selectedColor;
                    RefreshLegend(visualChart.Series[0]);
                }
            }
        }