views:

93

answers:

2

Hi,

I want to control the x and y axis of a multi series line charts available in Silverlight toolkit from the C# code. I am not able to find any appropriate example using google. Any kind of example or pointers would be appreciated!

EDIT:

This is what I have done so far:

<toolkit:Chart Canvas.Left="104" Canvas.Top="18" Name="chartCompare" Title="Compare Series" Height="285" Width="892">
<toolkit:LineSeries
         Title="SP1"
         Name="Series1"/>
</toolkit:Chart>

And in the code behind I am trying this:

Series1.ItemsSource = ObjectList;

Series1.IndependentValuePath = "Val1";
Series1.DependentValuePath = "Val2";

Where ObjectList is a List of Objects which has val1 and val2 as its property. But it is throwing an error when I run this in Line "Series1.ItemsSource = ObjectList;" saying "Object reference not set to an instance of an object..". I have initialised and set its value just in the line before it. Actually I have set this as an item source for a data grid in the line before it and it works fine.

A: 

I need to add this before using the Series1:

//Line to be inserted
LineSeries Series1 = chart.Series[0] as LineSeries;

Series1.IndependentValuePath = "Val1";
Series1.DependentValuePath = "Val2";
Series1.ItemsSource = ObjectList;

Thanks...

Manoj
A: 

I have same problem, i get the null object reference error too. The Key/Value names are in the proper format. With .Net 3.5 client profile it was working without a problem, with .NET 4.0 client profile it is throwing the null pointer error. Any solution? I am not sure if this is chart bug or "feature"

kimicz