Reputation: 3590
So I am using this fancy new charting control. More info here
I have data displayed already. What I want to do is add a line seperator that is there every year. Basically vertical red line on every jan, 1st?
Any ideas??? Data points do not exist for each day in the year. It can be anywhere from 365 to 1 data point in between two year seperators.
I tried going over sample but did not get any useful idea. Anyone?
So I found that they have StripLine
Stripline stripLine = new StripLine();
I wonder how can I add this to a point. Not to make it repeat automatically. Anyone?
Just to be clear I have a graph and while adding points as soon as I find a point that matches certain conditions I want to add strip line at that place as well.
Upvotes: 2
Views: 10316
Reputation: 100567
This might help for every January 1st:
StripLine stripLine = new StripLine();
stripLine.BackColor = Color.Red;
stripLine.IntervalOffset = 1; //how many days until Jan 1 from the start of the range? This is always relative to the data being displayed.
stripLine.IntervalOffsetType = DateTimeIntervalType.Days; //days in reference to the above question
stripLine.Interval = 60; //set a marker every 60 days
stripLine.IntervalType = DateTimeIntervalType.Days; //in relation to comment above
stripLine.StripWidth = 1; //show the marker in a 1 day width
stripLine.StripWidthType = DateTimeIntervalType.Days; //in relation to comment above
Chart1.ChartAreas["ChartArea1"].AxisX.StripLines.Add(stripLine);
Upvotes: 1