javascript - 如果 Y.axis 相同,Highchart 不显示线条
问题描述
我的highchart仅在值不同时才显示数据线,如果值相同,如本例1100,它只显示1465数据,如一个点。如果数据以连续的方式具有相同的值,则问题出在 Y.axis 上。谢谢你。 高图的结果图像
$( document ).ready(function() {
var datacharts = ["1100","1100","1100","1100","1100","1100","1100","1100","1100","1100",1465,"1100"];
Highcharts.chart('container', {
chart: {
type: 'line',
height:500,
options3d: {
enabled: true,
alpha: 15,
beta: -10,
viewDistance: 180,
depth: 100
}
},
title: {
text: 'Personne 1'
},
xAxis: {
categories: ["mars","avril","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.","janv.","f\u00e9vr."],
labels: {
skew3d: true,
style: {
fontSize: '16px'
}
}
},
yAxis: {
allowDecimals: false,
min: 800,
color:'red',
title: {
text: 'Prime Par mois',
skew3d: true
}
},
plotOptions: {
column: {
stacking: 'normal',
depth: 40
}
},
series: [{
name: 'Data',
data: datacharts,
color: '#0e9bb7'
}]
});
});
</script>
解决方案
问题是您将数据作为字符串而不是数字传递。尝试这个:
var datacharts = [1100,1100,1100,1100,1100,1100,1100,1100,1100,1100,1465,1100];
在您的示例1465
中是唯一一个不是字符串的,因此它在图表上表示。
推荐阅读
- django - 如果从外部删除个人资料图片,如何将其恢复为“默认”?
- java - 使用 SharedPrefernces 对 RecyclerView 中的整数求和
- javascript - 是否可以在箭头函数中获取 this 以及全局 this?
- laravel-5 - 如何在 laravel 和两个模块中设置 Auth
- c++ - 在同一个 Visual Studio 项目中链接静态和动态库
- ios - 在 SwiftUI 中使用十六进制颜色
- flutter - 如何将 Stack 作为 CustomScrollView 的子项
- sql-server - 对每一行执行检查约束的所有情况
- python - 如何使用向导页面强制布局调整大小
- flutter - Flutter Sqlite Query Error 数据获取错误