Author |
Topic |
|
Procentaren
Sweden
8 Posts |
Posted - 25 Feb 2014 : 14:01:40
|
I have an application with a number of curves that are updated with processvalues. Sometimes I wan't to freeze the update so the user can inspect the curves. But the datacollection should still run. The obvious way to achieve this is to stop calling updatedraw. And this works fine. But the problem is that I also use the mouselistener to move an object (axis) in the graph. And when the object is moved there seem to be an automatic update of the graph, and the curves are also updated then. I can of course make som kind of buffer to store the processvalues during the time when the graph is frozen, and restore them later. But can someone think of a simpler way ?
Here is the setup for the curves For I = 1 To NumberOfCurves inputChannel(I) = New RTProcessVar("Ch #2", New ChartAttribute(Color.Green, 1.0, DashStyle.Solid, Color.Green)) scrollFrame1.AddProcessVar(inputChannel(I)) attrib(I) = New ChartAttribute(Trend(ATP).Kurvfarg(I), Trend(ATP).Tjocklek(I), DStyle(Trend(ATP).DashStyle(I)))
lineplot(I) = New SimpleLinePlot(pTransform1, Nothing, attrib(I)) lineplot(I).SetFastClipMode(ChartObj.FASTCLIP_X)
inputChannel(I).DatasetEnableUpdate = True rtPlot(I) = New RTSimpleSingleValuePlot(pTransform1, lineplot(I), inputChannel(I)) chartVu.AddChartObject(rtPlot(I)) Next I
Here is the update of the curves For I = 1 To NumberOfCurves inputChannelValue(I) = GetCurrentValue(Trend(TrendNr).Sigtyp(I), Trend(TrendNr).Signummer(I), Trend(TrendNr).RegSigSpec(I)) inputChannel(I).SetCurrentValue(x, inputChannelValue(I)) Next I
|
|
quinncurtis
1586 Posts |
Posted - 25 Feb 2014 : 15:06:40
|
If you move something, then the only way to update its position is to redraw the entire graph. In order to maintain the proper depth positioning (z-value) of every object in the graph in relation to each other, the entire graph needs to be redrawn, which by default includes every object in the graph. So that's the logic behind what's going on.
The RTScrollFrame is what rescales the coordinate system to the most recent data, so that is what would be changing the view of the data. If you disable it while when you want to freeze, that will freeze the change of the scale until RTScrollFrame is re-enabled. It won't prevent display updates, which will always take place when you move something, just the change of the scale and therefore your current view of the data. You may continue to see the waveform update until the waveform reaches the right edge of the current scale, but since the scale will not change until the RTScrollFrame is re-enabled, the waveform will not change after that.
scrollFrame.ChartObjEnable = ChartObj.OBJECT_DISABLE . . scrollFrame.ChartObjEnable = ChartObj.OBJECT_ENABLE
|
|
|
Procentaren
Sweden
8 Posts |
Posted - 26 Feb 2014 : 12:01:40
|
Yes, disabling and enabling worked just as you described. Now I can move the object in the graph without "destroying" the curves. Thankyou for your help.
At first I had random phenomenas where parts of the curve disappeared every time I moved the object. The reason for this was the AutoTruncateDataset function. Setting this function to False while the graph is frozen, fixed that problem. UserChartControl11.inputChannel(I).AutoTruncateDataset = False |
|
|
quinncurtis
1586 Posts |
Posted - 26 Feb 2014 : 12:20:22
|
Yes, your disabling of the AutoTruncateDataset function is the correct thing to do, because the data is still coming in, and if you exceed the auto-truncate value, older data will be discarded from the display dataset. And if you freeze the graph for a long enough period, where you are looking at old data, that is the data which starts to get thrown away.
|
|
|
|
Topic |
|
|
|