More graph types -- spc charts

#1

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

0 Likes

#2

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.

0 Likes

#3

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

0 Likes

#4

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)[/code]

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,

0 Likes

#5

Cool. The python route is the way to go. Thanks!

0 Likes

#6

Thats for sure - I’d much rather code something in beautiful Python than nasty Transact-SQL!

0 Likes

#7

FYI, the Easy Chart in Ignition supports automatic calculation of some statistical pens, such as:

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

0 Likes

#8

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?

0 Likes

#9

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.

0 Likes

#10

So here are my datasets. The first is plotted as bars:


The second is plotted as lines:


And this is what I get:


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

0 Likes

#11

Success!


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

0 Likes

#12

What if you swap the two datasets? Does that work?

0 Likes

#13

Just swap your dataset names. The line renderer should be first, bar renderer second.

0 Likes

#14

I am very close to having this working but my line chart is vertical all in one column, i thought i checked every setting but clearly I’m missing one.

Any recommendations?

Thx

0 Likes

#15

Built in components. Not a $2000 chart.

0 Likes

#16

[quote=“drewdin”]I am very close to having this working but my line chart is vertical all in one column, i thought i checked every setting but clearly I’m missing one.

Any recommendations?

Thx[/quote]

On the chart Change the Extract Order from Col to Row :wink:

0 Likes

#17

This worked great! Just found one issue because of two integers the pct was not calculating.

Original code:
pct += (row[1]/total)*100

Corrected Code:
pct += (float(row[1])/total)*100

And make sure your chart is set to ‘Category Type’

0 Likes