【发布时间】:2018-02-06 19:49:16
【问题描述】:
我正在寻求一些帮助来更改 plotly.js 库中的标记形状。
我要做的是将每个组的第一个标记和最后一个标记更改为垂直线,将中间的标记更改为菱形。
我已经从 plotly 遵循了这个参考 link,但似乎无法让它工作。
这是我正在使用的 JS。
var subject = ["Title 1","Title 1","Title 1","Title 2","Title 2","Title 2"];
var score = [40,50,60,20,40,60];
var data = [{
type: 'scatter',
x: score,
y: subject,
mode: 'line',
transforms: [{
type: 'groupby',
groups: subject,
}],
hoverinfo: 'text',
text: ['Lower Index : 40','Est : 50','Higher Index : 60','Lower Index : 20','Est : 40','Higher Index : 60'],
marker: {
size: 12,
shape: ['line-ew',"diamond-open","line-ew","line-ew","diamond-open","line-ew"]
},
}];
var layout = {
xaxis: {
type: '-',
title: "x Title",
range:[0,100]
},
yaxis: {
title: "Y title",
},
title: "Main Title",
showlegend: false,
legend: {"orientation": "h"}
};
Plotly.plot('myGraph', data,layout)
和同一个例子的代码笔
【问题讨论】:
标签: javascript plotly