javascript - angular2-highchart 折线图在 y 轴上显示错误值
问题描述
我在 Angular 6 应用程序上使用angular2-highchart折线图,它在图表上按日期显示活跃用户。
这很简单,但我对 y 轴有疑问。右侧的值与线上显示的实际值完全不同。
chart: {
redraw: false,
zoomType: this.rangeEnabled ? 'x' : null,
type: 'spline',
alignTicks: false
},
title: {
text: this.title
},
plotOptions: {
spline: {
marker: {
symbol: 'circle'
}
},
series: {
compare: this.showByPercent ? 'percent' : 'value'
}
},
yAxis: {
// minRange: 3600 * 1000 // one hour
},
xAxis: {
// min: 0,
minRange: 1,
allowDecimals: false
// ceiling: 100
},
rangeSelector: {
enabled: this.rangeEnabled,
// selected: 2,
allButtonsEnabled: true,
buttons: [
{
type: 'week',
count: 1,
text: '1w'
},
{
type: 'month',
count: 1,
text: '1m'
},
{
type: 'month',
count: 3,
text: '3m'
},
{
type: 'year',
count: 1,
text: '1y'
},
{
type: 'all',
text: 'All'
}
]
},
navigator: {
enabled: this.navigatorEnabled,
adaptToUpdatedData: false
},
scrollbar: {
enabled: this.navigatorEnabled,
scrollbar: {
liveRedraw: false
}
},
tooltip: {
shared: true,
split: false,
xDateFormat: this.preciseTooltipDate ? undefined : '%A, %b %e, %Y'
},
legend: {
enabled: this.legendEnabled,
title: { text: 'Filters' },
// layout: 'vertical',
// align: 'bottom',
// verticalAlign: 'middle',
useHTML: true,
floating: false
},
exporting: {
// allowHTML: true,
buttons: {
contextButton: {
enabled: this.download,
symbol: 'download'
}
}
},
series: series
而series变量只是一个数据数组,其格式如下:
[date:number, value:number]
.
奇怪的是,对于某些数据集,它与预期值相差不远,而对于其他数据集则完全错误。
解决方案
推荐阅读
- java - Cucumber - 如何构建你的测试步骤?
- c# - 如何实现全局 WinAPI 覆盖接口
- html - 使用 Doxygen 内联显示图像
- visual-studio-code - 当窗格中的最后一个文件关闭时,防止 Visual Studio Code 更改窗口布局?
- php - php,如何作为类连接数据库,发送sql语句并返回结果
- node.js - 如何用 Sequelize 建立两个不直接相互依赖的表之间的关系?
- react-native - 如何在尴尬的 createStackNavigator 屏幕上居中标题文本?
- java - 为什么我的arraylist 只填充了一个元素?
- javascript - 使用 map 和 reduce 转换数组
- excel - 如果某个值在一列的每 10 个单元格中出现少于 3 次,则将这些值替换为另一个值