The community forums are in BETA and closed to the public.

EON chart does not show any values

I am trying to render a spline chart with PUBNUB EON charting libaray. I do not understand what is going wrong here. I can see the data in console, but the chart is not rendering, there are only x and y axis lines. I am getting the data from python SDK and subscribing via javascript SDK. There is no error message in the console.

My python code is

def counterVolume(data):
  for each in data:
    y = each.counter_volume
    data_clean = json.dumps(y, indent=4, separators=(',', ': '))
    print pubnub.publish(channel='channel', message= data_clean)


My subscribe javascript function is

       var data;
       var pubnub = PUBNUB.init({
                                publish_key: 'pub',
                                subscribe_key: 'subf'

       var channel = "c3-spline";
                             history: true,
                            channel: 'channel',
                             flow: true,
                               generate: {
                                bindto: '#chart',
                                data: {
                                x: 'x',
                                labels: false
                               axis : {
                                  x : {
                                  type : 'timeseries',
                                  tick: {
                                 format: '%m-%d %H:%M:%S'
    } }});
    function dataCallback(){
                                  channel: 'channel',
                                  message: function(m){
                                           data = m
                     channel: 'orbit_channel',
                     message: {
                            columns: [
                                     ['x', new Date().getTime()],
                                     ['y', data]

I can see the values in console but I do not understand why it wont render on chart. the result of python script:

89453.0 89453.0 89453.0 89453.0

Hi Hina, Thank you for asking about Eon. May you paste a sample result of your data (a JSON message) from your Python Publish? Also I'm noticing your JavaScript has a Subscribe and a Publish call and that should be omitted.

Hi Stephen, Please see results in the above question. In both EON charts and Rickshaw-pubnub fixture in of the examples publish function is used to render charts that is why I have used the publish function but even if i omit the function the charts wont render.

PubNub EON Custom Streaming Chart Data Formats

PubNub EON requires a specific format in order to render and display your data on charts. You can render any data format by using the built-in transform parameter which expects a function(){}. The transform function provided is treaded like a callback to a map operation and transforms your data to match the required EON format.

PubNub EON Transform Method for Streaming Chart Data

Using the example stream from PubNub Public Streams. You can use the transform method to format your message for EON.

EON Streaming Chart Data Format

{ columns : [
    ['x', new Date().getTime()],
    ['Humidity', m.humidity],
    ['Temperature', m.ambient_temperature],
    ['Light', m.photosensor]
] }

Example Streaming Chart Data Setup

Here is an example of a working PubNub stream being formatted for EON streaming chart. Using the transform method, your JavaScript should look like this:

var pubnub = PUBNUB({
    subscribe_key : 'YOUR_SUBSCRIBE_KEY_HERE' // <-- CHANGE!!!

    pubnub   : pubnub,
    history  : false,
    channel  : 'channel', // <-- YOUR CHANNEL
    flow     : true,
    generate : {
        bindto : '#chart',
        data   : {
            x      : 'x',
            labels : true
        axis : {
            x : {
                type : 'timeseries',
                tick : {
                    format : '%Y-%m-%d'
    transform : function(data) {
        return { columns : [
            ['x', new Date().getTime()],
            ['Value', data]
        ] };

So I do not need a publish function?

You need a publish function, but only on the Python side.

Login or Signup to post a comment