05-16-2007 07:05 AM
05-16-2007 08:09 AM - edited 05-16-2007 08:09 AM
Hello Burcu,
what exactly do you mean by 'highlight a part of the graph' ?
If you would like to highlight a part of the plot, you could do this by plotting a part of this plot on top of the plot in another color. Suppose you plotted an array "y_data" of floating point members:
PlotY (pnlHandle, PNL_GRAPH, y_data, y_array_size, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_RED);
Then you could replot a part of this y_array in another color:
PlotY (pnlHandle, PNL_GRAPH, y_data + start_point, end_point - start_point , VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_YELLOW);
Is this what you are looking for? If not, don't hesitate to reply
--- just corrected a type-o---
Message Edited by Wim S on 05-16-2007 03:10 PM
05-16-2007 08:30 AM
05-16-2007 08:45 AM - edited 05-16-2007 08:45 AM
Hello Burcu,
Sorry, I didn't think of that problem
I see two solutions:
1 - Use the PlotXY function instead of the PlotY function. Therefore you will have to create an x_data array, containing values from 0 up to the size of the y_data array. When plotting the highlight plot, also use PlotXY and specify the same offset:
x_data = malloc (y_array_size * sizeof(int));
for (counter = 0; counter < y_array_size; counter++)
x_data[counter] = counter;
PlotXY (pnlHandle, PNL_GRAPH, x_data, y_data, y_array_size, VAL_INTEGER, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_RED);
PlotXY (pnlHandle, PNL_GRAPH, x_data + start_point, y_data + start_point, end_point - start_point, VAL_INTEGER, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, VAL_YELLOW);
free (x_data);
2 - Use the top X axis for the highlight plot, setting the start_point value as the top X axis offset. Make sure that this axis is not visible in the User Interface.
Hope this helps...
Message Edited by Wim S on 05-16-2007 03:47 PM
05-16-2007 08:57 AM