This question is locked. New answers and comments are not allowed.
Hi,
Could somebody help me with calculation of the MajorStep and chart zoom? I have the following XAML layout
<chart:RadCartesianChart Grid.Row="0" Zoom="{Binding ChartZoom}" SizeChanged="Chart_SizeChanged">
<chart:RadCartesianChart.Behaviors>
<chart:ChartPanAndZoomBehavior ZoomMode="None" PanMode="Horizontal" />
</chart:RadCartesianChart.Behaviors>
<chart:RadCartesianChart.HorizontalAxis>
<chart:DateTimeContinuousAxis FontSize="{StaticResource SubTinyFontSize}" LabelFitMode="Rotate" LabelRotationAngle="-60" MajorStepUnit="Minute" MajorStep="{Binding MajorDateTimeStep}" LabelFormat="MMM dd HH:mm" />
</chart:RadCartesianChart.HorizontalAxis>
<chart:RadCartesianChart.VerticalAxis>
<chart:LinearAxis FontSize="{StaticResource TinyFontSize}" Minimum="0" Maximum="{Binding PaddedMaxDisplayValue}" MajorStep="{Binding MajorDisplayValueStep}" LabelFormat="0.0" Title="minutes" />
</chart:RadCartesianChart.VerticalAxis>
<chart:RadCartesianChart.Grid>
<chart:CartesianChartGrid MajorLinesVisibility="Y" MajorYLineDashArray="6,6" />
</chart:RadCartesianChart.Grid>
<chart:RadCartesianChart.Series>
<chart:BarSeries ItemsSource="{Binding ChartItemList}" CategoryBinding="DisplayStarted" ValueBinding="DisplayValue">
<chart:BarSeries.PointTemplate>
<DataTemplate>
<Rectangle Fill="{Binding DataItem.Brush}"/>
</DataTemplate>
</chart:BarSeries.PointTemplate>
</chart:BarSeries>
</chart:RadCartesianChart.Series>
</chart:RadCartesianChart>
My data is visualized as a series of bars. The DateTime horizontal axis is 120 days (120.00:17:12.3100000) so far but can be a number of years. What I'm trying to do is to calculate a good MajorStep value so that all bars look good, no major overlaps, no too huge gaps in between. For 120 days my calculation gives me 2887 minutes for the MajorStep and horizontal zoom 6.08. Thus, I basically expect to see horizontal ticks every 2887 / 60 = 48.11 hours (or almost 2 days), however the ticks are rendered with an interval of approximately 1 day.
I run a number of tests and just for the sake of a test set extreme numbers to the MajorStep like 46000 which resulted in a correct tick step of approximately 32 days if I don't zoom but if I zoom 12 the ticks are rendered approximately every 2 days which actually looks like 32 /12 = 2 2 in other words zoom affected the MajorStep but it didn't work in other test.
I'm completely lost. What and how I have to setup on the axis so that the tick interval is 2887 minutes (about 2 days) when the chart is zoomed 6 times.
Thank you,
Alex
Could somebody help me with calculation of the MajorStep and chart zoom? I have the following XAML layout
<chart:RadCartesianChart Grid.Row="0" Zoom="{Binding ChartZoom}" SizeChanged="Chart_SizeChanged">
<chart:RadCartesianChart.Behaviors>
<chart:ChartPanAndZoomBehavior ZoomMode="None" PanMode="Horizontal" />
</chart:RadCartesianChart.Behaviors>
<chart:RadCartesianChart.HorizontalAxis>
<chart:DateTimeContinuousAxis FontSize="{StaticResource SubTinyFontSize}" LabelFitMode="Rotate" LabelRotationAngle="-60" MajorStepUnit="Minute" MajorStep="{Binding MajorDateTimeStep}" LabelFormat="MMM dd HH:mm" />
</chart:RadCartesianChart.HorizontalAxis>
<chart:RadCartesianChart.VerticalAxis>
<chart:LinearAxis FontSize="{StaticResource TinyFontSize}" Minimum="0" Maximum="{Binding PaddedMaxDisplayValue}" MajorStep="{Binding MajorDisplayValueStep}" LabelFormat="0.0" Title="minutes" />
</chart:RadCartesianChart.VerticalAxis>
<chart:RadCartesianChart.Grid>
<chart:CartesianChartGrid MajorLinesVisibility="Y" MajorYLineDashArray="6,6" />
</chart:RadCartesianChart.Grid>
<chart:RadCartesianChart.Series>
<chart:BarSeries ItemsSource="{Binding ChartItemList}" CategoryBinding="DisplayStarted" ValueBinding="DisplayValue">
<chart:BarSeries.PointTemplate>
<DataTemplate>
<Rectangle Fill="{Binding DataItem.Brush}"/>
</DataTemplate>
</chart:BarSeries.PointTemplate>
</chart:BarSeries>
</chart:RadCartesianChart.Series>
</chart:RadCartesianChart>
My data is visualized as a series of bars. The DateTime horizontal axis is 120 days (120.00:17:12.3100000) so far but can be a number of years. What I'm trying to do is to calculate a good MajorStep value so that all bars look good, no major overlaps, no too huge gaps in between. For 120 days my calculation gives me 2887 minutes for the MajorStep and horizontal zoom 6.08. Thus, I basically expect to see horizontal ticks every 2887 / 60 = 48.11 hours (or almost 2 days), however the ticks are rendered with an interval of approximately 1 day.
I run a number of tests and just for the sake of a test set extreme numbers to the MajorStep like 46000 which resulted in a correct tick step of approximately 32 days if I don't zoom but if I zoom 12 the ticks are rendered approximately every 2 days which actually looks like 32 /12 = 2 2 in other words zoom affected the MajorStep but it didn't work in other test.
I'm completely lost. What and how I have to setup on the axis so that the tick interval is 2887 minutes (about 2 days) when the chart is zoomed 6 times.
Thank you,
Alex