我使用此代码创建了以下雷达图。 Codepen
data = [{
type: 'scatterpolar',
r: [39, 28, 8, 7, 28, 39],
theta: ['A','B','C', 'D', 'E', 'A'],
fill: 'toself'
}]
layout = {
polar: {
radialaxis: {
visible: true,
range: [0, 50]
}
},
showlegend: false
}
Plotly.newPlot("myDiv", data, layout)
使用此工具,online graph maker ,似乎你可以按比例设置颜色,但我想单独设置每个点,
任何有关如何自定义其余元素的指导都会非常有帮助。
谢谢。
最佳答案
#myDiv path.point{
fill: blue !important;
}
如果你想进一步自定义颜色,你可以使用 CSS :nth-of-type(n) 修饰符 https://www.w3schools.com/cssref/sel_nth-of-type.asp
data = [{
type: 'scatterpolar',
r: [37, 28, 8, 7, 28, 39],
theta: ['A','B','C', 'D', 'E', 'A'],
fill: 'toself',
marker : { color : '#B80102'}
}]
layout = {
polar: {
radialaxis: {
visible: true,
range: [0, 50]
}
},
showlegend: false
}
Plotly.newPlot("myDiv", data, layout)
#myDiv path.point{
fill: blue !important;
}
<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>
<body>
<div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
关于javascript - 设置雷达图标记的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60412132/