Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How to databind a Stacked100ColumnSeries with the viewmodel ?
posted

Hello,

I try to implement a XamDataChart with Stacked100ColumnSeries but it seems these components cannot be databind to a collection in the viewmodel !? No problem with a StaticResource but nothing is displayed with a binding to the viewmodel...

Here is the xaml:

<

 

 

ig:XamDataChart Margin="0,10,20,0"
HorizontalZoomable="True"
HorizontalZoombarVisibility="Visible"
Legend="{Binding ElementName=scadaStatusStatisticLegend}" >
<ig:XamDataChart.Axes>
<ig:CategoryXAxis x:Name="scadaStatusStatisticXAxis"
ItemsSource="{Binding ScadaStatusStatisticDataList}"
Label="{}{GroupName}"
Strip="Transparent"
MajorStroke="Transparent" >
<ig:CategoryXAxis.LabelSettings >
<ig:AxisLabelSettings Location="OutsideLeft"
Extent="30" />
</ig:CategoryXAxis.LabelSettings>
</ig:CategoryXAxis>
<ig:NumericYAxis x:Name="scadaStatusStatisticYAxis"
MinimumValue="0">
<ig:NumericYAxis.LabelSettings>
<ig:AxisLabelSettings Location="OutsideLeft"
Extent="50" />
</ig:NumericYAxis.LabelSettings>
</ig:NumericYAxis>
</ig:XamDataChart.Axes>
<ig:XamDataChart.Series>
<ig:Stacked100ColumnSeries ItemsSource="{Binding ScadaStatusStatisticDataList}"
XAxis="{Binding ElementName=scadaStatusStatisticXAxis}"
YAxis="{Binding ElementName=scadaStatusStatisticYAxis}" >
<ig:StackedColumnSeries.Series>
<ig:StackedFragmentSeries ValueMemberPath="Status1"
Title="Operation" />
<ig:StackedFragmentSeries ValueMemberPath="Status2"
Title="Technical Problems" />
<ig:StackedFragmentSeries ValueMemberPath="Status3"
Title="Maintenance" />
</ig:StackedColumnSeries.Series>
</ig:Stacked100ColumnSeries>
</ig:XamDataChart.Series>
</ig:XamDataChart>
<ig:Legend x:Name="scadaStatusStatisticLegend"
Grid.Column="0"
Content="{x:Static res:Labels._LegendTitle}"
ig:XamDock.Edge="OutsideRight"
ig:XamDock.VerticalDockAlignment="Center"
ig:XamDock.HorizontalDockAlignment="Right"
Margin="-5,0,5,0"/>

Here is the viewmodel:

Public

 

 

Sub New()
Dim statisticDataList = New ObservableCollection(Of StatisticData)
statisticDataList.Add(
New StatisticData("01/2010", 80, 10, 5))
statisticDataList.Add(
New StatisticData("02/2010", 10, 20, 2))
ScadaStatusStatisticDataList = statisticDataList
End Sub

 

Private

 

 

_scadaStatusStatisticDataList As ObservableCollection(Of StatisticData)
Public
Property ScadaStatusStatisticDataList() As ObservableCollection(Of StatisticData)
Get
Return _scadaStatusStatisticDataList
End Get
Set(ByVal value As ObservableCollection(Of StatisticData))
_scadaStatusStatisticDataList = value
OnPropertyChanged(ScalarProperty.ScadaStatusStatisticDataList.ToString())
End Set
End Property

And the data class:

Public

 

 

Class StatisticData
Public Property GroupName As String
Public Property Status1 As Double
Public Property Status2 As Double
Public Property Status3 As Double
P
ublic Sub New(ByVal groupName As String, ByVal status1 As Double, ByVal status2 As Double, ByVal status3 As Double)
Me.GroupName = groupName
Me.Status1 = status1
Me.Status2 = status2
Me.Status3 = status3
End Sub
End Class

Thanks for your help,
-olivier-