Programmatically controlling Chart in Silverlight toolkit
Posted
by Manoj
on Stack Overflow
See other posts from Stack Overflow
or by Manoj
Published on 2010-04-21T10:54:20Z
Indexed on
2010/04/23
6:53 UTC
Read the original article
Hit count: 830
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.
© Stack Overflow or respective owner