gpt4 book ai didi

javascript - DYGRAPHS:在范围选择器中禁用小图时显示警告

转载 作者:行者123 更新时间:2023-12-03 04:11:27 26 4
gpt4 key购买 nike

我使用以下方法禁用了范围选择器中的小图:showInRangeSelector:假,但我收到这样的警告信号:enter image description here我似乎找不到错误在哪里。

更新代码:

<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

最佳答案

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

这个想法是您可以仅为范围选择器创建另一个系列。

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

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,
}
},
}
);

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

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,
}
},
}
);

关于javascript - DYGRAPHS:在范围选择器中禁用小图时显示警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44319807/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com