Hi Tomas,
Greetings from Syncfusion.
We can able to get visible range using VisibleMinimum and VisibleMaximum properties of Axis, property returns double value present in the range.
As we used DateTimeAxis, we should convert this value to date time by below.
var axis = chart.PrimaryAxis as DateTimeAxis;
viewModel.Label_Min = DateTime.FromOADate(axis.VisibleMinimum);
viewModel.Label_Max = DateTime.FromOADate(axis.VisibleMaximum); |
Using ZoomDelta and Scroll event of chart we can able to update range while zooming and scrolling.
<chart:SfChart x:Name="Chart" ZoomDelta="Chart_ZoomDelta" Scroll="Chart_Scroll">
. . .
</chart:SfChart> |
private void UpdateLabel(SfChart chart)
{
var axis = chart.PrimaryAxis as DateTimeAxis;
viewModel.Label_Min = DateTime.FromOADate(axis.VisibleMinimum);
viewModel.Label_Max = DateTime.FromOADate(axis.VisibleMaximum);
}
private void Chart_ZoomDelta(object sender, ChartZoomDeltaEventArgs e)
{
UpdateLabel(sender as SfChart);
}
private void Chart_Scroll(object sender, ChartScrollEventArgs e)
{
UpdateLabel(sender as SfChart);
} |
We have prepared sample that will be downloaded from below link.
Please let us know if you have any other queries.
Thanks,
Muneesh Kumar G