-
-
Save stephenlb/ca85589d416578a171044501dd0defab to your computer and use it in GitHub Desktop.
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
| <script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script> | |
| <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
| <script src="../js/c3.js"></script> | |
| <script src="../js/pubnub-c3.js"></script> |
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
| <div id="chart"></div> | |
| <script> | |
| var chart = pubnubC3({ | |
| channel: "c3-spline", | |
| generate: { | |
| bindto: '#chart', | |
| data: { | |
| x: 'x', | |
| columns: [], | |
| labels: true | |
| }, | |
| axis : { | |
| x : { | |
| type : 'timeseries', | |
| tick: { | |
| format: '%H:%M:%S' | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| </script> |
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
| var pubnub = new PubNub({ | |
| subscribeKey: "demo", | |
| publishKey: "demo", | |
| ssl: true | |
| }) | |
| setInterval(function(){ | |
| pubnub.publish({ | |
| channel: 'c3-spline', | |
| message: { | |
| columns: [ | |
| ['x', new Date().getTime()], | |
| ['Austin', Math.floor(Math.random() * 99)], | |
| ['New York', Math.floor(Math.random() * 99)], | |
| ['San Francisco', Math.floor(Math.random() * 99)], | |
| ['Portland', Math.floor(Math.random() * 99)] | |
| ] | |
| } | |
| }); | |
| }, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment