Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 图表Y轴比例值错误_Javascript_Chart.js - Fatal编程技术网

Javascript 图表Y轴比例值错误

Javascript 图表Y轴比例值错误,javascript,chart.js,Javascript,Chart.js,我有一张图表,y轴刻度似乎是错误的 这是输入的数据 data: { labels: [1, 2, 3, 4, 5, 6], datasets: [ { label: '911', lineTension: 0, fill: false,

我有一张图表,y轴刻度似乎是错误的

这是输入的数据

data: {
        labels: [1, 2, 3, 4, 5, 6],
        datasets: [
                     {
                        label: '911',
                        lineTension: 0,
                        fill: false,
                        borderColor: '#4cfbb3', // (random) 
                        data: [ 10381, 11381, 19381, 19381, 2381 ]
                     }
                  ]
      }
图表:

如您所见,第1天的数据应分别在10k左右绘制,在图表上略高于6k。此外,最高值为19381,甚至有两次,图表显示最高值正好在12k

我不能精确地设置硬编码的刻度,因为这个数据刻度一直在变化。 以下是json的其余部分:

{
      type:'line',
      data:{
        labels:[],
        datasets:[]
      },
      options:{
        legend: {
          display: true,
          position: 'top',
          fontColor: 'white',
          fontSize: 20,
          labels: {
            fontColor: 'white',
            fontSize: 20
          }
        },
        responsive: true,
        scales: {
          yAxes: [{
            stacked: false,
            scaleLabel: {
              display: true,
              fontColor: 'white',
              fontSize: 25,
              labelString: 'Faction Points'
            },
            ticks: {
              fontColor: 'white',
              fontSize: 20,
              min: 0
            }
          }],
        xAxes: [{
          stacked: false,
          scaleLabel: {
            display: true,
            fontColor: 'white',
            fontSize: 25,
            labelString: 'Day'
          },
          ticks: {
            fontColor: 'white',
            fontSize: 20,
            min: 0
          }
        }]
        }
      }
    }

任何关于如何修复此问题的帮助都将不胜感激,谢谢

根据您的代码,我只添加了更改了
yAxis.gridLines
颜色,以便更好地显示不同点的确切位置。对我来说,这看起来不错。请同时发布您的CSS定义

yAxes: [{
  ...
  gridLines: {
    color: 'white'
  }
新图表(“曲线图”{
键入:“行”,
数据:{
标签:[1,2,3,4,5,6],
数据集:[{
标签:“911”,
线张力:0,
填充:假,
边框颜色:'#4cfbb3',/(随机)
数据:[103811138119381193812381]
}]
},
选项:{
图例:{
显示:对,
位置:'顶部',
fontColor:'白色',
尺寸:20,
标签:{
fontColor:'白色',
尺寸:20
}
},
回答:是的,
比例:{
雅克斯:[{
错,,
scaleLabel:{
显示:对,
fontColor:'白色',
尺寸:25,
标签字符串:“派系点数”
},
滴答声:{
fontColor:'白色',
尺寸:20,
最低:0
},
网格线:{
颜色:“白色”
}
}],
xAxes:[{
错,,
scaleLabel:{
显示:对,
fontColor:'白色',
尺寸:25,
标签串:“一天”
},
滴答声:{
fontColor:'白色',
尺寸:20,
最低:0
}        
}]
}
}
});
div{
背景色:黑色;
}