Hi,
One way to make the group plot is to add the entire worksheet to the layer instead of one curve at a time, and this will work fine if your worksheet is set up with column designations such as XYXYXY...etc which seems to be the case here.
So you could code it as:
GraphLayer grphLayer = grphData.Layers();
grphLayer.AddPlot(wksData, IDM_PLOT_SCATTER);
grphLayer.Rescale();
grphLayer.LT_execute("legend;");
Note that in the above code segment, the add legend to the graph, the "legend" script command is being issued - there is no direct access to legend from OC at this point.
Now, if you wish to add one plot at a time, you can still do that and then after adding all plots, you can use the GroupPlots() method of GraphLayer class to group them, and then follow up with the script legend command to add/update legend.
Easwar
OriginLab