-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realtime Data chart refresh #2859
Comments
LineChartRealTimeViewController.zip a little help in the zip |
Interesting. Basically, I wrote the same lines of yours, without these :
Why are these lines necessary? Then, as I can see, you didn't refresh the chart. There's no call to ps: What I also wanted is to move the chart always to the last added entry, basically an auto scroll of the chart every time a new data is added. |
these lines are necessary
because of these lines there will be no lag / not autoscroll
65 is the time |
I didn't understand what you mean saying
The procedure I'm using to update the chart is correct, but the chart isn't refreshing itself if I don't call |
axisMinimum and axisMaximum are fixed values I promise you that it works very well try my demo on my account |
I've just downloaded your demo, but I'm not able to compile. The Chart.xcproj file is missing. |
What I do is:
Here's a code snippet:
|
I did exactly what you said, but nothing to do. The chart is not automatically refreshing. |
here is a little project |
I've seen you example project and I've run it. Everything is perfect, but you're doing something a bit different from what I need (and from what I think usually should be done when drawing a chart). With these lines : if yEntries.count >= Int(50 / step)
{
yEntries.removeFirst()
} you're removing values from the entries. In this way user isn't able to drag the chart to see old values because they're basically not present. That's why your chart is "moving". Because you always have a set of values with a range of What I want to do is to be able to drag the chart to see old values and, when I active real time mode, the chart should move itself to the maximum x value, smoothly. Your way is a good compromise I think. ps: Thanks for sending me a sample project 👍 |
I noticed your remarks |
Great example. There is only one "problem" left. I noticed your chart is draggable only when zoomed and only between a range of 50 (30-80, 0-50, 90-140). How can I make it draggable for the whole data set? |
Sorry to jump in, but this thread seems a good example whoever needs real time update should look at this. But Seems this cannot be pinned top. use a label for now |
Hello everybody, Thanks for your support Regards |
I'm using the
LineChartView
to display data that is continuously received (every 0.2 seconds usually, the time could change). My problem is : how do I refresh the chart correctly? At the moment, I have this code to reload :I'm using the
lineChart.animate(xAxisDuration: 0.01)
to redraw (refresh) the chart every time I receive new samples. The reload animation is not smooth and it happens using an animation, a workaround basically. How can I achieve the same effect, but in the correct way?As you can see in issue number #2857 , the
invalidate()
method is missing.The text was updated successfully, but these errors were encountered: