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

RadCartesianChart Negative Values (PlotAreaAxisVisibility?)

1 Answer 143 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 27 Mar 2013, 05:12 PM
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. 

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 01 Apr 2013, 09:42 AM
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.

Tags
ChartView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or