How to create a line to show threshold in bar graph

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:57:31

问题


I am using flot to create bar charts like

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 ?


回答1:


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" }]
        }
});

Produces (fiddle here):



来源:https://stackoverflow.com/questions/9092263/how-to-create-a-line-to-show-threshold-in-bar-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!