Sum columns of certain rows of a sharepoint list and plot it to a Visifire Chart

Posted on 2010-09-01
Medium Priority
Last Modified: 2013-11-25
Hi Experts!

I have a SharePoint list that contains (among other columns) a "Status" and "Discrepancy Value". Both are calculated columns. Example of the data is:

 sample data
I would like to plot a graph that will sum the "Discrepancy Value" column for each type of "Status". An example of the graph would be:

 Graph for sample data
I use Visifire graphs and SharePoint designer to usually plot graphs. Can you guys please assist?

Question by:k_harpaul
  • 5
LVL 16

Expert Comment

ID: 33579064
What is the exact issue you are having? If you are having an issue with Visifire, I would suggest you contact them.

Author Comment

ID: 33580134

No issue with Visifire. I would like to know how to do it because there is no clear option for it. It must be coded and i'm not sure how to do it.

LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33661132
Just to have a better understanding of the question what you need is just plot a graph using the data you have retrieved from Share point ?
Is it necessary that you need the graph in Visfire ?
I don't have much exp in MOSS and wont be able to help you in retrieving the data from there to SL but can help you with creating the graph in Silver light if you can get the data from MOSS
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33661374
Also based on the assumption that we we not using Visfire  and you already have the data from Share point

data classes
public class SharepointData
        public static ObservableCollection<Trans> GetData()
            ObservableCollection<Trans> sales = new ObservableCollection<Trans>();

            sales.Add(new Trans() { DiscrepencyValue = 100, Status = "Completed" });
            sales.Add(new Trans() { DiscrepencyValue = 73, Status = "Waiting" });
            sales.Add(new Trans() { DiscrepencyValue = 12, Status = "Completed" });
            sales.Add(new Trans() { DiscrepencyValue = 24, Status = "OutStanding" });
            sales.Add(new Trans() { DiscrepencyValue = 22, Status = "Waiting" });
            sales.Add(new Trans() { DiscrepencyValue = 67, Status = "Waiting" });
            sales.Add(new Trans() { DiscrepencyValue = 9, Status = "OutStanding" });
            sales.Add(new Trans() { DiscrepencyValue = 59, Status = "Completed" });

            return sales;

    public class Trans
        public string Status { get; set; }
        public int DiscrepencyValue { get; set; }

Open in new window

LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33661377
public partial class Chart : UserControl
        ObservableCollection<Trans> TransData;
        public Chart()

            TransData = FormatData(SharepointData.GetData());
            this.Loaded += new RoutedEventHandler(Chart_Loaded);

        void Chart_Loaded(object sender, RoutedEventArgs e)
            ((ColumnSeries)this.ChartControl.Series[0]).ItemsSource = TransData;

        public ObservableCollection<Trans> FormatData(ObservableCollection<Trans> transData)
            var grouped = transData.GroupBy<Trans, string>(new Func<Trans, string>(
                (value) =>
                    return value.Status;
            ObservableCollection<Trans> trans = new ObservableCollection<Trans>();
            foreach (var item in grouped)
                trans.Add(new Trans { DiscrepencyValue = (int)item.Sum(new Func<Trans,decimal>((c)=>(decimal)c.DiscrepencyValue)) , Status = item.Key });
            return trans;

Open in new window

LVL 29

Accepted Solution

Gautham Janardhan earned 2000 total points
ID: 33661384
<UserControl x:Class="TestComponentArtCombo.Chart" 
    <Grid x:Name="LayoutRoot" 
        <TextBlock Text="test"/>
        <DVC:Chart x:Name="ChartControl" Width="400" Height="250"
           Background="AliceBlue" >
                <DVC:ColumnSeries Title="Disc value"
                                  IndependentValueBinding="{Binding Status}"
                            DependentValueBinding="{Binding DiscrepencyValue}">

Open in new window

LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33661393
Also the charting is done using Silverlight tool kit  which you can download from http://silverlight.codeplex.com/
Once you have downloaded this you need add references to the ToolKit dll to your project.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question