Stacked Bar Chart Example
#1
Posted 17 May 2010 - 04:50 PM
I am trying to build a stacked bar chart using data from a Sharepoint list, I have previously built stacked charts using the excellent example on Planet Parker's blog at http://planetparker....ackedChart.aspx however this list is different to that example as the data in this situation is not conveniently spread across separate columns.
My list consists of two columns; "Council Directorate" and "Theme", each value in each column occurs multiple times throughout the list, e.g:
Council Directorate, Theme
-------------------, --------------------
Chief Executive, Greener
Adults Services, Happier
Chief Executive, Healthier
Chief Executive, Greener
.. ..
Can someone please tell me how I can display this information in a stacked bar chart - I know I need to summarise the rows somehow but I'm new to dataviews (and SharePoint Designer!)
cheers
#2
Posted 18 May 2010 - 05:35 AM
In the above list, I didn't find any value/number. If you want to display a StackedColumn chart what will be the height of each stacked column?Council Directorate, Theme
-------------------, --------------------
Chief Executive, Greener
Adults Services, Happier
Chief Executive, Healthier
Chief Executive, Greener
Now, if you think all values are constant (YValue=10) for all DataPoint. So you can display the information in Chart like below.

Chart data XAML for the above chart
<vc:Chart Theme="Theme1" x:Name="MyChart" Width="500" Height="300" xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts">
<vc:Chart.Series>
<vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" LabelEnabled="true" ShadowEnabled="true" >
<vc:DataSeries.DataPoints>
<vc:DataPoint AxisXLabel="Chief Executive" LabelText="Greener" ToolTipText="Chief Executive, Greener" YValue="10"/>
<vc:DataPoint AxisXLabel="Adults Services" LabelText="Happier" ToolTipText="Adults Services, Happier" YValue="10"/>
</vc:DataSeries.DataPoints>
</vc:DataSeries>
<vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" ShadowEnabled="true" LabelEnabled="true">
<vc:DataSeries.DataPoints>
<vc:DataPoint AxisXLabel="Chief Executive" LabelText="Healthier" ToolTipText="Chief Executive, Healthier" YValue="10"/>
</vc:DataSeries.DataPoints>
</vc:DataSeries>
<vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" ShadowEnabled="true" LabelEnabled="true">
<vc:DataSeries.DataPoints>
<vc:DataPoint AxisXLabel="Chief Executive" LabelText="Greener" ToolTipText="Chief Executive, Greener" YValue="10"/>
</vc:DataSeries.DataPoints>
</vc:DataSeries>
</vc:Chart.Series>
</vc:Chart>
Eva
#3
Posted 18 May 2010 - 07:19 AM
Hi Bob,
In the above list, I didn't find any value/number. If you want to display a StackedColumn chart what will be the height of each stacked column?
Now, if you think all values are constant (YValue=10) for all DataPoint. So you can display the information in Chart like below.
Chart data XAML for the above chart<vc:Chart Theme="Theme1" x:Name="MyChart" Width="500" Height="300" xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts"> <vc:Chart.Series> <vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" LabelEnabled="true" ShadowEnabled="true" > <vc:DataSeries.DataPoints> <vc:DataPoint AxisXLabel="Chief Executive" LabelText="Greener" ToolTipText="Chief Executive, Greener" YValue="10"/> <vc:DataPoint AxisXLabel="Adults Services" LabelText="Happier" ToolTipText="Adults Services, Happier" YValue="10"/> </vc:DataSeries.DataPoints> </vc:DataSeries> <vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" ShadowEnabled="true" LabelEnabled="true"> <vc:DataSeries.DataPoints> <vc:DataPoint AxisXLabel="Chief Executive" LabelText="Healthier" ToolTipText="Chief Executive, Healthier" YValue="10"/> </vc:DataSeries.DataPoints> </vc:DataSeries> <vc:DataSeries ShowInLegend="false" RenderAs="StackedColumn" ShadowEnabled="true" LabelEnabled="true"> <vc:DataSeries.DataPoints> <vc:DataPoint AxisXLabel="Chief Executive" LabelText="Greener" ToolTipText="Chief Executive, Greener" YValue="10"/> </vc:DataSeries.DataPoints> </vc:DataSeries> </vc:Chart.Series> </vc:Chart>
Sorry I wasn't making myself clear - the reason there are no values is because I want the values to be a count of the number of occurences of "green", "healthier" etc for each council directorate.
Maybe the problem I have is that I need to manipulate the list first? If so, can you provide any tips?
thanks
#4
Posted 19 May 2010 - 07:56 AM
Maybe the problem I have is that I need to manipulate the list first? If so, can you provide any tips?
You can take help of LINQ to extract/generate a new list from your existing list. The following links will be helpful for you.
http://sharepointsolutions.blogspot.com/2006/10/using-linq-with-sharepoint-list-data.html
http://fabiangwilliams.wordpress.com/tag/linq-to-sharepoint/
http://www.sharepoint-tips.com/2007/06/using-javascript-to-manipulate-list.html
Eva
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users










