本文介绍了如何创建一条线以在条形图中显示阈值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用flot创建类似

I am using flot to create bar charts like

例如,我需要指定一个阈值,例如750(y轴)上的一条线,以显示限制...flot包中有一个jquery.flot.threshold.js文件,但我不知道如何在条形图上使用它.

I need to specify a threshold like a line at 750(y axis) for example, to show the limit...there is one jquery.flot.threshold.js file in flot package, but i dont know how to use it on bar charts.How to do it ?

推荐答案

似乎有在当前flot发行版中使用阈值插件存在一些问题.如果您只想标记阈值,则使用网格标记选项可能会更容易:

Seems there was some issues with using the threshold plugin with the current flot release version. If you just want to mark a threshold, it might be easier to use the grid markings option:

$.plot($("#placeholder"), [ d1, d2, d3 ], {
    series: {
        stack: true,      
        bars: { show: true, barWidth: 0.6 }
    },
    grid: {
           markings: [ { xaxis: { from: 0, to: 12 }, yaxis: { from: 0, to: 20 }, color: "#6D7B8D" }]
        }
});

制作(小提琴此处):

这篇关于如何创建一条线以在条形图中显示阈值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 21:31