score:8
Accepted answer
The label
should be inside datasets
such as
type: 'horizontalBar',
data: {
labels: [data1, data2],
datasets: [{
label: 'put it here', // => here
backgroundColor: ['rgb(240,61,74)', 'rgb(0, 156, 255)'],
data: [data1.count, data2.count],
}]
},
so you won't get undefined
Updated:
if you don't want to see it, put legend
configuration inside the options
. Apparently, I saw that your legend
is outside options
object.
options: {
legend: {
display: false
}
}
score:14
Note, the accepted answer is outdated for 3.x. To remove the legend you now have to specify the plugin. https://www.chartjs.org/docs/latest/configuration/legend.html
eg
var chart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
plugins: {
legend: {
display: false
}
}
}
});
Source: stackoverflow.com
Related Query
- Remove the label and show only value in tooltips of a bar chart
- Remove label from line chart - react-chartjs-2
- Chart.js how to remove final label on chart
- How to remove a label in top of bar in chartjs chart
- 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
- remove undefined label in the upper part of a chart
- Chart Js Change Label orientation on x-Axis for Line Charts
- Remove the vertical line in the chart js line chart
- How to remove square label from tooltip and make its information in one line?
- ChartJS - Draw chart with label by month, data by day
- Chart Js change text label orientation on Ox axis
- chart.js scatter chart - displaying label specific to point in tooltip
- show label in tooltip but not in x axis for chartjs line chart
- Chart.js bar chart : Grid color and hide label
- Chart JS show multiple data points for the same label
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- Adding a label to a doughnut chart in Chart.js shows all values in each chart
- Angular Chart JS prevent x label causing overflow
- chartjs: How to remove specific label
- Chart.js Radar Chart How to Remove Outer Labels
- PrimeNg bar chart how to show a label for the y-axis
- chart js - Apply different color for each x-axes label
- X-axis multiple colored label for bar chart using chart.js
- Chart.js line chart tooltip shows wrong label when line doesn't start at first label
- impossible to remove scale from radar chart (chart.js)
- Chart.js Radar chart legend label font size doesn't work
- Remove radar chart labels in chart.js
- chart.js bar chart x-axis label disappeared
- Handle X-axis label position in chart js
More Query from same tag
- charts.js - custom event using tooltip data (line chart)
- Angular 6 ChartJS create canvas dynamically and create graph on it - an example?
- How to grouping Label In Char JS
- Problems trying to render some data on chartjs
- chart.js with null data point in dataset
- How to get the actual chart width and height in chart.js
- TypeError: this.scale undefinded when using Chart.js and Angularjs
- Chart js legend are being cut off if the bar height is equal to port height - chart js
- Change label color over a specific value in Chart.js
- Add line from point to x-axis and bold label of him
- Import Financial chartjs
- Re-compile JSON data to make less rows
- How to update a react-chartjs-2 plot using useState()
- chartjs push array to label not working
- setInterval on my Doughnut.js
- Replace chartjs data
- Horizontal overlapping of bars, not whole graph
- charts.js stacked bar with polymer's wrapper chart-elements
- Chart.js how to remove final label on chart
- "Inline" labels in ChartJS
- Chart.js awkward label gaps before last x-axis label
- Syntax error : Cannot use import statement outside a module in Vue2 chart js
- how to set the color of all points in a line graph to the same in chart.js?
- Chart.js BarChart not appearing
- Make x label horizontal in ChartJS
- Hide Y-axis labels when data is not displayed in Chart.js
- how to manipulate with the y-axis values in chartjs
- Can't display proper time on chart.js timeline
- polymer, using attribute data binding in the constructor functions
- how to access array inside object without keys