How can I change the color of asp.net color management series?

I am writing a simple web application with this code:

Series Series1 = new Series();
            Series Series2 = new Series();
            Series1.ChartType = SeriesChartType.Column;
            Series1.ChartType = SeriesChartType.Column;

            Series1.Points.Add(30);
            Series2.Points.Add(40);
            Chart1.Series.Add(Series1);
            Chart1.Series.Add(Series2);


this code is outside of this: but I want to show the user the difference in the two columns and show me the following: how can I write code for this purpose? thanks.
enter image description here

enter image description here

+4
source share
1 answer

If I'm not mistaken, you are looking for a graph such as a stack, you need to add a third series to indicate the difference, try to follow

        Series Series1 = new Series();
        Series Series2 = new Series();
        Series Series3 = new Series(); 
        Series1.ChartType = SeriesChartType.Column;
        Series2.ChartType = SeriesChartType.StackedColumn;
        Series3.ChartType = SeriesChartType.StackedColumn;

        int series1Data=30;
        int series2Data=40;
        int series3Data=series2Data-series1Data;
        series2Data=series1Data;

        Series1.Points.Add(series1Data);
        Series2.Points.Add(series2Data);
        Series3.Points.Add(series3Data);
        Chart1.Series.Add(Series1);
        Chart1.Series.Add(Series2);
        Chart1.Series.Add(Series3);
+2
source

Source: https://habr.com/ru/post/1621223/


All Articles