0
当我创建具有以下选项海军报的图形绘制图形正确:flot打标功能,轴没有定义?
var options = {
colors: trendcolors,
series: {
points: {
show: true
},
lines: {
show: true
}
},
xaxis: {
mode: "time",
axisLabel: "Date/Time",
tickLength: 0
},
yaxis: {
axisLabel: "Duration (Sec)"
},
selection: {
mode: "x"
},
grid: {
hoverable: true,
clickable: true,
markings: function (axes) {
var markings = [];
var date = new Date(axes.xaxis.min);
date.setUTCSeconds(0);
date.setUTCMinutes(0);
date.setUTCHours(0);
var i = date.getTime();
do {
markings.push({xaxis:{from: i, to: i + (24 * 60 * 60 * 1000) }, color: colormarking });
i += ((24 * 60 * 60 * 1000) * 2);
} while (i < axes.xaxis.max);
return markings;
}
},
legend: {
labelFormatter: function(label, series) {
return label + " (" + series.data.length + ")";
}
}
};
但是,当我改变标记匿名函数的标准功能出现错误和海军报未能绘制图形,因为“轴'未在fMarkings行中定义。为什么是这样?有什么不同?
var options = {
colors: trendcolors,
series: {
points: {
show: true
},
lines: {
show: true
}
},
xaxis: {
mode: "time",
axisLabel: "Date/Time",
tickLength: 0
},
yaxis: {
axisLabel: "Duration (Sec)"
},
selection: {
mode: "x"
},
grid: {
hoverable: true,
clickable: true,
markings: fMarkings(axes)
},
legend: {
labelFormatter: function(label, series) {
return label + " (" + series.data.length + ")";
}
}
};
顺便说一下,fMarkings是在另一个js块中全局定义的。