12-18-2013 04:27 PM
Hello,
I am using "PlotStripChart" function to express variables. I would like to show two variables(data range is pretty different.) in one chart.
I tried to show each variables with traces but it was hard to see the values because of the different range of data.
Is it possible I could set active both Y-axises(Left and Right axis) for StripChart and bind the variables to each axis?
Thank you,
Insuk
Solved! Go to Solution.
12-18-2013 05:50 PM
Hello,
I think I found the indirect way by setting the axis scaling. If you have any better way, please let me know.
Thanks,
Insuk
12-19-2013 12:03 AM
You can enable the right Y-axis and set the strip chart with two traces. Next customize e.g. trace 2 to use the right Y-axis. From this moment on, when you PlotStripChart with an array of two values, the first one refers to left axis and the second one to right axis.
12-19-2013 02:15 AM
This is how you set trace #2 to use the right axis:
12-19-2013 09:02 AM
Hello Roberto,
Thank you for answer. But I still have difficulty to see the trace#2 value.
If I use right Y axis, it should have the independent scale for the value. Right?
If the YLeft = 100 and YRight = 0.0001, then they should have each auto scale and show the graph by the range.
My Right Y axis values seems to follow the left range and hard to see the smallest Y axis value.
Should I set up for this one? I also could not see the right Y Axis values. Do I need to set up for showing Right Axis value?
Thank you,
Insuk
12-19-2013 10:06 AM
This is how to show and set the right Y-axis scale:
12-19-2013 10:13 AM
Hello Roberto,
For making sure, let me attach the uir file setting and the part of my program.
Do I need to call "SetCtrlAttribute(DisplayHandle,Chart[idx].chartCtrl,ATTR_ACTIVE_YAXIS,VAL_RIGHT_YAXIS);" whenever I update chart?
I tried that but it did not work either.
The code:
SetCtrlAttribute(DisplayHandle,Chart[idx].chartCtrl,ATTR_ACTIVE_YAXIS,VAL_RIGHT_YAXIS);
PlotStripChart(DisplayHandle,Chart[idx].chartCtrl,PlotBuf[idx],2,0,0,VAL_FLOAT);
The attachments:
1. trace setting
2. my uir apprearance
3.running result
12-19-2013 10:16 AM
Thank you though I did that before asking that.
Insuk
12-19-2013 10:22 AM
Let me give more codes for making sure. The following code is repeating every 1 sec.
PlotBuf[idx][0] = dataF; //This value for trace #1
PlotBuf[idx][1] = Chart[idx].sampleVar; //This value for trace #2
SetCtrlAttribute(DisplayHandle,Chart[idx].chartCtrl,ATTR_ACTIVE_YAXIS,VAL_RIGHT_YAXIS);
PlotStripChart(DisplayHandle,Chart[idx].chartCtrl,PlotBuf[idx],2,0,0,VAL_FLOAT);
Thank you,
Insuk
12-19-2013 10:37 AM
No, ACTIVE_YAXIS need not to be calle before plotting. You should simply call PlotStripChart as you are already doing. But I noticed that in your uir3.jpg (running result) the right Yscale is not visible: are you sure you are using at runtime the same strip chart you customized in the UIR editor?