Flot.js插件配合flot.tooltip.js绘图节点制作提示字样,弹窗情况下,提示在覆盖层下面没上来~知道是要加window.top把提示拉上来,但是不知道往哪里写~~
getFlotData: function () {
var obj = {
'waterTempAlarmId': currenPKId
};
var flotSet = {
grid: {
hoverable: true,
borderWidth: 1,
borderColor: '#ccc'
},
tooltip: {
show: true,
cssClass: "flot-tt",
content: "时间:%x<br/>水温:%y ℃",
defaultTheme: false
},
xaxis: {
// tickLength: 0,
// show: true
mode: "time",
timeformat: "%h:%M:%S"
},
yaxis: {
autoscaleMargin: 0.06,
position: "left"
},
colors: ['#62a8ea']
};
app.getData.getTempData(obj, function (data) {
var tempDataArr = [];
data.forEach(function (item) {
var d = new Date(item.alarmTime);
var day = d.getHours();
d = d.setHours(day+8);
var arr = [d, item.waterTemp];
tempDataArr.push(arr);
});
console.log(tempDataArr);
var flot_data = {
lines: {
show: true,
tension: 0.4,
lineWidth: 2,
fill: 0,
lineColor: "#62a8ea"
},
points: {
show: true,
lineWidth: 1.5,
radius: 3,
symbol: "circle",
fill: true,
fillColor: "#62a8ea"
},
shadowSize: 0,
data: tempDataArr
};
// console.log(tempDataArr); // 当前水温数据
$.plot(trendModel.find('[id="waterTempFlot"]'), [flot_data], flotSet);
});