Applies To:
  • CitectSCADA 6.x, v7.x

Summary:
 I am using the TrnPrint function to print my trend graph out.
I am trying to increase the density (number of horizontal and vertical lines) of the background grid, so that it is easier to read my trend values.
I have not found a way to achieve this. Can you help?

Solution:
You will need to modify a cicode file located in the Include project to achieve the requirement.
It is Citect recommendation not to modify any of the Include functions, so we would suggest you to copy the fucntion and paste it into your project and give it a new name.

The cicode function in question is called TrnPlot() and is located in the Include\graph.ci file
We would therefore suggest  you to copy the entire function, and paste it under the name trnPlotEx() in your project.


You will then need to modify the function as follows:

Add the following two lines between the /* Plot Trend */ and the /* Plot Legend */ sections.

-------------------------
/* Plot Grid */
        PlotGrid(hPlot,nSamples,xTopLeft,yTopLeft,xBotRite,yBotRite,5,red,10,blue,4,black,white,0);
-------------------------

The last arguments of the function: 5,red,10,blue,4,black,white
can be modified at will. See the help file for the PlotGrid fucntion for more information.
In the example above you would print out 5 horizontal lines and 10 vertical.
We would recommend leaving the other arguments as they are.

---------------------------------------------

The resulting cicode will therefore look like:

..........

 /* Plot Border */
        xTopLeft = xPage * 0.020;
        xBotRite = xPage * 0.980;
        yTopLeft = yPage * 0.020;
        yBotRite = yPage * 0.980;

        _PltBorder(hPlot, xTopLeft, yTopLeft, xBotRite, yBotRite);

/* Plot Title */
        yBotRite    = (yPage * 0.03) + _PltFontHeightGet(FONT_BIG);
        txtLength    = StrLength(title) * _PltFontWidthGet(FONT_BIG);
        _PltTitle(hPlot, title, (xTopLeft + xBotRite - txtLength) / 2, yBotRite);

/* Plot Comment */
        yBotRite    = yBotRite + (yPage * 0.01) + _PltFontHeightGet(FONT_NORMAL);    
        txtLength    = StrLength(comment) * _PltFontWidthGet(FONT_NORMAL);
        _PltComment(hPlot, comment, (xTopLeft + xBotRite - txtLength) / 2, yBotRite);

/* Plot Trend */
        xTopLeft = xPage * LeftMargin;
        xBotRite = xPage * RiteMargin;
        yTopLeft = yBotRite + (yPage * 0.01);
        yBotRite = yPage - (yPage * 0.06) - _PltLegendHeight(nLandscape) - (_PltFontHeightGet(FONT_SMALL) * 2);
        error = _PltTrend(    hPlot, nSamples, time1, period1, 0, 0, xTopLeft, yTopLeft, xBotRite, yBotRite, Mode, PLOT_TYPE_NORMAL,
                            TRN_EVENT_TYPE, hAn);
        
/* Plot Grid */
        PlotGrid(hPlot,nSamples,xTopLeft,yTopLeft,xBotRite,yBotRite,5,red,10,blue,4,black,white,0);


/* Plot Legend */
        xTopLeft = xPage * 0.04;
        xBotRite = xPage * 0.96;
        yTopLeft = yBotRite + (yPage * 0.02) + (_PltFontHeightGet(FONT_SMALL) * 2);
        yBotRite = yPage * 0.96;
        _PltLegend(hPlot, xTopLeft, yTopLeft, xBotRite, yBotRite, Mode, nLandscape);

....


Keywords:
 TrnPrint, TrnPlot, Grid, Print

Attachments