Jump to content

 

Photo
- - - - -

Stacked Bar Chart Example


  • Please log in to reply
4 replies to this topic

#1 bob_bulman

bob_bulman

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 17 May 2010 - 04:50 PM

Hi,

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 Eva

Eva

    Advanced Member

  • Members
  • PipPipPip
  • 365 posts
  • Gender:Female

Posted 18 May 2010 - 05:35 AM

Hi Bob,

Council Directorate, Theme
-------------------, --------------------
Chief Executive, Greener
Adults Services, Happier
Chief Executive, Healthier
Chief Executive, Greener

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.

Posted Image

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>

Regards,
Eva

#3 bob_bulman

bob_bulman

    Newbie

  • Members
  • Pip
  • 2 posts

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.

Posted Image

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 Eva

Eva

    Advanced Member

  • Members
  • PipPipPip
  • 365 posts
  • Gender:Female

Posted 19 May 2010 - 07:56 AM

Hi Bob,

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

Posted Image
Regards,
Eva

#5 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 03 November 2011 - 12:13 PM

Hi Bob,

VfS (Visifire for SharePoint 2007 & 2010) has been released. Please check the blog post here for more info.

Regards,
Shoaib




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users