More graph types -- spc charts
| Author |
Message |
|
David
Major
Joined: Mon Aug 07, 2006 2:39 pm Posts: 116 Location: Chico
|
 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 |
|
 |
|
Carl.Gould
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 3737 Location: Sacramento, CA
|
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 |
|
 |
|
David
Major
Joined: Mon Aug 07, 2006 2:39 pm Posts: 116 Location: Chico
|
 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 |
|
 |
|
Carl.Gould
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 3737 Location: Sacramento, CA
|
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 |
|
 |
|
David
Major
Joined: Mon Aug 07, 2006 2:39 pm Posts: 116 Location: Chico
|
 Pareto
Cool. The python route is the way to go. Thanks!
|
| Thu Feb 07, 2008 11:13 am |
|
 |
|
Carl.Gould
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 3737 Location: Sacramento, CA
|
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 |
|
 |
|
Carl.Gould
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 3737 Location: Sacramento, CA
|
 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 |
|
 |
|
TCATech
Cadet
Joined: Thu Nov 17, 2011 1:13 pm Posts: 6
|
 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 |
|
 |
|
Travis.Cox
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 1974 Location: Sacramento, CA
|
 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 |
|
 |
|
TCATech
Cadet
Joined: Thu Nov 17, 2011 1:13 pm Posts: 6
|
 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 [ 10.9 KiB | Viewed 1421 times ]
The second is plotted as lines: Attachment:
2012-04-05, 19-54-55 - Chart Customizer.png [ 10.89 KiB | Viewed 1417 times ]
And this is what I get: Attachment:
2012-04-05, 19-54-01 - DS5969UI - DSCOOL.png [ 14.58 KiB | Viewed 1419 times ]
In this example the data from the first dataset is plotted over the second dataset.
|
| Thu Apr 05, 2012 4:00 pm |
|
 |
|
TCATech
Cadet
Joined: Thu Nov 17, 2011 1:13 pm Posts: 6
|
 Re: More graph types -- spc charts
Success! Attachment:
2012-04-05, 20-03-25 - DS5969UI - DSCOOL.png [ 14.18 KiB | Viewed 1447 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 |
|
 |
|
Travis.Cox
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 1974 Location: Sacramento, CA
|
 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 |
|
 |
|
Carl.Gould
Moderator
Joined: Sun Apr 02, 2006 2:46 pm Posts: 3737 Location: Sacramento, CA
|
 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 |
|
 |
|