gpt4 book ai didi

javascript - Flot Multi Axes Bar Chart with orderbars and categories 插件

转载 作者:行者123 更新时间:2023-11-29 11:02:08 25 4
gpt4 key购买 nike

我用 Flot 创建了一个条形图,它在一个图表上使用两组数据。每组都有自己的 y 轴。我希望条形并排放置,但是在绘制图表时,它们会重叠。

enter image description here

我试过像这样使用 orderbars 插件

{ data: d1, bars: {order: 1}, label: "Merchant Vol",  },
{ data: d2, bars: {order: 2}, label: "Residual Pmt", yaxis: 2}

但这会导致条形图无法呈现。我也使用类别模式/插件。

我怀疑使用两个 y 轴有问题。有没有一种方法可以绘制多轴条形图而不重叠条形图?摆弄代码 here.

最佳答案

orderbars 插件与 categories 插件不兼容。它的工作原理是将每个条形图从其原始位置移动一点(例如,x 值 1 处的条形图对于一个数据系列移动到 0.9,对于另一个数据系列移动到 1.1)。当您将 Jun-16 作为 x 值时,这不起作用。

解决方案是删除类别插件,使用数字 x 值并自行设置 x 轴刻度。查看更新的 fiddle here .

enter image description here

关于javascript - Flot Multi Axes Bar Chart with orderbars and categories 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45329727/

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