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

RadChart Scale Series

1 Answer 52 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 2
Robert asked on 19 Apr 2013, 12:51 AM
Is it possible to scale a chart series by setting a max and min value? I have a RadCartesianChart with X = weight and Y = date values. The weight goes from 0 to 140 but most of my values are all within 120 - 140 range. If I could set the max and min weight values to plus 10% and minus 10% the chart would have more detail. Here is my code
 
<telerikChart:RadCartesianChart.VerticalAxis>
                  <telerikChart:LinearAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="2"/>
              </telerikChart:RadCartesianChart.VerticalAxis>
              <telerikChart:RadCartesianChart.HorizontalAxis>
                  <telerikChart:DateTimeCategoricalAxis LabelFitMode="Rotate" DateTimeComponent="Date" LabelFormat="M-yy" ></telerikChart:DateTimeCategoricalAxis>
              </telerikChart:RadCartesianChart.HorizontalAxis>
              <telerikChart:LineSeries x:Name="lines" Stroke="{StaticResource PhoneAccentBrush}" CategoryBinding="WeighDate" ValueBinding="WeighAmount">
              </telerikChart:LineSeries>

See attached example to see how the chart has little detail because of the scaling.

I attempted to set the min and max values from my data but the code failed, object null:

double myMin = myWs.Min(minW => minW.WeighAmount);
            double myMax = myWs.Max(maxW => maxW.WeighAmount);
            xCartesionChart.Series[0].ItemsSource = myWsSorted;
            lines.MaxHeight = myMax;
           lines.MinHeight = myMin;

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 Apr 2013, 08:35 AM
Hi Robery,

Yes of course. You just need to set the Minimum and Maximum properties of your LinearAxis. It should look like this for example:

<telerikChart:LinearAxis LineStroke="{StaticResource PhoneDisabledBrush}" LineThickness="2"
                         Minimum="110"
                         Maximum="150"/>
The MinHeight and MaxHeight are different, you almost never need to set those manually.

Greetings,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart
Asked by
Robert
Top achievements
Rank 2
Answers by
Victor
Telerik team
Share this question
or