score:57
Accepted answer
In the ticks
object you can pass a callback
that will be given the label it is about to show. From here you just return a string you wish to display in place of the label.
chart.js-V2.X fiddle exampe chart.js-V3.X fiddle exampe
ticks: {
min: 0,
max: 5,
stepSize: 1,
suggestedMin: 0.5,
suggestedMax: 5.5,
callback: function(label, index, labels) {
switch (label) {
case 0:
return 'ZERO';
case 1:
return 'ONE';
case 2:
return 'TWO';
case 3:
return 'THREE';
case 4:
return 'FOUR';
case 5:
return 'FIVE';
}
}
}
Source: stackoverflow.com
Related Query
- How do I customize y-axis labels on a Chart.js line chart?
- Chart.js how to show cursor pointer for labels & legends in line chart
- How to display Line Chart dataset point labels with Chart.js?
- Changing x axis labels in Chart.js line chart
- Line chart with large number of labels on X axis
- How to align Chart.JS line chart labels to the center
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How to start the line graph from the left Y axis in a line/bar mixed chart (Chart.js)?
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- how to minimize x axis labels to day hours in chart js
- chart.js: How do I make the radar chart axis labels bigger?
- How to change background color of labels in line chart from chart.js?
- Chart.js - how to make proportional intervals on X axis on line chart
- How do you set x and y axis and Title for a line chart using charts.js?
- How to use chart.js to plot line chart with x axis as time stamp in seconds
- How to change text colour of specific labels of axis in Chart JS?
- X and Y axis labels not displaying on line chart (Chart.js)
- ng2 scatter chart how to put labels in x axis
- Chart.js how to show line chart without displaying the labels on xaxis and yaxis
- How to show tick marks and labels with grid line for the specific one on the X axis with Chart.js?
- How to start Y Axis Line at 0 from right for negative values in chart js 2?
- How to Add X axis Padding in chart js Line Graph
- Aligning zero on y axis to the labels on x axis of line chart in chartjs
- how to show X and Y labels on points in Chart js 2 Line Chart
- How to customize Data Labels of area chart on ChartJS?
- how to add multi X axis custom line in chart js
- Limit labels number on Chart.js line chart
- Chart.js - How to set a line chart dataset as disabled on load
- How to hide y axis line in ChartJs?
More Query from same tag
- Multiple axis line chart with Chart.js and JSON data from Google Sheet
- How to paint specific area of chartJs?
- Dynamic chart codeigniter
- Update the Chartjs push data with ajax
- How can i hide label data on chart.js tooltip content?
- Chart.js: Change lengend colors to array
- How to set additional options for Chart.js BarCharts using React-Chartkick
- how to use vuechartkick in nuxt js
- How to show lables just outside the the doughnut chart in Chartjs?
- Chart.js Line Graph: Start a line in the middle of a graph
- Modify the x-axis label in chart js
- How to drill down charts with ChartJS?
- How to get Data from API to display chart using chartjs in Vuejs
- How do I remove left-hand numeric values in Bar Chartjs?
- DevExtreme Exporter prints blank page
- How can I hide legend text if it's zero?
- Add different labels in a line chart - Chart.js
- ChartJS ignoring TailwindCSS styling
- I am trying to use the Chartjs-plugin-watermark but it is not working
- JavaScript Error - Uncaught SyntaxError: Unexpected token {
- Looping through json array properties
- How to Import Angular Chart in IONIC
- How to create a custom tooltip for chartJS graph with data in JSON array in JavaScript?
- Single point on multiple line linear graph with Chart.js
- I have a setInterval function that graphs.
- How to add a Date Selector to Chartjs in the context of Vue.js
- Chartjs how to show scale label horizontally
- React render function preventing creating new canvas element on each time invoked - Charts.js
- How to load Json data onto a Charts.js chart
- Flask Socketio | Update and plot a chart using background tasks created by Flask Executor or ThreadPoolExecutor