I ‘m creating a Line chart using WPFToolKit.
The chart comes up fine but i want to change the Maximum property of the Y Axis upon button click of a modal window after loading the chart for the first time. And the chart should be refreshed with the updated Y Axis Max value
Below line shows how Chart is defined in xaml.
<DVC:Chart Canvas.Top="80" Canvas.Left="10" Name="mcChart" VerticalAlignment="Stretch"/>
I’m calling below code in windows.xaml.cs constructor and it is setting Y-Axis Max to 200
mcChart.Axes.Add(new LinearAxis()
{
Minimum = 0,
Maximum = YMax > 0 ? YMax : 200,
Orientation = AxisOrientation.Y,
ShowGridLines = true,
});
mcChart.UpdateLayout();
How can i change the Y-Axis Max value from a modal window’s button click event and refresh chart to display with new YMax.
I’m not sure if i have to do something with RegisteredListeners.
I’m new to WPF and any help is appreciated!
Please note that i’m looking to achieve this from the C# code behind and not in xaml.
Thanks,
Sujay
If you have access to the chart, you can find the neccessary axis and change the
Maximumproperty without updating layout. Here is an example with a linear Y axis:The complete version of this example:
MainWindow.xaml
MainWindow.xaml.cs