Custom X / Y Mesh Line in MSChart Management

I have a C # window shape with a simple two-dimensional line chart, in which I want to add my own X or Y axis markers, and draw a special grid line (for example, highlighted, dashed line). I looked at the customLabels property, but that seems to override the default grid that I still want to display. This illustrates something like a threshold or circumcision. How to do this using the MSChart control?

Thank you very much

+2
source share
1 answer

Could you achieve what you want with striplines?

In the ms chart examples (get here http://archive.msdn.microsoft.com/mschart ), in the section "Using Custom Labels" they use Y lines that are effective enough to highlight ranges of values. They also do not affect the grid ... I checked this by slightly modifying the sample code so that I could easily move the borders of the series (see below).

double low_med = 17; // was 30 double med_hi = 92; // was 70 // Set Y axis custom labels axisY.CustomLabels.Add(0, low_med, "Low"); axisY.CustomLabels.Add(low_med, med_hi, "Medium"); axisY.CustomLabels.Add(med_hi, 100, "High"); StripLine stripLow = new StripLine(); stripLow.IntervalOffset = 0; stripLow.StripWidth = low_med; stripLow.BackColor = Color.FromArgb(64, Color.Green); StripLine stripMed = new StripLine(); stripMed.IntervalOffset = low_med; stripMed.StripWidth = med_hi - low_med; stripMed.BackColor = Color.FromArgb(64, Color.Orange); StripLine stripHigh = new StripLine(); stripHigh.IntervalOffset = med_hi; stripHigh.StripWidth = 100 - med_hi; stripHigh.BackColor = Color.FromArgb(64, Color.Red); axisY.StripLines.Add(stripLow); axisY.StripLines.Add(stripMed); axisY.StripLines.Add(stripHigh); 
+3
source

All Articles