This is a migrated thread and some comments may be shown as answers.

Graph Y-axis scaling not correct

1 Answer 38 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Shivam asked on 14 Nov 2011, 07:36 AM
With reference to your example:

I have made a similar chart in my application which accepts unsampled data and also the number for data points returned from database query are uncertain (varies between 10-5000).

The Issue here is If the Y-Value from my returned Collection from DB is greater than 1000 and the value is not changing much over time the labels on the Y-axis all display the same value.
e.g My Database returns 1000 data points all having y-value :1800 and different x values(Timestamps).
All The y-axis labels shows the same value i.e. its not at all scaled and also the graph should show a single straight line as all the y values are 1800 but It looks something Like:

The requirement is for these type of situation the scale should start from a lower value say 1500 and end ata a higher value e.g 2000.
as It behave in Data points lesser than 1000:

my Code:


<telerikChart:RadChart  Margin="0 2 0 2" Grid.Row="2" x:Name="RadChart" ItemsSource="{Binding ChartsCollection}" UseDefaultLayout="False" BorderBrush="Transparent" >
                        <RowDefinition Height="Auto"/>
                        <RowDefinition />
                        <RowDefinition Height="Auto"/>
                        <ColumnDefinition />
                    <telerikCharting:ChartArea Grid.Row="0" Grid.RowSpan="2"  Margin="0 0 5 0"
                                       Padding="5,10,20,10" NoDataControlStyle="{StaticResource NoDataControlStyle}" NoDataString="{Binding NoDataString}" Background="White" >
                            <telerikCharting:ZoomScrollSettings ScrollMode="ScrollAndZoom" MinZoomRange="0.005"/>
                            <telerikCharting:AxisY AutoRange="True"/>
                            <telerikCharting:AxisX DefaultLabelFormat="MM-dd-yy&#x0a;H:mm:ss" LabelRotationAngle="0" />

                    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,10,15,5">
                        <telerik:RadButton Command="{Binding ZoomInCommand}" Margin="5,0" Content="+" Width="20" FontWeight="Bold"/>
                        <telerik:RadButton Command="{Binding ZoomOutCommand}" Margin="5,0" Content="-" Width="20" FontWeight="Bold"/>

                    <telerikCharting:ChartSortDescriptor Member="XBinding" SortDirection="Ascending" />
                    <telerikCharting:SamplingSettings SamplingThreshold="400" SamplingFunction="Average" />
                    <telerikCharting:SeriesMapping  ChartAreaName="chartArea1">
                            <telerikCharting:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" >
                                    <telerikCharting:SeriesAppearanceSettings Stroke="RoyalBlue"/>

                            <telerikCharting:ItemMapping FieldName="XBinding" DataPointMember="XValue" />
                            <telerikCharting:ItemMapping FieldName="YBinding" DataPointMember="YValue" />


There is One More Issue: Sometimes if I Zoom In Lot of time Everything Disappear from My Graph.

Please Help me solve these issue and also Note that here I am using Strict MVVM approach.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 16 Nov 2011, 09:44 AM
Hello Shivam,

The Y-axis has multiple identically looking labels because of the ChartArea's LabelFormatBehavior, which by default is set to 'HumanReadable' and is applied for values higher than 1 000 for a better readability. Obviously it is not as accurate in scenarios like this one, as you would have the labels being , for example, 1 801, 1 802, 1 803, etc, with the Line having a values of 1 801, 1 803 and so on, however, all of the labels would be denoted as '1.8 K' by the default label format behavior.

In case you need more accuracy you may simply set the LabelFormatBehavior to None :
RadChart1.DefaultView.ChartArea.LabelFormatBehavior = LabelFormatBehavior.None;
<telerikCharting:ChartArea LabelFormatBehavior="None">

You can find more information on the topic in this help topic.

Another possibility would be to set a manual range runtime by subscribing to an event in case you can define the point at which you would need the custom Y axis range to be set and when to have the chart auto range.

Hope this helps.

Best wishes,
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question