浮动选择/突出显示 - 需要有简单的值,而不是范围
flot selection / highlighting - need to have simple value, not range
我有一张图表,需要 select/突出显示一个值。选择需要设置 "from-to" 范围,使用静态数据是否容易,但是当数据集从 0..0.1 变为 0..100000 时,我必须计算此范围以将范围设置为显示为线。我根本不需要 selected 范围,我想通过简单的行 select!可能吗?
var hoursPerTmpForSelection = hoursPer + 1;
if (hoursPer > 300)
hoursPerTmpForSelection = hoursPer + 10;
else if (hoursPer > 100)
hoursPerTmpForSelection = hoursPer + 6;
else if (hoursPer > 50)
hoursPerTmpForSelection = hoursPer + 4;
else if (hoursPer > 10)
hoursPerTmpForSelection = hoursPer + 1;
else if (hoursPer > 1)
hoursPerTmpForSelection = hoursPer + 0.5;
else if (hour <=1)
hoursPerTmpForSelection = hoursPer + 0.2;
$.plot("#daytimeChart", [daytimeData], {
series: {
bars: {
show: true,
barWidth: 0.8,
align: "center",
lineWidth: 0,
fillColor: "rgba(153, 153, 255, 0.6)"
}
},
yaxes: [{
axisLabel: 'Hours per week'
}],
xaxis: {
mode: "categories",
tickLength: 0,
font: {
lineheight: 0,
size: 0
}
},
selection: { mode: "y" }
}).setSelection({ yaxis: { from: hoursPer, to: hoursPerTmpForSelection } });
如果我设置小 "hoursPerTmpForSelection" 值 - 根本不显示线,如果我设置太多 - 线很粗
我想怎么画就怎么画
您所描述的内容听起来更像是标记而不是选择(参见此 example and the documentation)。扩展您的选项以包含如下内容:
grid: { markings: [
{ color: #888, lineWidth: 1, yaxis: { from: 320, to: 320 } }
] }
我有一张图表,需要 select/突出显示一个值。选择需要设置 "from-to" 范围,使用静态数据是否容易,但是当数据集从 0..0.1 变为 0..100000 时,我必须计算此范围以将范围设置为显示为线。我根本不需要 selected 范围,我想通过简单的行 select!可能吗?
var hoursPerTmpForSelection = hoursPer + 1;
if (hoursPer > 300)
hoursPerTmpForSelection = hoursPer + 10;
else if (hoursPer > 100)
hoursPerTmpForSelection = hoursPer + 6;
else if (hoursPer > 50)
hoursPerTmpForSelection = hoursPer + 4;
else if (hoursPer > 10)
hoursPerTmpForSelection = hoursPer + 1;
else if (hoursPer > 1)
hoursPerTmpForSelection = hoursPer + 0.5;
else if (hour <=1)
hoursPerTmpForSelection = hoursPer + 0.2;
$.plot("#daytimeChart", [daytimeData], {
series: {
bars: {
show: true,
barWidth: 0.8,
align: "center",
lineWidth: 0,
fillColor: "rgba(153, 153, 255, 0.6)"
}
},
yaxes: [{
axisLabel: 'Hours per week'
}],
xaxis: {
mode: "categories",
tickLength: 0,
font: {
lineheight: 0,
size: 0
}
},
selection: { mode: "y" }
}).setSelection({ yaxis: { from: hoursPer, to: hoursPerTmpForSelection } });
如果我设置小 "hoursPerTmpForSelection" 值 - 根本不显示线,如果我设置太多 - 线很粗
我想怎么画就怎么画
您所描述的内容听起来更像是标记而不是选择(参见此 example and the documentation)。扩展您的选项以包含如下内容:
grid: { markings: [
{ color: #888, lineWidth: 1, yaxis: { from: 320, to: 320 } }
] }