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? 


  2. Petar Kirov
    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:CartesianChartGrid MajorLinesVisibility="XY"/>
            <telerik:LinearAxis x:Name="horizontalAxis"/>
            <telerik:LinearAxis x:Name="verticalAxis"/>
                    <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:CartesianGridLineAnnotation Value="0"
                   Axis="{Binding ElementName=verticalAxis}" />
            <telerik:CartesianGridLineAnnotation Value="0"
                   Axis="{Binding ElementName=horizontalAxis}" />
    (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.

    Petar Kirov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top