LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

spc toolkit

Hi,
 
I'm going to repeat my message in English:
 
I try to develope a program in LabWindows/CVI. I want to do statistical process, so I installed the spc toolkit.
One of de process usues this function's group:

LGCreate LegendControl (panel, panel_graph, LG_POS_RIGHT_TOP, 1,1,
&xLegendCtrl)

SPCXBarAndR(data, SAMP_COUNT, SAMP_SIZE, NUL, NULL, 0, 3.00, NULL,
&xbarbar, NULL, Xbar, &limitsX, NULL, NULL, NULL)

SPCDrawChartWithZones (panel, panel_chart, xLegendCtrl, Xbar, SAMP_COUNT,
0,0, &limitsX, TRUE, 3)
 
My problem is that the last one give me an error: Graph or strip chart control does not exist or is invalid.
This message only appears if I create the graph control in the .uir like a normal graph, not like a "Classic-style" graph. In this case the program works correctly. The spc manual just indicates two restriccions for these kind of controls: they have to be VAL_RETAIN and VAL_AUTOSCALE.
So I can't understand what's the difference between both controls, why one of them works and the other doesn't.

Thanks everybody
 
 
0 Kudos
Message 1 of 3
(3,304 Views)

The Graph validation code checks to see if the control style is of type CTRL_GRAPH. The issue is the newer graph is of type CTRL_GRAPH_LS.

The code for the SPC toolkit is included, so you could update this. In ..\spc\spc.c, under ValidGraphControl(), change the following

if (allowStripChart) {
        if ( ctrlStyle != CTRL_GRAPH  && ctrlStyle != CTRL_STRIP_CHART && ctrlStyle != CTRL_GRAPH_LS && ctrlStyle != CTRL_STRIP_CHART_LS)
            return FALSE;
    } else if (ctrlStyle != CTRL_GRAPH && ctrlStyle != CTRL_GRAPH_LS)
        return FALSE;

Then in SPCDrawChartWithZones()

ctrlStyle = ControlStyle(pan, graphCtrl);
    switch (ctrlStyle) {
        case CTRL_GRAPH: case CTRL_GRAPH_LS:
            return GraphDrawChartWithZones(pan,graphCtrl, legendCtrl, points,
                    pointCount, startIndex, xOffset, chartLimits, redrawLimits,
                    numZones);
        case  CTRL_STRIP_CHART: case CTRL_STRIP_CHART_LS:
            return StripDrawChartWithZones(pan, graphCtrl, legendCtrl, points,
                    pointCount, startIndex, chartLimits, numZones);
        default:
            return SPC_ERROR_NOT_GRAPH_OR_STRIP;


Under SPCGetChartPlotAttributes()

switch (ctrlStyle) {
        case CTRL_GRAPH:case CTRL_GRAPH_LS:
            return GraphGetChartPlotAttributes(pan, ctrl, whichPlot,
                    plotStyle, pointStyle, lineStyle, color);
        case CTRL_STRIP_CHART:case CTRL_STRIP_CHART_LS:
            return StripGetChartPlotAttributes(pan, ctrl, whichPlot,
                    plotStyle, pointStyle, lineStyle, color);
        default:
            return SPC_ERROR_NOT_GRAPH_OR_STRIP;
    }

This should fix it.
I hope this helps
Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,293 Views)

Hi!

Thank you very much. Your explanation help me very much. I didn't know this detail. I will update my code and I hope it works!

 

0 Kudos
Message 3 of 3
(3,279 Views)