Created
November 2, 2014 09:36
-
-
Save fxp/44f963268200d6a4f4e1 to your computer and use it in GitHub Desktop.
chartjs: lose data point when .addData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head lang="en"> | |
| <meta charset="UTF-8"> | |
| <title></title> | |
| <script src="http://www.chartjs.org/assets/Chart.min.js"></script> | |
| </head> | |
| <body> | |
| <canvas id="mychart"></canvas> | |
| <script> | |
| var data = { | |
| labels: [], | |
| datasets: [ | |
| { | |
| label: "My First dataset", | |
| fillColor: "rgba(220,220,220,0.2)", | |
| strokeColor: "rgba(220,220,220,1)", | |
| pointColor: "rgba(220,220,220,1)", | |
| pointStrokeColor: "#fff", | |
| pointHighlightFill: "#fff", | |
| pointHighlightStroke: "rgba(220,220,220,1)", | |
| data: [] | |
| } | |
| ] | |
| }; | |
| var ctx = document.getElementById('mychart').getContext("2d"); | |
| var chartObj = new Chart(ctx).Line(data); | |
| for (var i = 0; i < 4; i++) { | |
| chartObj.addData([40], "asdsad"); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment