【问题标题】:flot selection / highlighting - need to have simple value, not range浮点选择/突出显示 - 需要有简单的值,而不是范围
【发布时间】:2015-05-08 22:27:13
【问题描述】:

我有一个浮动图表,需要选择/突出显示一个值。选择需要设置“从到”范围,使用静态数据是否容易,但是当数据集从 0..0.1 更改为 0..100000 时,我必须计算此范围以将范围设置为显示为线。我根本不需要选择范围,我想通过简单的线条选择!有可能吗?

        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”值太小 - 线条根本不显示,如果我设置太多 - 线条很粗

我在图像上绘制我想要的方式

【问题讨论】:

  • 我不明白你在问什么。你想突出情节的一部分吗?或者你想突出一个点?你能画出你想要的结果吗?
  • 我想突出显示一条线,而不仅仅是一个点。 .i.e 值 457,厚度为 1 px

标签: selection flot highlight


【解决方案1】:

您所描述的内容听起来更像是标记而不是选择(请参阅此exampledocumentation)。扩展您的选项以包含以下内容:

grid: { markings: [
    { color: #888, lineWidth: 1, yaxis: { from: 320, to: 320 } }
] }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-06
    • 2013-05-29
    • 1970-01-01
    • 2017-07-18
    • 2011-06-14
    • 2014-05-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多