Indydave Posted July 28, 2014 Share Posted July 28, 2014 Running 5.87a I am successfully reading and graphing standard value vs time data from a mysql database. The problem I'm having is getting the graph to automatically update when loading in the next set of data points. As an example: I read data points related to a step, lets assume starting at step 1 and I get the following data points: data { 25, 22, 28, 30} data.time {1405945042, 1405945047, 1405945052, 1405945057} Everything graphs properly and works up to this point - Now I have a button that advances to step 2 data data { 31, 30, 33, 32} data.time {1405945062, 1405945067, 1405945072, 1405945077} although the db read is triggered and the data is updated, I cannot make the graph automatically update and must right click and "Autoscale" both Axis to have the graph show the new data. I'd like to accomplish the scaling automatically so the user does not have to. What am I missing? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 28, 2014 Share Posted July 28, 2014 When you select AutoScale from the popup you freeze the graph scaling. The only way to then adjust the graph scaling is to either thaw the axes, or do autoscale again (or pan / zoom). A better choice is to have it automatically autoscale by changing the ScaleFrom and ScaleTo parameters. For your Y axis it would be: ScaleFrom: min(data) ScaleTo: max(data) while your X axis would be: ScaleFrom: min(getTime(data)) ScaleTo: max(getTime(data)) Add * 1.1 to max and * 0.9 to min to give a little room around the edges. Then just make sure your graph is thawed by deselecting the graph and right clicking on it and selecting Freeze / Thaw -> Thaw All. It won't be an option if the graphs are already thawed. A thawed graph will also show Green all around when you click on it (not selected), while a frozen axis shows purple. Link to comment Share on other sites More sharing options...
Indydave Posted July 28, 2014 Author Share Posted July 28, 2014 Works Flawlessly! Thanks for the assist. Link to comment Share on other sites More sharing options...
Indydave Posted July 28, 2014 Author Share Posted July 28, 2014 One more question while I'm working on this particular graph. I've tried every possible combination I can think of to use a variable in the db Query, and can't seem to find the right combination of concat'ing the query together to make it work. I have a global variable which I want to use in the WHERE clause of the query. I'm able to confirm that the variable is set properly, and changes via a static display of the variable for test, but I can't get the query to 'read' the variable. If i have a variable, sbatch_id, which is a value like 379, how can I construct the db query to use the variable? Link to comment Share on other sites More sharing options...
AzeoTech Posted July 29, 2014 Share Posted July 29, 2014 db.queryToClass(dbase, "Select * from myTable where BatchID = " + sbatch_id) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.