Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

chart js x axis start at 0

For Chart.js 2.*, the option for the scale to begin at zero is listed under the configuration options of the linear scale. This is used for numerical data, which should most probably be the case for your y-axis. So, you need to use this:

options: {
    scales: {
        yAxes: [{
            ticks: {
                beginAtZero: true
            }
        }]
    }
}
A sample line chart is also available here where the option is used for the y-axis. If your numerical data is on the x-axis, use xAxes instead of yAxes. Note that an array (and plural) is used for yAxes (or xAxes), because you may as well have multiple axes
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript remove empty object items 
Javascript :: lottie react 
Javascript :: how to check if a string is in a string js 
Javascript :: html string to object jquery 
Javascript :: jquery search for string in text 
Javascript :: how to run angular application in visual studio code 
Javascript :: jquery keep scroll position 
Javascript :: map to array javascript 
Javascript :: redux append to an array 
Javascript :: react native elevation 
Javascript :: jquery get all checkbox checked 
Javascript :: apk react native 
Javascript :: do you need a semicolon in javascript 
Javascript :: define array with custom index javascript 
Javascript :: Get React Native View width and height 
Javascript :: how to loop through date range in javascript 
Javascript :: react counter input 
Javascript :: javascript get last n characters of string 
Javascript :: ... unicode 
Javascript :: js shortcut 
Javascript :: javascript add function to onchange event 
Javascript :: javascript add days to date 
Javascript :: chartjs disable animation 
Javascript :: string to ascii code js 
Javascript :: express search query 
Javascript :: jquery value of input 
Javascript :: es6 remove first element of array 
Javascript :: html iframe and JS contentwindow 
Javascript :: javascript while 
Javascript :: how can we update time in react js 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =