如何在c3.js时间序列图表下方填写

时间:2015-10-13 06:52:39

标签: javascript charts pubnub c3.js

如何在c3.js时间序列图表下方填充,如堆积面积图,但x轴剩余时间序列的值。我正在使用PUBNUB的EON图表库,但它使用c3.js作为基础库。

eon.chart({
    pubnub   : pubnub,
    history  : false,
    channel  : 'orbit2',
    flow     : true,
    generate : {
        bindto : '#chart',
        size: {
        height: 240,
        width: 380
    },
        data   : {
            x      : 'x',
            labels : true
        },
        axis : {
            x : {
                type : 'timeseries',
                tick : {
                    format : '%H:%M:%S'
                },
                zoom: {
                   enabled: true
                }
            }
        }
    },
    transform : function(m) {
        return { columns : [
            ['x', new Date().getTime()],
            ['Bytes Written', m.Bytes_Written],
            ['Bytes Read', m.Bytes_Read]

        ] };
    }
});

enter image description here

1 个答案:

答案 0 :(得分:2)

PubNub EON图表类型

您只需提供要使用的图表类型即可。 EON landing page and here is a code sample from one of the examples on that page上有一些示例:

eon.chart({
  channel: channel,
  pubnub: pubnub,
  generate: {
    bindto: '#chart',
    data: {
      labels: true,
      type: 'bar'
    },
    bar: {
      width: {
        ratio: 0.5
      }
    },
    tooltip: {
        show: false
    }
  }
});

请注意data EON参数下配置的generate密钥。 See c3 docs/examples了解有关此内容的详细信息。