Code Monkey home page Code Monkey logo

Comments (40)

xgqfrms avatar xgqfrms commented on May 2, 2024 7

CPU status monitor

  1. disable animation
  1. update data

https://codepen.io/webgeeker/pen/jKBqge

from chart.js.

nnnick avatar nnnick commented on May 2, 2024 4

This feature is supported in the latest release of Chart.js

For both these demos to mimic an asynchronous request, I'm just using a simple set interval loop every 5 seconds.

Here's an example of updating a line chart using new data:
http://jsbin.com/yitep/5/edit

Here's how we can update existing data on a line chart:
http://jsbin.com/yitep/4/edit

Please note for other chart types, e.g. a bar chart, we would update the array of bars rather than points. See the docs for a bit more details on this for each chart type. http://www.chartjs.org/docs/

from chart.js.

webdestroya avatar webdestroya commented on May 2, 2024

+1 this would be very useful, as I want to use this on a wallboard which i want to create the chart once, and just refresh the data

from chart.js.

nnnick avatar nnnick commented on May 2, 2024

Thanks for this, in the coming couple of weeks I'm planning to add some utility methods on the charts that are returned, so after creating a chart and assigning it to a variable, you could call a method on that variable to add new data, or clear the chart etc. Stay tuned!

from chart.js.

nnnick avatar nnnick commented on May 2, 2024

What you could do for now is recreate your chart each time you update your data via ajax or sockets or whatever.

from chart.js.

joshhunt avatar joshhunt commented on May 2, 2024

+1

from chart.js.

drorm avatar drorm commented on May 2, 2024

+1

from chart.js.

billdami avatar billdami commented on May 2, 2024

+1

from chart.js.

ialtamirano avatar ialtamirano commented on May 2, 2024

+1

from chart.js.

tan-tan-kanarek avatar tan-tan-kanarek commented on May 2, 2024

+1

from chart.js.

arathael avatar arathael commented on May 2, 2024

+1

from chart.js.

mbuchetics avatar mbuchetics commented on May 2, 2024

+1

from chart.js.

marcj avatar marcj commented on May 2, 2024

+1

from chart.js.

katanacrimson avatar katanacrimson commented on May 2, 2024

+1

from chart.js.

pinara747 avatar pinara747 commented on May 2, 2024

+1

from chart.js.

geoff-parsons avatar geoff-parsons commented on May 2, 2024

@nnnick The simplest solution i've found for now to live update is to use jQuery's replaceWith().

See here for an example: https://gist.github.com/skhisma/5689383

from chart.js.

nnnick avatar nnnick commented on May 2, 2024

That would work right now @skhisma

Alternatively, you could do something like this and keep hold of your chart object, then call Doughnut each time you want to load new data in.

var chartConstruct = new Chart(ctx);

chartConstruct.Doughnut(data,options);

//A little later on when you've got some new data...
chartConstruct.Doughnut(newData,options)

Chart.js won't have methods for getting new data - that'll be up to your application, but there will be a better API for this soon.

from chart.js.

jwerle avatar jwerle commented on May 2, 2024

will there be an update for this feature soon?

from chart.js.

balexandre avatar balexandre commented on May 2, 2024

👍

from chart.js.

nnnick avatar nnnick commented on May 2, 2024

There will be an update for this. I don't have an ETA just yet, but it'll have a whole load of new fancy stuff!

from chart.js.

marcj avatar marcj commented on May 2, 2024

awesome! +100

from chart.js.

jwerle avatar jwerle commented on May 2, 2024

any chance this will be done for the challenge post contest?

from chart.js.

brentsmith-dev avatar brentsmith-dev commented on May 2, 2024

If you're looking for a "live update" sort of look (like a line graph that grows over time) I had luck with using a different options object with animations: false for subsequent calls. If you can't wait until nnnick releases the updates.

This is the idea:

var ctx = document.getElementById("myChart").getContext("2d");
var optionsNoAnimation = {animation : false}
var myNewChart = new Chart(ctx);
myNewChart.Line(data);  
setTimeout(function(){
  myNewChart.Line(newData, optionsNoAnimation)
;}, 3000);

from chart.js.

brentsmith-dev avatar brentsmith-dev commented on May 2, 2024

here's a codepen showing a better example: http://cdpn.io/hyldD

from chart.js.

jwerle avatar jwerle commented on May 2, 2024

@statuswoe thanks for sharing that!

from chart.js.

mrjuan1 avatar mrjuan1 commented on May 2, 2024

I'm looking quite forward to this update

from chart.js.

climaa avatar climaa commented on May 2, 2024

+1

from chart.js.

tbuschto avatar tbuschto commented on May 2, 2024

Re-creating the chart with new data is simple enough, but having an animated transition would be awesome. I think it would be fairly simple to implement as long as both the old and the new data are available while drawing a frame.

from chart.js.

climaa avatar climaa commented on May 2, 2024

+1

from chart.js.

albertpak avatar albertpak commented on May 2, 2024

+1

from chart.js.

JJ avatar JJ commented on May 2, 2024

Just leaving my mark in case it's finally closed... :-)

from chart.js.

gabovanlugo avatar gabovanlugo commented on May 2, 2024

+1

from chart.js.

tpires avatar tpires commented on May 2, 2024

+1

from chart.js.

jakeboyles avatar jakeboyles commented on May 2, 2024

+1

from chart.js.

christianparpart avatar christianparpart commented on May 2, 2024

+1.

checking the long history of this ticket, .... is this project still active? -.-`

from chart.js.

jwerle avatar jwerle commented on May 2, 2024

Looks dead to me
On Jun 7, 2014 7:51 AM, "Christian Parpart" [email protected]
wrote:

+1.

checking the long history of this ticket, .... is this project still
active? -.-`


Reply to this email directly or view it on GitHub
#13 (comment).

from chart.js.

marcj avatar marcj commented on May 2, 2024

It's dead since the beginning. ;)

Sent from my iPhone

Am 07.06.2014 um 15:48 schrieb Joseph Werle [email protected]:

Looks dead to me
On Jun 7, 2014 7:51 AM, "Christian Parpart" [email protected]
wrote:

+1.

checking the long history of this ticket, .... is this project still
active? -.-`


Reply to this email directly or view it on GitHub
#13 (comment).


Reply to this email directly or view it on GitHub.

from chart.js.

chancesmith avatar chancesmith commented on May 2, 2024

+1

from chart.js.

luisrudge avatar luisrudge commented on May 2, 2024

👍

from chart.js.

AndrewSav avatar AndrewSav commented on May 2, 2024

In the fist example every time animation happens the chart gets cut on the left and then it slides to the left into that blank space. Is it possible to make it so that the blanking out does not happen and the chart flows to the left smoothly, without chopping?

from chart.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.