I am currently building a charting application in Silverlight 4.0, Visual Studio 2010. I currently have some area charts which are working fine, however I am currently trying to convert it to a stacked area chart and the libraries / properties for the stackedarea chart seem very different and it seems impossible to do data-binding to a stackarea chart. It simply does not find the property IndependentValueBinding or DependentValueBin开发者_JAVA技巧ding when using a stackedarea chart, so unless I hard-code in the values it seems there is no way of building this chart. Is there a workaround to this? The issue is highlighted clearer in the XAML below, where the area works fine and the stackedarea does not work at all.
<ch:Chart x:Name="LineChart"
Height="400"
VerticalContentAlignment="Center">
<ch:Chart.Series>
<ch:StackedAreaSeries Margin="0,0,20,20"
Name="LineSeries"
IndependentValueBinding = "{Binding Path=Key}"
DependentValueBinding = "{Binding Path=Value}" />
<ch:AreaSeries Margin="0,0,20,20"
Name="LineSeries2"
IndependentValueBinding = "{Binding Path=Key}"
DependentValueBinding = "{Binding Path=Value}" />
Define a seriesdefintion, which has all of the binding properties. Then add the series def to the stackedarea series.
Something like:
Dim StackedAreaSeries as StackedAreaSeries
Dim SD as Seriesdefintion
SD.independentvaluebinding = ...
. define all series properties
Then
StackedAreaSeries.SeriesDefintions.add(SD)
精彩评论