Hi Rolf,
The chart calculates the min and max values before it is rendered. The NAxis.SeriesRange property gives access to the calculated min and max for all series that are scaled on a given axis. You can use this property either in the OnBeforePaing method of the chart paint callback (1), or after you explicitly invoke chart calculation (2):
(1)
chart.PaintCallback = paintCallback;
public class MyPaintCallback : INPaintCallback
{
public void OnBeforePaint(NPanel panel, NPanelPaintEventArgs eventArgs)
{
NChart chart = nChartControl1.Charts[0];
NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
NRange1DD range = axisY.SeriesRange;
}
...
}
(2)
nChartControl1.Document.Calculate();
nChartControl1.Document.RecalcLayout(nChartControl1.View.Context);
NAxis axisY = chart.Axis(StandardAxis.PrimaryY);
NRange1DD range = axisY.SeriesRange;
You can also calculate the min max values manually from the series data, there is no need to execute db queries again.
I hope this helps,
Best Regards,
Milen