score:16
Accepted answer
in your case, you can set stepsize
property to 1
for y-axis ticks, to change the y-axis values from float number to integer.
options: {
scales: {
yaxes: [{
ticks: {
stepsize: 1
}
}]
},
...
}
ᴅᴇᴍᴏ
var chart = new chart(ctx, {
type: 'line',
data: {
labels: ['jan', 'feb', 'mar', 'apr'],
datasets: [{
label: '# of votes',
data: [1, 2, 3, 4]
}]
},
options: {
scales: {
yaxes: [{
ticks: {
stepsize: 1
}
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.6.0/chart.min.js"></script>
<canvas id="ctx"></canvas>
score:7
try this:
window.onload = function() {
var chartel = document.getelementbyid("chart");
window.myline = new chart(chartel, {
type: 'line',
data: linechartdata,
options: {
title:{
display:true,
text:'kindmate - chart static donate'
},
tooltips: {
enabled: true,
mode: 'index',
position: 'nearest',
custom: customtooltips
},
scales: {
yaxes: [{
ticks: {
beginatzero: true,
callback: function(value) {if (value % 1 === 0) {return value;}}
}
}]
}
}
});
Source: stackoverflow.com
Related Query
- how to change the Y-axis values from float number to integer in chartjs?
- How to change the Y-axis values from numbers to strings in Chart.js?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- How to Change the Y axis of an Primefaces 7.0 ChartJS Linechart with Java?
- Chartjs - How to update the data from values in my database?
- In chart.js how can I change the x axis on my line \chart from January-December to October-September? Basically, fiscal year instead of calendar year
- Change the Y-axis values from real numbers to integers in Chart.js
- How to change the color of legend in chartjs and be able to add one more legend?
- How do I change the 'months' language displayed on the date axis in Chart JS?
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- Chartjs change the specific label color in x axis in callback function
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?
- How to start the line graph from the left Y axis in a line/bar mixed chart (Chart.js)?
- How to Change the Label Strike-Through with light gray on a ChartJS Doughnut?
- how can i send a list of numbers from views.py to a chartjs file im using for the front?
- How can I add a unit to the end of my Y Axis values in ChartJS?
- Chartjs - how to change the notation of doughnut chart
- How to reduce the number of points shown on line chartjs chart with a large dataset?
- How can I change the cursor on pie chart segment hover in ChartJS 3?
- In ChartJS how do I change the color of a label in the legend?
- How to show the chartjs bar chart data values labels as text?
- how to display last x float number value in chartjs
- Chartjs is graphing my values at positions 0,1,2 rather than their values along the x axis
- How to change the z-index of chartjs annotations label?
- How to change position from absolute to relative in charts in ChartJS
- How to change the color of y axis labels in different color in Chart.js
- chartjs how to update dynamically data from database(Chartjs cant get the data)
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- how to manipulate with the y-axis values in chartjs
- ChartJs 2 How to remove numbers from the doughnut chart on loading
More Query from same tag
- Django ValueError The view todo_lists.views.visualisation didn't return an HttpResponse object. It returned None instead
- Cannot find centroid of path
- Draw asynchronous information on a graph with VueJS
- Chart.js zoom shows decimal points
- Remove the vertical line in the chart js line chart
- How to add a custom event on legend click
- chart.js remove lower grid from mixed chart
- In chartjs format of ticks
- Using unknown number of datasets in Chart.js
- Lograthmic yaxsis setting not working in chartjs
- How to display multiple y axis titles on seperate lines and rotated 90 degrees clockwise in chart.js
- Full width bars in Chart.js version 2.7.2
- Chartjs Overlap click function doesnt work
- Chart.js multiple datasets on one y axis
- Create chart in SPA(Aurelia) with MVVM pattern
- load external json data file in to chartjs in the angular component
- Chart JS - Grid colors and gradient fill not showing
- Weird time formating with chart.js and moment.js
- chart.js with JSON Data on Same page not displaying
- how can i send a list of numbers from views.py to a chartjs file im using for the front?
- Chart.js Radar Not Displaying Data Values
- Line is rendering only vertical line instead of sloped line
- How to use an Aurelia JSPM plugin with WebPack
- How to display value after the bar using chart.js
- ERROR TypeError: "this.canvas is undefined" | Problem with creating a chart with angular and chart.js
- How to make bar charts and scatter dots appear underneath each other?
- Manipulate chart.js based plots in R (radarchart)
- Make y-axis sticky when having horizontal scroll on chartJS and Angular
- Chart.js letter spacing very awkward
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?