Chart.js plug-in generates a line chart when data is generally large when y-axis data is not starting from 0 solution, original: http://bubuko.com/infodetail-328671.html
By default, such as
The y-axis is not starting from 0, so the amplitude of the discounted graph will be very large, not the normal amplitude, the solution is as follows,
Example code:
Window.onload = function () { var ctx = document.getElementById ("Canvas"). GetContext ("2d"); Window.myline = new Chart (CTX). Line (Linechartdata, { scaleoverride:true, //whether to rewrite y-axis gridlines scalesteps:15 with hard coding , number of//y axis ticks scalestepwidth:300, //y axis each scale width scalestartvalue:0, //y axis start value pointdot:true, //Whether the point is displayed pointdotradius:5, //radius of the pointdotstrokewidth:1,//point of the line width datasetstrokewidth:3,//Line width of the data line Animation:true,// whether there are animation effects animationsteps:60 //animation Steps });
Core code:
Scaleoverride:true,// whether to rewrite the y-axis grid line scalesteps:15 with hard coding, the number of//y axis ticks scalestepwidth:300, // Y-Axis The width of each scale scalestartvalue:0, the starting value of the//y axis
This will give you the following effect, the y-axis starting from 0
Http://bubuko.com/analysis-201408.html
Chart.js plug-in generates a line chart when data is generally large when the y-axis data is not starting from 0 solution [bubuko.com]