Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2010-09-01
10
684 Views
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?

Regards,
Kritesh.
0
Comment
Question by:k_harpaul
  • 5
10 Comments
 
LVL 16

Expert Comment

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

Author Comment

by:k_harpaul
ID: 33580134
Hi.

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.

Regards,
Kritesh
0
 
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
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33661377
xaml.cs
public partial class Chart : UserControl
    {
        ObservableCollection<Trans> TransData;
        public Chart()
        {
            InitializeComponent();

            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

0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 33661384
xaml
<UserControl x:Class="TestComponentArtCombo.Chart" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" 
          xmlns:DV="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
 xmlns:DVC="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
 >
        <TextBlock Text="test"/>
        <DVC:Chart x:Name="ChartControl" Width="400" Height="250"
           Background="AliceBlue" >
            <DVC:Chart.Series>
                <DVC:ColumnSeries Title="Disc value"
                                  IndependentValueBinding="{Binding Status}"
                            DependentValueBinding="{Binding DiscrepencyValue}">
                </DVC:ColumnSeries>
            </DVC:Chart.Series>
        </DVC:Chart>
    </Grid>
</UserControl>

Open in new window

0
 
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.


0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SharePoint 2013 search webpart - query suggestions 5 62
sharepoint list help 2 36
C# LINQ ForEach() question 6 54
programming a polycom voip phone 3 20
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

839 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