crash ActualDependentRangeAxis is null

Sep 28, 2012 at 12:58 PM

Hi, 

  in my project I made an user control with a chart.

When I add an keypair

_data.Add(new KeyValuePair<int, int>(1,30))

 value on the itemsources the chart component crashes at the line

double PlotAreaHeight = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value;

with a null pointer exception ActualDependentRangeAxis is null!!!

 

How can create the axis and avoid the crash?

 


  <chartingToolkit:Chart
            x:Name="Chart1"
            VerticalAlignment="Stretch"             
            HorizontalAlignment="Stretch" 
            Margin="5,0,0,0"            
            Title="{Binding Path=Title}"
            LegendTitle="{Binding   Path=LegendTitle}">
                <chartingToolkit:ScatterSeries
                x:Name="XScatterSeries"
                 DataContext="{Binding}"
                DependentValueBinding="{Binding Path=Value}"                 
                IndependentValueBinding="{Binding Path=Key}" 
                ItemsSource="{Binding Path=data}" />
</chartingToolkit:Chart>

 

 

Oct 1, 2012 at 9:47 AM

I found a workaround: on the control set the language to "en-US".

<chart:Chart xml:lang="en-US">

...