Page 1 of 1

How to draw line and area types on a same chart ??

Posted: Tue Jun 20, 2023 7:41 am
by 21095382
Greetings.

I want to draw a area + line type graph like the attached picture file.
I tried to draw line + area series, but i couldn't. Only line-type graphs were drawn on the chart.
I'd be grateful if you could tell me how.

many thanks.

Re: How to draw line and area types on a same chart ??

Posted: Tue Jun 20, 2023 3:51 pm
by Christopher
Hello,

for drawing the area under a curve, you can use the SeriesRegion tool like this:

Code: Select all

        public Form1()
        {
            InitializeComponent();

            var line = new Line(tChart1.Chart);
            line.FillSampleValues(1000);

            tChart1.Axes.Bottom.SetMinMax(600, 1000);

            _ = new SeriesRegionTool(tChart1.Chart)
            {
                AutoBound = false,
                LowerBound = 820,
                UpperBound = 870,
                Series = line,
                DrawBehindSeries = true,
                Color = System.Drawing.Color.AliceBlue,
            };

            _ = new SeriesRegionTool(tChart1.Chart)
            {
                AutoBound = false,
                LowerBound = 920,
                UpperBound = 970,
                Series = line,
                DrawBehindSeries = true,
                Color = System.Drawing.Color.PowderBlue,
            };
        }
Screenshot from 2023-06-20 17-49-45.png
Screenshot from 2023-06-20 17-49-45.png (32.69 KiB) Viewed 8175 times