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
- How would I include toBase64Image class using the fxcosta library for Chart.js
- PHP render stacked area chart of JSON dataset
- Chartjs : showLine depending on value
- Hovering over chart.js values in Meteor onRendered function causes chart axis shift
- Place two canvases side by side in a div
- Chart.js zeros handling
- Gantt Chart Timeline Chart js 3
- Error when changing data after migrating to vue-chartjs 4
- Cant assign data to ng2 piechart after receiving it in HTTP response
- Extjs with Devexpress ChartJS
- chart js download to png with canvas.toDataURL() not working in IE and firefox
- Chartjs and dynamic data arrays
- Chart.js: call method outside of onRefresh() method
- Bar chart (chart.js) with only 2 points does not show one of the bars
- In Chart.js, how do I hide certain axis labels from a stacked bar chart?
- TS how can I use a class variable inside method?
- How do I fix over limit y axis value in ChartJS
- How to add label in chart.js for polar chart area
- create a multi line chart using Chart.js
- Charts in wicket
- How to display Json object in chart js consisting of lists created using Django rest framework in angular application
- ChartJS Annotations display custom label
- Chart.js Line graph legend yields error: Uncaught TypeError: Cannot read property '0' of undefined
- How can I customize p:polarAreaChart tooltips?
- Accessing conditionally rendered canvas element in React for plotting
- Chart.js two columns on page - left column is squished until page resize
- how can i use inline plugin inner title for chart js?
- Calculating Bar Chart Percentage
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?
- Chart.js - tooltiptemplate with one decimal value in pie chart