如何在flotr2中将堆积柱状图的数据标签显示出来,鼠标覆盖区域显示数据如何实现。
如何将柱状图上的Y轴数据显示到柱状图上方。
做这种第三方插件最好的就是去参考人家官网的例子;
http://www.humblesoftware.com/flotr2/index#!basic-bars
mouse属性下有一个track的值为true的时候,鼠标覆盖区域显示数据。
厦门市demo ,自己可以看下,
个人建议使用hightCart,这个插件来做,简单而且美观
(function basic_bars(container, horizontal) {
var
horizontal = (horizontal ? true : false), // Show horizontal bars
d1 = [], // First data series
d2 = [], // Second data series
point, // Data point variable declaration
i;
for (i = 0; i < 4; i++) {
if (horizontal) {
point = [Math.ceil(Math.random()*10), i];
} else {
point = [i, Math.ceil(Math.random()*10)];
}
d1.push(point);
if (horizontal) {
point = [Math.ceil(Math.random()*10), i+0.5];
} else {
point = [i+0.5, Math.ceil(Math.random()*10)];
}
d2.push(point);
};
// Draw the graph
Flotr.draw(
container,
[d1, d2],
{
bars : {
show : true,
horizontal : horizontal,
shadowSize : 0,
barWidth : 0.5
},
mouse : {
track : true,**//这里为false的时候鼠标覆盖的区域不显示数据**
relative : true
},
yaxis : {
min : 0,
autoscaleMargin : 1
}
}
);
})(document.getElementById("editor-render-0"));