This is a migrated thread and some comments may be shown as answers.

Setting up a Stacked Bar with nested collections

1 Answer 27 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 06 Jan 2012, 04:15 PM
Hi,

I don't understand how to set up a stacked bar.
I need a QueryableCollectionView that contains a list of months with nested lists of department values.

Public Class MonthDepartmentList
    Public Property Month As String
    Public DepartmentValueList As List(Of DepartmentValue)
 
    Sub New(_month As String, _departmentValueList As List(Of DepartmentValue))
        Month = _month
        DepartmentValueList = _departmentValueList
    End Sub
End Class
 
Public Class DepartmentValue
    Public Property Department As String
    Public Property Value As Decimal
 
    Sub New(_department As String, _value As Decimal)
        Department = _department
        Value = _value
    End Sub
End Class

I created a list with some example values:

Dim departmentValueMarch1 As New DepartmentValue("North", 10D)
Dim departmentValueMarch2 As New DepartmentValue("West", 10D)
Dim departmentValueMarch3 As New DepartmentValue("South", 10D)
Dim departmentValuesMarch As New List(Of DepartmentValue)
departmentValuesMarch.Add(departmentValueMarch1)
departmentValuesMarch.Add(departmentValueMarch2)
departmentValuesMarch.Add(departmentValueMarch3)
Dim marchDepartmentList As New MonthDepartmentList("032011", departmentValuesMarch)
 
Dim departmentValueApril1 As New DepartmentValue("North", 10D)
Dim departmentValueApril2 As New DepartmentValue("West", 11D)
Dim departmentValueApril3 As New DepartmentValue("South", 8D)
Dim departmentValuesApril As New List(Of DepartmentValue)
departmentValuesApril.Add(departmentValueApril1)
departmentValuesApril.Add(departmentValueApril2)
departmentValuesApril.Add(departmentValueApril3)
Dim aprilDepartmentList As New MonthDepartmentList("042011", departmentValuesApril)
 
Dim yearDepartmentValues As New List(Of MonthDepartmentList)
yearDepartmentValues.Add(marchDepartmentList)
yearDepartmentValues.Add(aprilDepartmentList)
 
YearData = New QueryableCollectionView(yearDepartmentValues)

YearData is bound to RadCharts ItemSource.

How do I get the look of my attached example?
I have no idea how to set up the SeriesMapping, ItemMapping, YValue, XCategory, CollectionIndex etc
Do I have to change my classes to make this possible?

Thanks, 

Danny

1 Answer, 1 is accepted

Sort by
0
Danny
Top achievements
Rank 1
answered on 10 Jan 2012, 09:17 AM
I've changed my classes and now it works.
Tags
Chart
Asked by
Danny
Top achievements
Rank 1
Answers by
Danny
Top achievements
Rank 1
Share this question
or