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
- How to get access to Chart instance related to current tooltip callback in Chart.js
- Getting (X,Y) point on mouse click on chart
- Chart.js add direction arrows to the X and Y axes
- Chart.js Treemap Adding custom text to each rectangle
- How to get x-axis value in chart as string?
- ng2 charts bar chart need spacing between 2 bars in series Angular
- Linear x axis for bar chart chartjs
- ChartJS not working in Vue
- Is it possible to combine multiple charts in one canvas in chartjs?
- Chartjs - Donut Chart label for small values not visible
- Border radius for the bar chart in ChartJS
- live charts using chart.js
- Have the time on x axes to show the last 24 hours from current time
- chartjs-plugin-annotation box in Django app
- Chart.js unable to create chart
- date and time chart With Chart js
- ChartJS Annotation Hide /Show
- chart.js sum of the last 3h datavalues in a line chart
- How do I resolve this error; 'document.getElementById('myChart').getContext' is undefined)?
- How to feed hour and minute data into chartJS
- Update angular-chart.js on filtered list
- Uncaught type error: mychart.update is not a function
- Highlight a particular point in chart JS
- Custom tooltip callback on one dataset (chartjs v 2.5)
- (Laravel) How to pull data from API Controller so that it will display in vue-chartjs
- How to control visibility of canvas image via button outside the canvas(ChartJs)?
- ChartJs resizing when parent div is resized
- Connect the dot vertically instead of horizontally on Line Chart
- Values on Y-axis disappear (hide under labels)
- Chart js scatter - display label on hover