bower install eon-chart --save
Check out our bower example.
npm install eon-chart --save
Check out our webpack example.
Plug your normal C3 config into the
generate param. Supply an array of PubNub channel in
eon.chart returns the normal C3 chart object.
That's it! Now you can publish messages to the same
channel and they'll render in the graph.
var pubnub =publishKey: 'demo' // replace with your own pub-keysubscribeKey: 'demo' // replace with your own sub-key;;
All chart data must exist within an object called
eon. Also notice how the
channels matches in both examples.
|channels||An array of PubNub channels to subscribe to. Either
|channelGroups||An array of PubNub channel groups to subscribe to. Either
|generate||Your C3 chart generation config.||
|flow||Used to update spline charts over time series.||
|limit||The size of your buffer. How many values to display on the chart before shifting the first value off and appending a new value. This is not native to C3.||
|rate||Interval at which new datapoints are drawn on the chart in milliseconds.||
|history||Fill the buffer by using PubNub history call to retrieve last
|xType||Your x axis configuration. Can be
|xId||Your x axis source if
|message||A function to call everytime a PubNub message is recieved. See PubNub subscribe||
|transform||Method for changing the payload format of your stream. See example||
|connect||A function to call when PubNub makes a connection. See PubNub subscribe||
|debug||Log EON events to console as they happen||
More on Publishing Messages
This uses the included PubNub library to pubnub.publish() packets to the pubnub.subscribe() call waiting inside the C3 framework.
You probably want to publish data from the back-end instead. Check out our docs for more info:
Customize Your Graph
eon-chart works will all supported graph types in C3. Just check out the examples above.
You can learn more about customizing your graph from the official C3 docs.
X Axis Configuration
eon-chart will automatically use the PubNub message timestamp for chart x values. This timestamp is recorded when a message is published to the PubNub data stream network. This is the case when
xType is set to
custom. Then, set
xId to the x value that appears within your published messages. Any custom
x must be a microtime date like
var pubnub =publishKey: 'demo' // replace with your own pub-keysubscribeKey: 'demo' // replace with your own sub-key;eon;
Notice how the code below publishes a key value pair called
x with every message.
Eon charts supports both time series bar charts and point of time bar charts. If you'd like to represent a bar chart in a single point of time, supply
xType: "category" and only the latest data will appear in the chart categorized by key. See
examples/bar.html for an example.
Multiple Points Per Payload
It is possible to publish multiple plot points per payload. Rather than using the object name
eon use the name
eons and supply an
Array. Because you use the
eons property name, the library will know to loop through the array and plot each point.
Note that if publishing multiple points per payload, you must use
xType: "custom" and supply an
eons:x:value: 1x:value: 2
Here's an example of data collected at 100ms increments, but only publishes every 1,000ms. Every payload includes 10 points with 100ms resolution. See a full example here.
You can disable eon-chart modifications by setting
false. By default C3 will use an incremental x axis (1,2,3,4...).
You can publish from multiple sources into one chart. For example, you can graph the individual memory usage from 3 servers by supplying the same channel to your PubNub publish requests.
Check out our distributed chart example.