Sharing Vertical Axis in ChartView

3 posts, 0 answers
  1. Terry
    Terry avatar
    13 posts
    Member since:
    Nov 2010

    Posted 23 Mar 2012 Link to this post

    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. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 28 Mar 2012 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Terry
    Terry avatar
    13 posts
    Member since:
    Nov 2010

    Posted 28 Mar 2012 Link to this post

    Thanks, the service pack fixed the issue.

    Terry
Back to Top