我使用以下命令禁用了范围选择器中的小图:
showInRangeSelector: false,
但我收到这样的警告信号:javascript - DYGRAPHS:在范围选择器中禁用小图形时显示警告-LMLPHP
我似乎找不到错误所在。

更新的代码:

<html>
<head>
<link href="http://dygraphs.com/2.0.0/dygraph.css" rel="stylesheet"/>
<script src="http://dygraphs.com/2.0.0/dygraph.js"></script>
<div id="hello" class="chart"></div>
</head>
<body>
<script type = "text/javascript">

var hello = [
            [new Date("2016-03-06"),[10,20,30],[11,11,11]],
            [new Date("2016-03-07"),[10,20,30],[15,15,15]],
            [new Date("2016-03-08"),[10,20,30],[32,32,32]],
            [new Date("2016-03-09"),[10,20,30],[18,18,18]],
            [new Date("2016-03-10"),[10,20,30],[26,26,26]],
            [new Date("2016-03-11"),[10,20,30],[31,31,31]],
            [new Date("2016-03-12"),[10,20,30],[9,9,9]],
        ],

a = new Dygraph(
    document.getElementById("hello"),hello,
    {
        labels: [ "Date", "Mean" , "Scatter"],
        customBars: true,
        showRangeSelector: true,
        showInRangeSelector : false,
        interactionModel: Dygraph.defaultInteractionModel,
        series: {
            "Mean" : {
                drawPoints: false,
                color: "#585858",
            },
            "Scatter" : {
                drawPoints: true,
                pointSize: 3,
                strokeWidth: 0,
            }
        },
    }
);
</script>





谢谢 :)

我必须添加额外的措辞,因为该帖子主要是代码,我无法发布它:P

最佳答案

这是我正在考虑的解决方法。告诉我它是否对您有用。

这个想法是,您只能为rangeselector创建另一个系列。

该系列的数据并不重要,因为将不会显示。但这取决于您要查看范围选择器的方式。如果要在rangeselector中查看典型行,可以使用第一个解决方案。

https://jsfiddle.net/b8sz6m36/4/

var hello = [
        [new Date("2016-03-06"),[10,20,30],[11,11,11],[1,1,1]],
        [new Date("2016-03-07"),[10,20,30],[15,15,15],[1,1,1]],
        [new Date("2016-03-08"),[10,20,30],[32,32,32],[1,1,1]],
        [new Date("2016-03-09"),[10,20,30],[18,18,18],[1,1,1]],
        [new Date("2016-03-10"),[10,20,30],[26,26,26],[1,1,1]],
        [new Date("2016-03-11"),[10,20,30],[31,31,31],[1,1,1]],
        [new Date("2016-03-12"),[10,20,30],[9,9,9],[1,1,1]],
    ],

a = new Dygraph(
document.getElementById("hello"),hello,
{
    labels: [ "Date", "Mean" , "Scatter", "RangeSelector"],
    customBars: true,
    showRangeSelector: true,
    interactionModel: Dygraph.defaultInteractionModel,
    series: {
        "Mean" : {
            drawPoints: false,
            color: "#585858",
                    showInRangeSelector : false,
        },
        "Scatter" : {
            drawPoints: true,
            pointSize: 3,
            strokeWidth: 0,
                    showInRangeSelector : false,
        },
        "RangeSelector" : {
            showInRangeSelector : true,
        }
    },
  }
);


如果对范围选择器完全为空并不重要,则可以使用第二种解决方案,其中rangeselector的序列中的数据更简单

https://jsfiddle.net/b8sz6m36/5/

var hello = [
        [new Date("2016-03-06"),[10,20,30],[11,11,11],0],
        [new Date("2016-03-07"),[10,20,30],[15,15,15],0],
        [new Date("2016-03-08"),[10,20,30],[32,32,32],0],
        [new Date("2016-03-09"),[10,20,30],[18,18,18],0],
        [new Date("2016-03-10"),[10,20,30],[26,26,26],0],
        [new Date("2016-03-11"),[10,20,30],[31,31,31],0],
        [new Date("2016-03-12"),[10,20,30],[9,9,9],0],
    ],

a = new Dygraph(
document.getElementById("hello"),hello,
{
    labels: [ "Date", "Mean" , "Scatter", "RangeSelector"],
    customBars: true,
    showRangeSelector: true,
    interactionModel: Dygraph.defaultInteractionModel,
    series: {
        "Mean" : {
            drawPoints: false,
            color: "#585858",
                    showInRangeSelector : false,
        },
        "Scatter" : {
            drawPoints: true,
            pointSize: 3,
            strokeWidth: 0,
                    showInRangeSelector : false,
        },
        "RangeSelector" : {
            showInRangeSelector : true,
        }
    },
  }
);

09-20 12:58