Group: Forum Members
Last Active: 9 Years Ago
Posts: 19,
Visits: 2
|
hi,
I'm trying to set custom axis min\max values, that i calculate based on the current min\max values of my cartesian chart.
I've come to realize that the scale's min\max values do not update, only until after the chart is painted, so I created a PaintCallback class that I use to recalculate the min\max values' and use them by creating a new RangeView for the axis.
The problem is that when I set the new min\max values to the chart in the paint callback class (doesn't matter if I do it on Before\After paint) the axis range doesn't update, but only after about a second or so.
here is a general example of what i'm doing (cant post the real code here):
class MyForm : Form { public MyForm() { InitializeComponents();
NCartesianChart chart = new NCartesianChart();
// ... // Add the chart to the NChartControl // ... // Create series for chart // ... // bind chart to datatable // ...
chart.PaintCallback = new MyPaintCallback(); }
// ... // Other Methods // ... }
class MyPaintCallback : NPaintCallback { public override void OnBeforePaint(NPanel panel, NPanelPaintEventArgs eventArgs) { double min = chart.Axis(StandardAxis.PrimaryY).SeriesRange.Begin - 20; double max = chart.Axis(StandardAxis.PrimaryY).SeriesRange.End + 50; chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(new NRange1DD(min, max), true, true); } }
Can i make the axis refresh its range after i change it? Or perhaps i need change the min\max values in some other way?
|