score:11
for chart.js version < 3.0:
from sanjay dutt's answer:
options:{
scales: {
yaxes : [{
ticks : {
max : 1,
min : -1
}
}]
}
}
for chart.js version >= 3.0:
due to breaking changes in version 3.x, the above mentioned answer doesn't work anymore. chart.js created a migration guide to solve the upcoming problems.
the minimum and maximum values can now be configured directly to the options.scales
:
options : {
scales : {
y : {
min: -1,
max: 1,
}
}
}
score:33
to fix min and max value for yaxes scale use the below code.
options:{
scales: {
yaxes : [{
ticks : {
max : 1,
min : -1
}
}]
}
}
suggestedmax will only works when incoming data is lower than suggestedmax value. suggestedmin will works only when incoming data is greater than suggestedmin value.
Source: stackoverflow.com
Related Query
- ChartJS: How to set fixed Y axis max and min
- How to set min max for x axis depend on data with Chartjs and Spring Boot?
- How to set max and min value for Y axis
- How to set max smaller than min in ChartJS
- How to set the xAxes min and max values of time cartesian chart in Chart.js
- chart.js how to force min and max y axis values
- How to set min Value a step down of min value received from database in Y Axis in ChartJS
- How to set only min and max values in y-axis (chart js)
- How to set ChartJS Y axis title?
- Chart.js timescale: set min and max on xAxes
- Hide min and max values from y Axis in Chart.js
- ng2-charts: How to set fixed range for y axis
- Chartjs: how to show only max and min values on y-axis
- ChartJS How to set max labels for X axis?
- Chartjs v2.5 - only show min and max on scale, absolute positioning on scale
- How do I force Chart.js axes min and max with react-chartjs-2?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Setting up min and max in chartjs did not work
- ChartJS automatically scaled chart has undefined min and max
- How to set y axis to the max dataset value in Chartjs?
- How to set ChartJS Axis label with PrimeFaces
- How to take a set of Date objects and display the frequency based on time of day using ChartJS
- How to set and adjust plots with equal axis aspect ratios - CHART.js
- How do you set x and y axis and Title for a line chart using charts.js?
- How to set 3 axis in google chart (V-Axis Left as Qty, V-Axis Right as Series Column and H-Axis as TimeOrder)?
- Chartjs gradient background color based on min and max values
- How can i add min and max range horizontal line in angular-chart.js
- Boxplot chartjs make min and max dynamic by leaving some space on both side
- Chart.JS - Set fixed X and Y axis values in time chart?
- How to set same borderColor and backgroundColor in chartjs javascript
More Query from same tag
- JavaScript & HTML - reusing data from fetch()
- How to show tooltip on legend item in chart.js
- Set fix values on y-axis vue-chartjs
- How to remove all gridlines and ticks all lines in lines chart in javascript taken from cdn)
- Angular-charts/Chart.js is not working
- ChartJS tooltip issue
- Multiple add in multiple sql request?
- how to add a background that display "no data" on Canvas using ChartJS?
- angular-chart chart-line not working
- Align lines and bars in a mixed chart
- Chart.js x-axes not working?
- ChartJS 3.7.1 tooltip callback, get label value for the next index
- ChartJS - Line chart issue with only 1 point
- ChartJS in React throws 'too may re-renders'
- 【React chart.js】How to add multiple data to Radar chart using map function
- How can I ensure that my charts diagram load every time I choose it from my dropdown?
- how do i use the numbers i key in from a form as the input data for chartjs
- vue-chartjs reactive data error
- Chart.js line chart with correctly spaced x labels
- Change color of measure unit with Chart.js
- Why do Bar Pie Chart values not line up?
- Getting dynamic data for chart.js from Django model
- How do you insert a linear horizontal line in chart.js
- Chart js data to start at zero
- Dynamically created linechart holds previous data value
- ChartJs how can I move bar into new group?
- Wrong chart.js points get highlighted on hover
- Calculate the average distance between two data sets of X and Y (in JS)
- Chart.js chart won't animate inside of bootstrap carousel
- How to include adapters and plugins with ChartJS