-
-
Save ToeJamson/b1b19e41470c59e8b764 to your computer and use it in GitHub Desktop.
This file contains 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="http://cdn.pubnub.com/pubnub.min.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 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 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 = PUBNUB.init({ | |
publish_key: 'demo', | |
subscribe_key: 'demo' | |
}); | |
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