?
Solved

dotNetCharting - how to calculate percentage on data from 2 different series

Posted on 2009-04-01
3
Medium Priority
?
1,179 Views
Last Modified: 2013-11-26
I have a chart with 2 series added to it. The first series is for total orders. The second series is the count of orders that are from repeat customers. I would like to add a 3rd series that is the calculated percentage. Basically just dividing the second series by the first one. I can't seem to figure out the syntax to make that work.

I am using the latest release from dotnetcharting.com
Dim sc As New SeriesCollection()
 
        RepeatCustomers.Debug = True
        RepeatCustomers.Title = "Repeat Customers"
        RepeatCustomers.XAxis.FormatString = "MMMyy"
        RepeatCustomers.LegendBox.Orientation = dotnetCHARTING.Orientation.Bottom
        RepeatCustomers.DateGrouping = TimeInterval.Months
 
        Dim sd As DateTime = New System.DateTime(2007, 5, 1, 0, 0, 0) '5/1/2007
        Dim ed As DateTime = New System.DateTime(Year(Now), Month(Now), Day(Now), 23, 59, 59)
 
        'Add a series
        Dim sql As String = "SELECT OrderDate,1 AS q FROM Orders WHERE OrderDate >= '" & sd.ToString & "' AND OrderDate <= '" & ed.ToString & "' ORDER BY OrderDate"
        Dim df As New Series()
        df.ConnectionString = ConfigurationManager.AppSettings("DNCConnectionString").ToString
        df.StartDate = sd
        df.EndDate = ed
        df.Type = SeriesType.Cylinder
        df.DefaultElement.ShowValue = True
        df.Name = "Total Orders"
        df.SqlStatement = sql
        df.DefaultElement.Transparency = 50
 
        sc.Add(df)
 
        'repeat customer orders
        Dim sql2 As String = "query selects quantity of orders from repeat customers)"
        Dim rs As New Series()
        rs.Name = "Repeats"
        rs.SqlStatement = sql2
        rs.DefaultElement.Transparency = 50
        rs.Type = SeriesType.Cylinder
        rs.DefaultElement.ShowValue = True
        rs.ConnectionString = df.ConnectionString
 
        sc.Add(rs)
 
        RepeatCustomers.SeriesCollection.Add(sc)

Open in new window

0
Comment
Question by:aaronwk
[X]
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
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Dustin Hopkins
ID: 24052652
You could just divide the series

Series s3 = s1 / s2;

You may also want to take a look at the data tutorial
http://www.dotnetcharting.com/documentation/v5_2/Data%20Manipulation.html

Hope this helps,
Dustin
0
 

Author Comment

by:aaronwk
ID: 24053626
Yea, i've tried just about everything including that. I've been through all the help files to no avail. I found what i thought would work which is Series.Divide but no dice. What's so strange is that if i manually create a series with elements these techniques work great. As soon as my series is attached to sql server for data it does not work. I'm pretty sure it's a bug in their component. When i do series.elements.count of a series filled from the sql server connection the count is 0 yet it displays fine on the chart.
0
 

Accepted Solution

by:
aaronwk earned 0 total points
ID: 24063752
Their support gave me the solution. It's an issue only relating to data coming from a database. This support article solves it:
http://dotnetcharting.com/kb/article.aspx?id=10392
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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