|
P-Chart Possible? |
Posted by Rich on Jan-31-2013 01:03 |
|
Hello,
We have ChartDirector Version 5.0 for coldfusion.
I have been asked if I can create P-Charts with ChartDirector.
Is this possible and if so, are there any examples?
I have uploaded a sample chart I would need to replicate.
Thanks in advance!
Rich
|
Re: P-Chart Possible? |
Posted by Peter Kwan on Feb-01-2013 00:31 |
|
Hi Rich,
Yes. ChartDirector can draw the chart you need. The UCL and LCL are step lines, while the black line in the middle is a normal line. The code is like:
c.addStepLineLayer(UCLData, ""0xff0000").setAlignment(cd.Center);
c.addStepLineLayer(LCLData, ""0xff0000").setAlignment(cd.Center);
layer = c.addLineLayer();
layer.addDataSet(lineData, "0x000000").setDataSymbol(cd.CircleSymbol, 7);
Note that you would need to have the data points for the lines (that is, the position of the UCL, LCL and the black line) to plot the lines. ChartDirector cannot compute the UCL or LCL level using your raw production data.
For the labels on the right of your chart as well as the horizontal dash line in the middle, you may add them using Axis.addMark. By default, the Axis.addMark will add both the label and the horizontal line, but your can use Mark.setMarkColor to disable the line (by setting the line color to cd.Transparent).
I also see that if a point is above UCL or below LCL, it will be a red square. To do this, simply create a scatter layer containing only the red points. One method is:
for (i = 0; i LT ArrayLen(lineData); i = i + 1) {
if ((lineData[i] GE LCLData[i]) && (lineData[i] LE UCLData[i]))
lineData[i] = cd.NoValue;
}
c.addScatterLayer(null, lineData, "", cd.SquareSymbol, 9, "0xff0000");
Hope this can help.
Regards
Peter Kwan |
Re: P-Chart Possible? |
Posted by Rich on Feb-01-2013 22:30 |
|
Thank you for your reply.
I will give it a try.
Rich |
|