简体   繁体   English

浮点图:阈值未能在垂直条形图上显示

[英]Flot: Threshold Failing to Show on Vertical Bar Graph

I am trying to add thresholds to a vertical bar graph, but for whatever reason, they are failing to appear. 我试图将阈值添加到垂直条形图中,但是由于任何原因,它们都无法显示。

Here are my settings for the graph: 这是我的图表设置:

var metOptions = {
    series:{
        bars: {
            show: true,
            align: "center",
            barWidth: 24 * 60 * 60 * 600,
            lineWidth: 1,
            fill: 0.7,
        },
    },
    xaxis: {
        mode: "time",
        axisLabel: "Date",
        axisLabelUseCanvas: true,
        axisLabelFontSizePixels: 12,
        axisLabelFontFamily: 'Verdana, Arial',
        axisLabelPadding: 10,
        color: "black",
    },
    yaxes: [{
        position: "left",
        min: 90,
        max: 100,
        color: "black",
        tickDecimals: 2,
        axisLabelUseCanvas: true,
        axisLabelFontSizePixels: 12,
        axisLabelFontFamily: 'Verdana, Arial',
        axisLabelPadding: 3
    }
    ],
    legend: {
        noColumns: 1,
        labelBoxBorderColor: "#000000",
        position: "ne"
    },
    grid: {
        hoverable: true,
        borderWidth: 2,
        mouseActiveRadius: 50,
        backgroundColor: { colors: ["#ffffff", "#EDF5FF"] },
        axisMargin: 20
    },
    tooltip: true,
    tooltipOpts: {
        content: "%x, %y%"
    }
};

Here is my dataset definition: 这是我的数据集定义:

var dataset = [
    {
        label: "Metalization",
        data: chartData,
        color: "#F00",
        threshold: [
            {
                below: 95,
                color: "rgb(0, 0, 255)"
            },
            {
                below: 94,
                color: "rgb(0, 255, 0)"
            }
        ],
    }
]

$.plot($("#metal-variance"), dataset, metOptions);

And here is the data I am currently testing with: 这是我目前正在测试的数据:

[[1445144400000,95.76],[1445230800000,95.83],[1445317200000,93.99],[1445403600000,94.57],[1445490000000,93.37],[1445576400000,88.53]]

With X being a time stamp, and Y being the value. X是时间戳记,Y是值。

And here is a screen shot of the graph that is generated: Flot Graph 这是生成的图形的屏幕截图: Flot Graph

So I have set the thresholds so that if the value is below 94, the bar should be green, but as you can see from the image, the third and fifth bars are below 94, but yet they are still displaying as red. 因此,我设置了阈值,以便如果该值低于94,则该条应为绿色,但是从图像中可以看到,第三和第五条低于94,但它们仍显示为红色。

Any help with this issue would be much appreciated. 任何有关此问题的帮助将不胜感激。

Works in this fiddle : 在这个小提琴中工作

在此处输入图片说明

Are you sure you have included the jquery.flot.threshold.min.js file? 您确定已包含jquery.flot.threshold.min.js文件吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM