Abu Muhammad
Abu Muhammad

Reputation: 421

How to separate two series by displaying Line between them in Column chart C#?

I have 2 series (2016 and 2017) in column chart and all datapoints values are showing fine. but I need to differentiate two series values by showing thick border line between two series.

because , now it seems to combining the 2017 values with 2016 series values since no separator line not there.

FYI.

Current Column Chart Image

EDIT: After used vertical line in my column chart the output as like below,

enter image description here

But i need only one Line that should present between the two series .

how do i remove other lines.

Finally , Got the expected Output.

enter image description here

Thanks in advance.

Upvotes: 1

Views: 495

Answers (2)

Abu Muhammad
Abu Muhammad

Reputation: 421

var series = Mainchart.Series[0]; //series object
                var chartArea = Mainchart.ChartAreas[series.ChartArea];
                chartArea.AxisX.StripLines.Add(new StripLine
                {
                    BorderDashStyle = ChartDashStyle.Solid,
                    BorderColor = Color.Black,
                    Interval = 0, // to show only one vertical line
                    IntervalOffset = 1.5, // for showing Vertical line between 2 series 
                    IntervalType = DateTimeIntervalType.Years // for me years
                });

Upvotes: 2

huse.ckr
huse.ckr

Reputation: 530

You may use StripLine:

StripLine limit_lower_strip = new StripLine();
limit_lower_strip.Interval = 0;
limit_lower_strip.IntervalOffset = v1_lower;
limit_lower_strip.StripWidth = 0.0;
limit_lower_strip.BorderColor = Color.FromArgb(100, Color.Red);
limit_lower_strip.BorderDashStyle = ChartDashStyle.Solid;
limit_lower_strip.BorderWidth = 5;
chart1.ChartAreas[0].AxisX.StripLines.Add(limit_lower_strip);

Upvotes: 1

Related Questions