Reputation: 491
I have some data I need to display using MSChart, I am looking to plot data which is one of the following values taken at a particular datetime:
Low Low-Medium Medium Medium-High High
So I am looking for datetime along the X axis and the above values on Y
When I try and plot them something like this....
mySeries.Points.AddXY(dateA, "Low");
mySeries.Points.AddXY(dateB, "Low-Medium");
mySeries.Points.AddXY(dateC, "Medium");
The chart obviously doesn't have any idea that Medium show be a larger bar than Low.
How can I specify this range of values for the Y Axis?
Upvotes: 0
Views: 3576
Reputation: 57210
You can set numeric values as suggested in Kyle answer and then change the Y labels e.g.:
chart1.ChartAreas[0].AxisY.CustomLabels.Add(0, 1, "LOW");
// it means: on Y range = [0, 1] show the label "LOW" ...
chart1.ChartAreas[0].AxisY.CustomLabels.Add(2, 3, "MEDIUM");
chart1.ChartAreas[0].AxisY.CustomLabels.Add(3, 4, "HIGH");
Upvotes: 2
Reputation: 25684
Give the different values a numeric value:
mySeries.Points.AddXY(dateA, 1); // Low
mySeries.Points.AddXY(dateB, 2); // Low-Medium
mySeries.Points.AddXY(dateC, 3); // Medium
I'm not sure how you would show the named values on the Y axis though.
Upvotes: 1