barwidth选项不适用于jquery flot [英] barwidth option is not working on jquery flot

查看:109
本文介绍了barwidth选项不适用于jquery flot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用条形图绘制折线图。一切顺利。
这是我的代码

I am trying to draw a line chart with bar chart. everything went well. This is my code

 $.plot(holder, [
                    { data: data[0].data, lines: { show: true }, label:"Service Level" },
                    { data: data[1].data, bars: { show: true }, yaxis: 2, label:"# Of Calls" } // set second series to use second axis
               ], {
                   yaxes: [{
                       min: 0, // options for first axis,
                       max: 100,
                       tickFormatter: function (val, axis) {
                           return val + '%';
                       }
                   }, {
                       alignTicksWithAxis: 1, // options for second axis, put it on right
                       position: "right"
                   }],
                   xaxis: {
                       min: minVal.getTime(),
                       max: maxVal.getTime(),
                       mode: "time",
                       timeformat: timeFormat,
                       //twelveHourClock: true,
                       tickSize: [tickVal, modeChart],
                       //monthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                       tickLength: 0
                   },
                   bars: {
                        barWidth: 24 * 60 * 60,
                   },
                   grid: {
                       hoverable: true,
                       clickable: false,
                       borderWidth: 0
                   },
               });
           }

我已设置 barWidth 无论我改变什么值,条形的宽度都不会改变。你能帮帮我吗?

I already set the barWidth and whatever I change the value, the width of the bar is not changing. could you help me please?

我说的是这张图片中的蓝色字母

I am talking about the blue one in this image

推荐答案

barWidth 系列选项,您可以全局或按系列指定:

barWidth is a series option, you can specify it globally or per series:

全球:

...
series: { // you are missing this
    bars: {
        barWidth: 24 * 60 * 60,
    },
}
...

每个系列:

{ data: data[1].data, bars: { show: true, barWidth: 24 * 60 * 60 }, yaxis: 2, label:"# Of Calls" } // set second series to use second axis

这篇关于barwidth选项不适用于jquery flot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆