RadCartesianChart - Lines outside the chart

2 posts, 0 answers
  1. Olivier
    Olivier avatar
    1 posts
    Member since:
    Aug 2017

    Posted 17 Aug Link to this post

    We are trying to plot a simple chart with a Y axis that goes from -5 to 5. The lines are drawn outside of the chart. See image in attachement.

    Here is the code : 

               <telerikChart:RadCartesianChart Height="300" Margin="0,16,0,0">
                  <telerikChart:RadCartesianChart.HorizontalAxis>
                    <telerikChart:CategoricalAxis ShowLabels="False"/>
                  </telerikChart:RadCartesianChart.HorizontalAxis>
                  <telerikChart:RadCartesianChart.VerticalAxis>
                    <telerikChart:LinearAxis x:Uid="TtsCalibrationChartVerticalAxis" Minimum="-5" Maximum="5"/>
                  </telerikChart:RadCartesianChart.VerticalAxis>
                  <telerikChart:LineSeries x:Name="Chart" ItemsSource="{x:Bind ViewModel.LaserThicknessesSampled, Mode=OneWay}" />
                </telerikChart:RadCartesianChart>

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    419 posts

    Posted 21 Aug Link to this post

    Hello Olivier,

    The series can only render data points within the cartesian plot area. If you need to show those points, you'll want to remove the Minimum restriction on the vertical axis so that it is allowed to automatically account for data points.

    For example, using your code, this would make your chart work automatically for all your data:

    <telerikChart:RadCartesianChart Height="300" Margin="0,16,0,0">
        <telerikChart:RadCartesianChart.HorizontalAxis>
            <telerikChart:CategoricalAxis ShowLabels="False"/>
        </telerikChart:RadCartesianChart.HorizontalAxis>
     
        <telerikChart:RadCartesianChart.VerticalAxis>
            <telerikChart:LinearAxis x:Uid="TtsCalibrationChartVerticalAxis" />
        </telerikChart:RadCartesianChart.VerticalAxis>
     
        <telerikChart:LineSeries x:Name="Chart"
                    ItemsSource="{x:Bind ViewModel.LaserThicknessesSampled, Mode=OneWay}" />
    </telerikChart:RadCartesianChart>

    This will allow the Chart to determine the highest/lowest values and properly set the LinearAxis Minimum and Maximum appropriately.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top