javascript - 在比较多个系列 highstock 中更改 yAxis 值以显示点值而不是百分比变化值
问题描述
嗨,我正在使用 Highstock 图表比较
Highcharts.stockChart('container', {
rangeSelector: {
selected: 4
},
yAxis: {
labels: {
formatter: function () {
return (this.value > 0 ? ' + ' : '') + this.value + '%';
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
plotOptions: {
series: {
compare: 'percent',
showInNavigator: true
}
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
valueDecimals: 2,
split: true
},
series: seriesOptions
});
}
point.y
正如我们所看到的, y轴的值是 0%、20%、40%,我们是否可以point.change
在yAxis
.
要求是显示实际值而不是百分比变化yAxis
。
labels: {
formatter: function () {
return (this.value > 0 ? ' + ' : '') + this.value + '%';
}
},
我认为目前this.value
在 yAxis 标签是百分比变化point.change
,我们可以显示代表的值point.y
。
这可能吗
注意 y 轴值不应硬编码
解决方案
改变series
这样的:
plotOptions: {
series: {
//compare: 'percent',
compare: 'value',
showInNavigator: true
}
},
推荐阅读
- react-native - 如何防止在 react-admins DateInput 中输入错误的日期?
- javascript - 在同一个重复帖子中更新类似计数跨度
- python - 如何预处理 tensorflow imdb_review 数据集
- string - postgres pgjwt中的Concat导致错误
- r - igraph网络没有在R中添加属性
- postgresql - 您可以在 sequelize 中定义列并在 postgres 数据库中存储一段时间吗?
- c# - c# 是否可以在 c# 中更改对象类型?
- angular - 如何扩展具有可观察性的功能?
- c# - Azure - 仅检测到来自前端的 HTTP 服务器错误
- java - 如何使用 java sdk 在 Azure Blob 存储中上传单个视频文件的多个块?