C3 js:是否可以从一端到另一端对齐2个点?

问题描述 投票:0回答:1

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

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

enter image description here

这是我的代码:

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个回答
0
投票

我刚刚添加了此部分,它可以正常工作

   line: {
        connectNull: true
      },
© www.soinside.com 2019 - 2024. All rights reserved.