c# - MS Charts: Getting the real InnerPlotPosition? -
When creating a chart using Microsoft charts, I need to get the correct position of the grid on the chart.
- As I think - it can be obtained by the interpretation, however, when using this property, I get the following rectangle:
It looks rectangular to scale with chart size; When the size of the chart changes, the rectangle decreases, but still remains outside the grid on all the edges. I have tried to add and multiply the size with a constant, but there is no single stable work for all sizes.
So, just to make it clear, what I want is the outer black rectangle on the grid Is there any way to do this?
(I was thinking of scanning pixels from the edges, and was detecting the first black pixel in every direction, but this disturbance looks like a hack.)
I finally found a solution that works:
chartAre = chart.ChartAreas [0 ]; Double X1 = a.AxisX.ValueToPixelPosition (a.AxisX.Minimum); Double X2 = a.AxisX.ValueToPixelPosition (a.AxisX.Maximum); Double y1 = a.AxisY.ValueToPixelPosition (a.AxisY.Maximum); Double y2 = a.AxisY.ValueToPixelPosition (a.AxisY.Minimum);
Comments
Post a Comment