Javascript 如何删除plotly area graph的背景线
我不想在绘图区域图的背景中使用线条。我的图表是这样的。 我想从图表中删除这条线。但我没有找到任何解决办法 我提到 下面是我的代码: demo.htmlJavascript 如何删除plotly area graph的背景线,javascript,plotly,Javascript,Plotly,我不想在绘图区域图的背景中使用线条。我的图表是这样的。 我想从图表中删除这条线。但我没有找到任何解决办法 我提到 下面是我的代码: demo.html <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script> <script src="https://cdn.plot.ly/plotly-l
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
</script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv" style="width: 480px; height: 400px;"><!-- Plotly chart will be drawn inside this DIV --></div>
<script>
var trace1 = {
x: ['2013-10-04 22:23:00', '2016-10-06 22:23:00', '2013-11-04 22:23:00', '2013-11-07 22:23:00','2013-12-04 22:23:00', '2013-12-08 22:23:00'],
y: [1, 3, 6,9, 4, 5],
fill: 'tozeroy',
fillcolor: 'red',
text: server1,
hoverinfo: "x+y+text",
name:"Server 1",
type: 'scatter',
mode:"markers",
marker:
{
size:5,
color:"gray"
},
uid:"c2e171"
};
var layout = {
margin: {
l: 35,
r: 40,
b: 50,
t: 10
},
legend: {
"orientation": "h"
},
yaxis : {
fixedrange: true
},
};
var data = [trace1];
Plotly.newPlot('myDiv', data,layout);
var plotDiv = document.getElementById('myDiv');
</script>
</body>
</html>
变量trace1={
x:['2013-10-04 22:23:00','2016-10-06 22:23:00','2013-11-04 22:23:00','2013-11-07 22:23:00','2013-12-04 22:23:00','2013-12-08 22:23:00'],
y:[1,3,6,9,4,5],,
填充:“tozeroy”,
fillcolor:'红色',
文本:server1,
hoverinfo:“x+y+文本”,
名称:“服务器1”,
键入:“散布”,
模式:“标记”,
标记:
{
尺码:5,
颜色:“灰色”
},
uid:“c2e171”
};
变量布局={
保证金:{
l:35,
r:40,
b:50,
t:10
},
图例:{
“方向”:“h”
},
亚克斯:{
固定范围:对
},
};
var数据=[trace1];
Plotly.newPlot('myDiv',数据,布局);
var plotDiv=document.getElementById('myDiv');
当我展开图形时,意味着拖动图形x轴日期被隐藏
请给我一个解决办法。我是plotly.js的新手您可以使用
showgrid
:
xaxis: {
showgrid: false
},
yaxis: {
showgrid: false,
showline: true
}
更多plot.ly布局参考:您可以使用
showgrid
:
xaxis: {
showgrid: false
},
yaxis: {
showgrid: false,
showline: true
}
更多plot.ly布局参考:我希望左侧Y轴有一行。@AnilJagtap更新了我的答案,使用
showline
属性。感谢您的回复。我希望y轴上也有记号。我得到了上述注释的解决方案。@AnilJagtap做得很好。我希望y轴左侧有一行。@AnilJagtap更新了我的答案,使用showline
属性。感谢您的回复。我想在y轴上也打勾。我得到了上面评论的解决方案。@AnilJagtap干得好。