gpt4 book ai didi

legend - 在顶部显示图例,就像在 c3js 中的底部外观一样

转载 作者:行者123 更新时间:2023-12-02 06:52:53 25 4
gpt4 key购买 nike

我正在使用 c3.js 来实现仪表板。它工作得很好。但我只想要底部出现的图例。我想按照这个顺序绘制图表。

  1. 传奇
  2. 图表
  3. 蜱虫

这是想要的示例图。 enter image description here通过在网络中搜索,如果我这样设置图例配置

legend: {
show: true,
position: 'inset',
inset: {
anchor: 'top-right',
x: 50,
y: 0,
step: 1
}
}

然后图例与主图重叠如下图:

enter image description here这是非常典型的要求,但在 c3js 中不可用。我该怎么做?

最佳答案

使用 padding 选项设置顶部间隙: http://c3js.org/reference.html#padding-top

然后在插图上设置一个负的 y 偏移量:

       legend: {
position: 'inset',
inset: {
anchor: 'top-right',
x: 50,
y: -30,
step: 1
}
},
padding: {
top: 30
}

关于legend - 在顶部显示图例,就像在 c3js 中的底部外观一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39189778/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com