Exporting data from chart to same columns of existing Excel

I want to allow a user to run statistical analysis (best fit line, yield and R² values etc) of two datasets returned from an EasyChart. Is there a way to export the two datasets queried to the same two columns of an existing excel sheet? That way the user could set up the excel to do the analysis of Col1 and Col2 and each time they view the sheet the analysis would be ready.

unless there is a way to this type of analysis using an EasyChart directly??

First, please don’t double post. It’s like repeatedly pushing a button on an elevator. The elevator doesn’t move any faster. :slight_smile: Also it helps keep thing nice and tidy and we don’t have to run back and forth between threads.

Now for an answer.

Not within the easy chart. But possible to do with scripting and regular charts.

The math extensions I wrote a while back has a simple linear regression function.
Using a normal Chart and Date Range component:

Script attached to Date Range component:


query=“SELECT t_stamp, unix_timestamp(t_stamp) AS x, Takt_Time as y FROM ds_3425_takt where StationID=‘40’ and t_stamp>=’%s’ and t_stamp<=’%s’” % (startDate,endDate)

DataIn=table = system.db.runQuery(query,“Takt”)

for row in DataIn:

if i>1:

headers=[“t_stamp”, “Takt”, “Trend”]
for row in DataIn:

data = system.dataset.toDataSet(headers, rows)
That should give you a start.

Thanks Jordan, yeah apologies for the double post. I only realised after i posted in 7.7 that it may not be the correct location to post.

The reason i asked about using this function with the easy chart was that i have set the client up with the function to drag tags onto the chart from the tag browse, and additionally click to graph. Instead of trying to run this function (best fit line etc) on the easy chart, would be possible to set the ‘Normal Chart’ up to work with the click to graph? For the CTG i used the Ignition scripts.

So ideally i’d like to run the normal chart to run existing function, plus additional best fit line.