Use setData for multiple lines

44 views
Skip to first unread message

YoYoHoney

unread,
Aug 25, 2015, 10:32:29 AM8/25/15
to Flot graphs
Hi,

I currently have 4 lines in my line chart that I am trying to display in real-time. However, in the update function, I am aware that it only takes in one parameter. All I need to do is increment the x value by one every time, and then my y value is the one that changes. So hypothetically, it would be something like this [0,10], [1,15], [2,5], and so on... My y value for each of the 4 lines will be something different, but I'm confused on how to setData for all four and not just one. If I just initialize a new plot by doing something like $.plot..., there really aren't any lines, just four dots that appear every second. I need a line chart in this case!

Thank you!!

Ced

unread,
Aug 26, 2015, 1:01:37 PM8/26/15
to Flot graphs
setData() doesn't append points to your data set.

From the documentation:

setData(data)

You can use this to reset the data used.

It's up to you to push your new data points onto an array and slice off the old ones.  Just like in the real-time example.


Reply all
Reply to author
Forward
0 new messages