【问题标题】:Added X-Axis Labels to C3 Bar Chart为 C3 条形图添加了 X 轴标签
【发布时间】:2016-02-08 20:54:13
【问题描述】:

我正在尝试将 x 轴标签添加到 C3 中的条形图中。获取 javascript 错误。这甚至可能吗?我尝试了很多组合,但找不到这种工作的例子。

var _vertChart = c3.generate({
    bindto: '#chart',
    data: {
        x: 'x',
            columns: [
                [['x','7am','8am','9am','10am','11am','12pm','1pm','2pm','3pm','4pm','5pm','6pm','7pm','8pm','9pm','10pm'],], 
                ['My Numbers',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                ['Johns Numbers',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
            ],
            type: 'bar'
        },
        bar: {
            width: {
                ratio: 0.8 // this makes bar width 50% of length between ticks
            }
            // or
            //width: 100 // this makes bar width 100px
        },
        axis: {x: {type: 'category', show: true}},
        labels: true,
        tooltip: {
            show: true
        },
        color: {
            pattern: ["#5F3A81","#56AEC7", "#F09348", "#A196A9"]
        },
        grid: {
            x: {
                show: true
            },
            y: {
                show: false,
                lines: []
            }
        }
});

【问题讨论】:

    标签: d3.js c3.js


    【解决方案1】:

    刚刚意识到我的列中有错误数据

    【讨论】:

      猜你喜欢
      • 2019-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-06
      • 1970-01-01
      相关资源
      最近更新 更多