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

Sharing Vertical Axis in ChartView

2 Answers 58 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 23 Mar 2012, 09:45 PM
I am trying out RadControls for WPF Q1 2012.

When setting up line series for a cartesian chart I set the vertical axis in each series. Some of the series can use the same vertical axis so I assign the same linear axis for the vertical axis in each of those series.
 
Is this the correct way to share a vertical axis between series?

I wonder since if I call Clear() on the chart series after setting things up in this way I get a null reference exception as follows:

System.NullReferenceException was caught
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.Chart
  StackTrace:
       at Telerik.Windows.Controls.ChartView.Axis.OnDetached(RadChartBase oldChart) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\Axis.cs:line 582
       at Telerik.Windows.Controls.ChartView.ChartElementPresenter.Detach() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\ChartElementPresenter.cs:line 93
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnPresenterRemoved(ChartElementPresenter presenter) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 520
       at Telerik.Windows.Controls.ChartView.CartesianSeries.OnDetached(RadChartBase oldChart) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\CartesianChart\Series\CartesianSeries.cs:line 161
       at Telerik.Windows.Controls.ChartView.ChartElementPresenter.Detach() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\ChartElementPresenter.cs:line 93
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnPresenterRemoved(ChartElementPresenter presenter) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 520
       at Telerik.Windows.Controls.ChartView.PresenterCollection`1.ClearItems() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Common\PresenterCollection.cs:line 61
       at XXX.LineChart.SetUpLineChart() in C:\Workspaces\XXX\LineChart.xaml.cs:line 317

The exception doesn't happen if each series has a unique axis.

If this is the correct way of sharing a vertical axis between series then how do I clear the series without getting an exception?

2 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 28 Mar 2012, 11:52 AM
Hi Terry,

You've encountered an issue present in the 2012.1.215 version, which has already been fixed. Please, download our 2012 Q1 Service Pack 1, released earlier this week, and give it a try - the chart should behave as expected in the described scenario.

About sharing an axis in WPF please check our help topic on multiple axis here in our online help system.

Regards,
Yavor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Terry
Top achievements
Rank 1
answered on 28 Mar 2012, 03:04 PM
Thanks, the service pack fixed the issue.

Terry
Tags
ChartView
Asked by
Terry
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Terry
Top achievements
Rank 1
Share this question
or