I have WebChart with 6 series each one on a custom axis
1. For every axis I want to draw it's zero line that should start from the left
(left axis of the graph) and go to the right (right axis of the graph)
2. For every axis I want to show on the right (right axis of the graph)
the minimum and maximum axis values with ticks for the minimum and the maximum
I also need to add text between the minimum and maximum values
i.e. for the voltage series V1 I want 473 for maximum, -473 for minimum and "kVolts" for the text
I tried to add the lines, ticks and the text on the "WebChart1_BeforeDraw" event
Code: Select all
for (int i = 0; i < WebChart1.Chart.Series.Count; i++)
{
if (WebChart1.Chart.Series[i].CalcYPosValue(0) > WebChart1.Chart.Axes.Top.Position && WebChart1.Chart.Series[i].CalcYPosValue(0) < WebChart1.Chart.Axes.Bottom.Position)
{
Axis customAxis = WebChart1.Chart.Series[i].CustomVertAxis;
g.Pen.Color = Color.Black;
//draw axis for series
g.MoveTo(WebChart1.Chart.Axes.Left.Position, WebChart1.Chart.Series[i].CalcYPosValue(0));
g.LineTo(WebChart1.Chart.Axes.Right.Position, WebChart1.Chart.Series[i].CalcYPosValue(0));
//draw a tick and the maximum value for axis
int yPos = WebChart1.Chart.Series[i].CalcYPosValue(customAxis.Maximum) + 7;
g.MoveTo(WebChart1.Chart.Axes.Right.Position, yPos);
g.LineTo(WebChart1.Chart.Axes.Right.Position + 3, yPos);
g.TextOut(WebChart1.Chart.Axes.Right.Position + 10, yPos - 8, Convert.ToString(customAxis.Maximum));
//draw a tick and the minimum value for axis
yPos = WebChart1.Chart.Series[i].CalcYPosValue(customAxis.Minimum) - 5;
g.MoveTo(WebChart1.Chart.Axes.Right.Position, yPos);
g.LineTo(WebChart1.Chart.Axes.Right.Position + 3, yPos);
g.TextOut(WebChart1.Chart.Axes.Right.Position + 7, yPos - 8, Convert.ToString(customAxis.Minimum));
}
}
WebChart1.Chart.Axes.Left.Position
WebChart1.Chart.Axes.Right.Position
WebChart1.Chart.Axes.Top.Position (which I also need do more custom drawing on the chart)
How do I get the positions of these axes on the screen?
Please help