score:2
I haven't seen that done before. But I can see a possible alternative solution.
You can use the chartjs datalabels plugin, which allows you to put labels on the data itself.
Here is an example: https://chartjs-plugin-datalabels.netlify.com/samples/charts/bar.html with the source code here: https://github.com/chartjs/chartjs-plugin-datalabels/blob/master/samples/charts/bar.html
First you'll have to install the datalabels plugin, and add the datalabels parameter to your data.
score:0
Stumbled upon this with the same issue and came to the following much less attractive option but simpler than going to a d3js solution (such as posted here: d3 based multiple sub groups of a bar chart). Note this solution probably only works to one level of subgroups before it gets unwieldy if not impossible:
- create separate charts for each category and then set their y-axes to be the same.
Depending on how you want it to look, it is possible to turn off the y-axes for a subset of the charts and leave zero spacing which could give a similar look as desired.
score:0
You have to use chartjs-plugin-datalabels plugin. Using this plugin you can give label to each bar of the chart. Please have a look at the given example. Hope this will help.
data: {
labels: labels,
datasets: [{
datalabels: {
labels: {
name: {
align: 'top',
font: {size: 16},
formatter: function(value, ctx) {
return "name"
}
},
value: {
align: 'bottom',
formatter: function(value, ctx) {
return value;
},
padding: 4
}
}
}
}]
}
Source: stackoverflow.com
Related Query
- Chart JS grouped sub labels
- Limit labels number on Chart.js line chart
- Chart.js Show labels on Pie chart
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- chart.js: Show labels outside pie chart
- Chart.js how to show cursor pointer for labels & legends in line chart
- Chart JS data labels getting cut
- How to display Line Chart dataset point labels with Chart.js?
- ChartJS add tooltip to a grouped bar chart
- Making the labels responsive in chart js
- Hide empty bars in Grouped Stacked Bar Chart - chart.js
- Chart.js - Draw bar chart with multiple labels
- Display a limited number of labels only on X-Axis of Line Chart using Chart.js
- Changing x axis labels in Chart.js line chart
- How to display data labels outside in pie chart with lines in ionic
- Line chart with large number of labels on X axis
- Center point labels between ticks (Polar Area Chart JS)
- How to align Chart.JS line chart labels to the center
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- Creating a grouped and stacked chart in Chart.js
- How to display the labels in doughnut chart using ng2 charts?
- Chart.js Bubble chart with custome X-axis labels
- Change labels colors for radar chart js
- ChartJS: Show all labels of a mixed chart in the tooltip
- Chart.js Radar Chart How to Remove Outer Labels
- ChartJS 2.0 - Huddle labels on pie chart
- Multiple line labels for chart js
- Remove radar chart labels in chart.js
- Chart JS: Ignoring x values and putting point data on first available labels
- Show labels on each sector to polar chart using angular js chart
More Query from same tag
- How to connect a charts.js chart to data
- ChartJS - Graphic with multiple values on the same date
- ChartJS fails to render one of the lines in cartesian chart following update after change to max Y axis label value
- How to remove some points in chartjs
- Pushing data from angular typescript to chart.js library complication
- Prevent size of canvas chart js to equal window height and width
- Is it possible to print a chart with vue-chartjs?
- chartjs - canvas size error
- Chart.JS does not render and display a sad face icon
- how to format date string for x axis labels in chartjs?
- ChartJS2 in Ionic2
- Horizontal line content is overlapping with axes : Chart.js
- Chartkick column_chart different colors not working
- ERROR TypeError: Cannot read properties of undefined (reading 'skip') Typescript/Api
- vue-chartjs v4 reference to the chart object
- update chart in chart js without reloading the page
- Chart.js - how to add a second data line to the line graph
- Trying to call API and plot a line chart but it does not show
- How to edit my custom tooltips in my line chart using chart.js?
- pass array variable to chart.js options
- chart.js v2: Align time scale labels with the center of the bars
- Chart.js error: type lacks a call signature '((...items: number[]) => number) | ((...items: ChartPoint[]) => number)' in Angular
- ChartJS x-axis show only months of year
- how to customize tool tip while mouse go over bars on Chart js bar chart
- Reduce spacing between bars in horizontal bar chart (chart.js)
- In chartjs format of ticks
- Visualizing iris dataset
- Cannot get react-chartjs options to take effect
- How can i get the Chart JS Bar Graph Bar Label and Value on click?
- Prevent chart.js "jumping"