【发布时间】:2021-11-03 17:35:38
【问题描述】:
我想要一行带有文本标签的数据点。我似乎无法正常工作。
这是我尝试过的一个示例。然而,结果是文本是水平的而不是垂直的......
这只能通过注释实现吗?还是有更直接的方法(在数据本身中)?
var trace1 = {
x: [0, 1, 2],
y: [1, 1, 1],
mode: 'lines+markers+text',
name: 'Lines, Markers and Text',
text: ['Text A', 'Text B', 'Text C'],
textposition: 'top',
angle: 90, // NOT WORKING
type: 'scatter'
};
var data = [trace1];
var layout = {showlegend: false};
Plotly.newPlot('myDiv', data, layout);
<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-2.4.2.min.js'></script>
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
【问题讨论】:
标签: javascript plotly