It is currently Sat Apr 19, 2014 9:10 am




Post new topic Reply to topic  [ 13 posts ] 
 More graph types -- spc charts 
Author Message
Major
Major

Joined: Mon Aug 07, 2006 2:39 pm
Posts: 122
Location: Chico
Post More graph types -- spc charts
Hi gang:

Any chance of getting some spc charts in factory pmi. Histograms, Pareto charts, x-bar and range charts, individuals and moving averages, ewma, cusum, etc.?

Regards, D. Lewis


Thu Aug 17, 2006 3:04 pm
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post 
Yes, a statistical package has been in our sights for a while now. This will probably be in the form of a plugin for FactoryPMI that provides many statistical chart types.

Our development schedule is full for a while, so I'd look for something like this around the first quarter of 2007.

Note that some of these charts can be approximated or achieved using the existing charts. For example, a histogram is simply a bar chart that shows frequencies of items. Something like a "SELECT COUNT(*) FROM MyTable GROUP BY MyCategory" query would work well for this.

Also, you can implement any arbitrary statistical calculations you'd like in Jython, and then push your derived statistical dataset into a chart. Not the easiest of tasks, but it is possible.

_________________
Carl Gould
Software Development
Inductive Automation


Fri Aug 18, 2006 7:50 am
Profile WWW
Major
Major

Joined: Mon Aug 07, 2006 2:39 pm
Posts: 122
Location: Chico
Post Pareto
Hi Carl:

Quick question (I hope): I have a data set I'm going to plot as an histogram, and I would like to superimpose on that a cumulative line. So, imagine a chart with 12 bars, then a line on top of that whose first data point = 16%, 2nd= 16% + 14% (30%), 3rd = 16% + 14% + 13% (43%), etc. The final datapoint for the line = 100%. You've likely seen them.

How do I go about generating a line like that? Should I hop through all the hoops on the db side to calculate all the values for the line and return two distinct datasets? or can factorypmi help me out.

Thx a bunch. David


Thu Feb 07, 2008 10:50 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post 
David,

Yes, you're describing a Pareto chart, it seems. You can either: write a stored procedure in the database to give you these lines,

OR

Write a jython script that takes calculates this for you. Here is the general approach for the latter:

We're going to be using the classic chart for this so that we can manipulate the data directly. We'll have a classic chart with two datasets on it (one called "Data", and add another one called "Cumulative"). Bind the "Data" dataset to a SQL query that brings in our raw data - first column is the X value, second column is the Y value.

Now, we add a script on the chart's propertyChange event to generate the cumulative line for the second dataset. Here is such a script:

Code:
if event.propertyName == 'Data':
   data = fpmi.db.toPyDataSet(event.newValue)
   headers = ["x","Cumulative"]
   
   # First, calculate the total
   total = 0
   for row in data:
      total += row[1]

   # Now, generate the new dataset
   rows = []
   pct = 0
   for row in data:
      if total > 0:
         pct += (row[1]/total)*100
      rows.append([row[0], pct])

   event.source.Cumulative = fpmi.db.toDataSet(headers,rows)


Now just map the Cumulative dataset to its own (0-100) axis, and set the Data dataset's renderer to a "Bar Renderer", and you should be all set.

Hope this helps,

_________________
Carl Gould
Software Development
Inductive Automation


Thu Feb 07, 2008 11:11 am
Profile WWW
Major
Major

Joined: Mon Aug 07, 2006 2:39 pm
Posts: 122
Location: Chico
Post Pareto
Cool. The python route is the way to go. Thanks!


Thu Feb 07, 2008 11:13 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post 
Thats for sure - I'd much rather code something in beautiful Python than nasty Transact-SQL!

_________________
Carl Gould
Software Development
Inductive Automation


Thu Feb 07, 2008 11:37 am
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post Re: More graph types -- spc charts
FYI, the Easy Chart in Ignition supports automatic calculation of some statistical pens, such as:

Average, Moving average, LCL, LWL, UWL, and UCL.

_________________
Carl Gould
Software Development
Inductive Automation


Thu Mar 04, 2010 10:41 am
Profile WWW
Cadet
Cadet

Joined: Thu Nov 17, 2011 1:13 pm
Posts: 6
Post Re: Pareto charts
I sucessfully implemented the pareto chart using a Classic Chart in Ignition 7.3.1. One data set plots as bars, another data set plots as a line. However, I can't get the line to draw in front of the bars. It always draws behind the bars, no matter what I do, so the bars hide the line.

Is there any way to change the draw order of different data sets?


Thu Apr 05, 2012 7:38 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: More graph types -- spc charts
Yes, it is the order of the custom (dynamic properties). So if you have two datasets the second one will be on top of the first one. So make your line chart data be on the second dataset.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Thu Apr 05, 2012 8:13 am
Profile WWW
Cadet
Cadet

Joined: Thu Nov 17, 2011 1:13 pm
Posts: 6
Post Re: More graph types -- spc charts
So here are my datasets. The first is plotted as bars:

Attachment:
2012-04-05, 19-54-44 - Chart Customizer.png
2012-04-05, 19-54-44 - Chart Customizer.png [ 10.9 KiB | Viewed 2578 times ]


The second is plotted as lines:

Attachment:
2012-04-05, 19-54-55 - Chart Customizer.png
2012-04-05, 19-54-55 - Chart Customizer.png [ 10.89 KiB | Viewed 2574 times ]


And this is what I get:

Attachment:
2012-04-05, 19-54-01 - DS5969UI - DSCOOL.png
2012-04-05, 19-54-01 - DS5969UI - DSCOOL.png [ 14.58 KiB | Viewed 2576 times ]


In this example the data from the first dataset is plotted over the second dataset.


Thu Apr 05, 2012 4:00 pm
Profile
Cadet
Cadet

Joined: Thu Nov 17, 2011 1:13 pm
Posts: 6
Post Re: More graph types -- spc charts
Success!

Attachment:
2012-04-05, 20-03-25 - DS5969UI - DSCOOL.png
2012-04-05, 20-03-25 - DS5969UI - DSCOOL.png [ 14.18 KiB | Viewed 2609 times ]


I made the line chart to be the first dataset (by renaming the datasets) and it all turned out beautifully. Thanks!


Thu Apr 05, 2012 4:05 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: More graph types -- spc charts
What if you swap the two datasets? Does that work?

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Thu Apr 05, 2012 4:07 pm
Profile WWW
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 4016
Location: Sacramento, CA
Post Re: More graph types -- spc charts
Just swap your dataset names. The line renderer should be first, bar renderer second.

_________________
Carl Gould
Software Development
Inductive Automation


Thu Apr 05, 2012 4:17 pm
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: