10-08-2010 07:43 AM - edited 10-08-2010 07:45 AM
My problem is following. I have one chart that receives data. I want to take a picture of that chart but also with its history displayed. To create the copy is easy. The problem is that I don't know how to determine the offset of the new chart so it displays corresponding values? The reason is that the original chart scrolls the history buffer. How to calculate that?
10-08-2010 08:02 AM
I added an example to demonstrate what I mean. I copy the chart into graph where I want to see the history buffer of the chart but I don't know how to se x scale offset.
10-08-2010 09:03 AM
Why are you appending the history data and value arrays? You are just duplicating the last 10 points. (The value is already part of the history data!).
(You could take the xrange.max minus the array size of the history data.)
10-08-2010 09:20 AM
Thanks for your help Christian. My bad. I thought that the last value is not part of the history. Nevertheless, the suggestion with xrange.max minus the array size of the history data will only work if the chart reaches the xmax. See attached.
10-08-2010 04:18 PM
I seem not to be the only one who stumbled across this issue. There really seems to be no way to calculate that. There are two workarounds but none of them is ideal:
1] Autoscale the x scale and get the information from the xmax. - This is not useful for me since I would have to DeferPanelUpdates=true, autoscale, put it back to its original state, DeferPanelUpdates=false and since I need to know this information quite often... that's not the best thing to do.
2] Keep track on how many samples I have already written into the chart. I more or less do this anyway so it is not such a big deal. From this we can calculate the "offset". I also did it the way that I use one of the chart string type properties (e.g. Documenation) and I write the actual count into it so I have it accessible from anywhere just through the reference of the chart. For further release it would be also nice if the chart had property like SmplsPerChanWritten which would keep track on how many samples per channel has already been written after clearing the chart/its history.
One step further I would also like to see one custom property (lets call it Tag) for every control. It would be variant type and the users could use it for situation like storing piece of information according to their needs (so I wouldn't have to misuse Documentation property of the chart to store U64 information like I just do). I should maybe write an idea to idea exchange...
If somebody has a better way, please tell me