score:13
Accepted answer
For this you can make use of the ticks.userCallback
in the scales.xAxes
option so that you return a formatted date for each xaxis tick. If you are using the bundle version chartjs comes with momentjs which makes it really easy but if you are just passing timestamps in milliseconds you can do whatever you want to the label.
options: {
scales: {
xAxes: [{
ticks: {
userCallback: function(label, index, labels) {
return moment(label).format("DD/MM/YY");
}
}
]}
}
}
score:3
version 3.4 you can do it something like this:
options: {
scales: {
x: {
ticks: {
// Include a dollar sign in the ticks
callback: function(value, index, values) {
return '$' + value;
}
}
}
}
}
Source: stackoverflow.com
Related Query
- Modifying the X-Axis Labels of a Scatterplot in Chart.js 2
- chart.js: How do I make the radar chart axis labels bigger?
- Modifying the X-Axis Labels of a Bar chart in Chart.js 2
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- Aligning zero on y axis to the labels on x axis of line chart in chartjs
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- Making the labels responsive in chart js
- Using Chart.js - The X axis labels are not all showing
- How do I change the 'months' language displayed on the date axis in 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 display the labels in doughnut chart using ng2 charts?
- ChartJS: Show all labels of a mixed chart in the tooltip
- Chart Js, Style some ticks on the axis differently
- How to start the line graph from the left Y axis in a line/bar mixed chart (Chart.js)?
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- Chartjs 3.5.0 - Radar Chart - Converting the labels to images
- ChartJS: Remove padding to the right of chart caused by tick labels
- Chartjs: Is it possible to hide the data labels on the axis but show up on the graph on hover?
- Modify the labels in chart.js when I update the chart
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- Pie chart isn't loading, but the labels are
- 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
- Tilting the labels of the x axis to some degrees in chart.js
- Chartjs React Typescript moving x axis labels above chart
- Inverting X axis number labels in chart.js scatter chart
- How to show tooltip value of all data falling on the same axis in chart js?
More Query from same tag
- Animate Chartist on show
- Refresh chart.config.data
- How to show dynamic dates with month name of current month and previous month in momentjs?
- Dashed line for missing data in Chart.JS (spanGaps style)
- On hover bar is overlapped by label chartjs
- Re-creating this graph in ChartJS
- Chart.js - Bar chart with linear cartesian (numerical) X axis?
- chart.js Doughnut anticlockwise animation
- How to remove x axis scale labels Chart.Js
- Update charts in chartjs and angular
- How we can draw a circle in bar chart
- How to implement concentric doughnut charts in polymer 1.0 using Chart.js?
- Load ChartJS via VueJS - ChartJS empty and 0px dimension
- add labels dynamically in Charts.js
- How to handle data API from Django Rest Framework in Chart.js
- Chart.js V2: Add prefix or suffix to tooltip label
- Replace a Canvas Pie Chart Onclick
- How to create a histogram in charts.js with MYSQL data
- Why can't I create monthly sales report with Chart.js in Codeigniter
- Canvas not working in jQuery Mobile
- Set Y axis at the top of each bar using Chart.js library
- How to change font size, padding of chart title only, in chart.js 3.x
- ChartJS showing incorrect data on the X-Axes
- can't dispal 2 garphs on chart.js
- How to access global variable from outside of canvas.onmousemove function?
- Angular Charts - not able to read data
- ChartJs x axis labels on waterfall chart
- Chart.js - How to place text outside of radar chart
- Chartjs pie chart not showing from dynamic data
- increasing php variable in javascript loop