LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Chart x scale offset

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?

LV 2011, Win7
0 Kudos
Message 1 of 5
(2,768 Views)

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.

LV 2011, Win7
0 Kudos
Message 2 of 5
(2,759 Views)

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.)

0 Kudos
Message 3 of 5
(2,746 Views)

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.

LV 2011, Win7
0 Kudos
Message 4 of 5
(2,737 Views)

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

LV 2011, Win7
0 Kudos
Message 5 of 5
(2,724 Views)