RadCartesianChart Negative Values (PlotAreaAxisVisibility?)

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    37 posts
    Member since:
    Dec 2012

    Posted 27 Mar 2013 Link to this post

    I am using RadCartesianChart to create a scatter chart showing both positive and negative values. Is there a way to display a line at 0 in each axis as is shown in this documentation for RadChart: http://www.telerik.com/help/wpf/radchart-features-negative-values.html

    It appears to be controlled using the PlotAreaAxisVisibility but I can't find a way to gain access to the ChartArea when using a RadCartesianChart.

    Any suggestions? 

    Thanks,

    Andy. 
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 01 Apr 2013 Link to this post

    Hi Andy,

    The RadChartView  was built from the ground-up and has different architecture than RadChart. It is not a monolithic control containing ChartArea, ChartTitle and ChartLegend. Instead now there are separate Rad* controls each specializing in a specific area (RadCartesianChart, RadPolarChart, RadPieChart and RadLegend). This means that you will need to use different approach to achieve certain tasks.

    To fulfil your requirement you can use two grid line annotations - one for the X axis and one for the Y axis respectively. Here is an example: 
    <telerik:RadCartesianChart>
        <telerik:RadCartesianChart.Grid>
            <telerik:CartesianChartGrid MajorLinesVisibility="XY"/>
        </telerik:RadCartesianChart.Grid>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:LinearAxis x:Name="horizontalAxis"/>
        </telerik:RadCartesianChart.HorizontalAxis>
     
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis x:Name="verticalAxis"/>
        </telerik:RadCartesianChart.VerticalAxis>
     
        <telerik:RadCartesianChart.Series>
            <telerik:ScatterPointSeries>
                <telerik:ScatterPointSeries.DataPoints>
                    <telerik:ScatterDataPoint XValue="-10.5" YValue="-15"/>
                    <telerik:ScatterDataPoint XValue="12" YValue="-15"/>
                    <telerik:ScatterDataPoint XValue="-10.5" YValue="3"/>
                    <telerik:ScatterDataPoint XValue="10.5" YValue="15"/>
                </telerik:ScatterPointSeries.DataPoints>
            </telerik:ScatterPointSeries>
        </telerik:RadCartesianChart.Series>
     
        <telerik:RadCartesianChart.Annotations>
            <telerik:CartesianGridLineAnnotation Value="0"
                   Axis="{Binding ElementName=verticalAxis}" />
            <telerik:CartesianGridLineAnnotation Value="0"
                   Axis="{Binding ElementName=horizontalAxis}" />
        </telerik:RadCartesianChart.Annotations>
     
    </telerik:RadCartesianChart>
    (You can see the result in the attached screenshot.)

    For more information on how annotations are used in RadChartView, you can check this help topic.

    I hope this helps.

    Regards,
    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top