Hello,
In your X-Function's GetNGraphPreview_OnInitGraph function add the following to setup your preview graph with two layers and a left and right Y axis.
GraphPage gpPreview = pgTemp;
gpPreview.LoadTemplate("doubley");
In your X-Function's GetNGraphPreview_OnChange function add the following to add plots to your preview graph.
GraphPage gpPreview = pgTemp;
GraphLayer gl;
DataRange dr1;
dr1.Add("X", trGetN.x1.strVal);
dr1.Add("Y", trGetN.y1.strVal);
gl = gpPreview.Layers(0);
gl.AddPlot(dr1, IDM_PLOT_LINE);
gl.Rescale();
DataRange dr2;
dr2.Add("X", trGetN.x1.strVal);
dr2.Add("Y", trGetN.y2.strVal);
gl = gpPreview.Layers(1);
gl.AddPlot(dr2, IDM_PLOT_LINE);
gl.Rescale();
gpPreview.SetShow();
The trGetN argument holds all your variables. In my example I named the X input vector as x1 and the two Y output vectors as y1 and y2.