【问题标题】:C3 js: Is it possible to align 2 points from end to end?C3 js:是否可以从头到尾对齐2个点?
【发布时间】:2020-08-19 13:20:47
【问题描述】:

这是我在堆栈溢出中的第一个问题。 我正在使用 C3,我想知道是否可以从头到尾对齐 2 个点。 例如,如果在我的图表中我有 100 和另一个点 -100,但我想通过图像中出现的列。 让我告诉你我想要什么:

我想加入/对齐圆圈中突出显示的两点:

这是我的代码:

var chart = c3.generate({
  data: {
    columns: [
      ["data1", 30, 200, 100, 400, 150, 250],
      ["data2", -100],
      ["data3", null, null, null, null, null, 100],
    ],
    axis: {
      y: {
        max: 365,
        min: 335,
      },
    },
    type: "bar",
    types: {
      data2: "line",
      data3: "line",
    },

    colors: {
      data1: "#f567",
      data2: "blue",
    },

    bar: {
      width: {
        ratio: 0.5, // this makes bar width 50% of length between ticks
      },
    },
    labels: {
      format: function (v, id, i, j) {
        return v;
      },
    },
    // or
    //width: 100 // this makes bar width 100px
  },
});

感谢您的帮助! :)

【问题讨论】:

    标签: javascript reactjs d3.js c3.js


    【解决方案1】:

    我刚刚添加了这部分,它可以工作

       line: {
            connectNull: true
          },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-04-02
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 2011-03-18
      • 2014-01-08
      • 1970-01-01
      相关资源
      最近更新 更多