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
- Displaying multiple line graphs on one page
- Chart.js Vertically Aligned points on single x axis
- Why is the html page only displaying one of the charts?
- Add horizontal Line to my chart.js Barchart
- problem with multiple datasets in chart.js
- chartjs-plugin-annotation won't draw anything
- How to create a linechart with Chart.JS (not filled)
- How to use custom rendering methods of chartJs through ng2-charts angular?
- Changing color of specific ChartJS - AngularChartJS point
- core.js:4197 ERROR TypeError: chart_js__WEBPACK_IMPORTED_MODULE_2__ is not a constructor
- angular-chartjs line chart TypeError: t.merge is not a function
- How to display date instead of year in morris line chart in js
- ChartJS - Highlight grouped bars
- Set minimum step size in chart js
- Is there any way to change the font color and size of labels in Chartjs 3.0.0
- Chart.js doubles in size each time user scrolls to it
- How to generate PDF with Chart.js
- How to move a chart.js to the center
- Combining charting with the map
- Add options to Charts.js
- How to display Tooltip without hovering pie chart with Chart.JS
- Get hash value Rails / Chart JS / Google Chart
- How to add a horizontal line at a specific point in chart.js when hovering?
- Angularjs - Can't call the value from form to graph
- Saving columns from an SQL table into an array using Python
- Can I set different fill color based on a given threshold in Chart.js?
- Alter values of xAxis in chartjs
- Chartjs Bar Chart showing old data when hovering
- How to put arguments in a jchart.Chart class
- why tooltip appears wrong in my chart JS?