score:1
Accepted answer
you need to add options object and indicate not to display the legend
var options = {
legend: {
display: false
}
};
then use the options in the constructor of your chart
var mychart = new chart(ctx, {
type: 'bar',
responsive: true,
/* include options in the constructor */
options: options,
... }
see sample below
documentation about options available are on their website: https://www.chartjs.org/docs/latest/getting-started/
var ctx = document.getelementbyid('chart').getcontext("2d");
// add options object - indicate not to display the legend
var options = {
legend: {
display: false
}
};
var mychart = new chart(ctx, {
type: 'bar',
responsive: true,
/* include options in the constructor */
options: options,
data: {
labels: ["test"],
datasets: [{
label: "sfarzoso",
fill: false,
bordercolor: '#000',
borderwidth: 2,
borderdash: [],
borderdashoffset: 0.0,
data: ["1"],
backgroundcolor: ["#fff5f7"]
}]
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.7.3/chart.min.js"></script>
<canvas id="chart"></canvas>
Source: stackoverflow.com
Related Query
- How to remove colored label square
- How to remove square label from tooltip and make its information in one line?
- chartjs: How to remove specific label
- Chart.js how to remove final label on chart
- How to remove a label in top of bar in chartjs chart
- How to remove only one specific dataset label chartJS?
- How can I move a label left, paint it black, or remove it (Chart.JS)?
- How to remove header square from chart.js?
- How to remove color label on tool tip?
- How to run Chart.js samples using source code
- How to add label square to Bar Chart using Chart.js
- How to remove strikethrough from label once click on legend
- How do I remove CSS code arriving in my webpage?
- Chart.js Bar Chart: How to remove space between the bars in v2.3?
- How to create two x-axes label using chart.js
- How to remove the line/rule of an axis in Chart.js?
- Chart.js2 Radar, how to configure the label padding/spacing?
- How to add label for ChartJs Legend
- How do I place a new line in a label with Chart.js?
- How to wrap X axis labels to multi-lines (X axis label formatting) in ng2-Charts?
- how to change background in chartjs and remove background lines?
- How to change the color of Chart.js points depending on the label
- how to always show label in chartjs without mouseover?
- How to remove gridlines and grid labels in Chartjs Radar?
- 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?
- Remove the label and show only value in tooltips of a bar chart
- How to have solid colored bars in angular-chart bar chart
- How to display only one label in a multi line char?
- How to remove rectangle box next to the legend text in Chart.js
More Query from same tag
- Switching between different Chart.js charts using the same canvas
- How to hide a portion of chart or a div in Angular?
- using data structures in chartjs
- Convert charts from vue-chartjs to a PDF
- trouble with making floating bar charts using chart.js
- Passing json_encode to chart.js won't work
- Unexpected behavior with chart.js
- How to configure Chartjs Bar Stacked Chart in Laravel 8
- Chart.JS using Angular.JS on JSFiddle
- Rails application using chart.js optins
- Chart.js Line-Chart with different Labels for each Dataset
- Chart.js - line chart with two yAxis: "TypeError: yScale is undefined"
- Display JSON data in chartjs
- ChartJS: line graph with labels on the y-axis
- Chart.js 2.0.0-beta2 disable points on line Charts
- Bootstrap > Extend ChartJS canvas horizontally to match overflowing columns
- How to generate chartjs charts to pdf using laravel?
- Using chart.js in HotTowel , Angular.js
- How to make money format in chart js in javascript
- React - render Chart.js chart based on user selection, after Ajax returns JSON
- Chart.js line chart with area range
- Charts.js line chart, how to hide y-axis start and end label if data is same
- Chart.js change Color of a Point during runtime
- Time series data visualization using JSON
- ChartJs won't appear in DIV in same page
- Change legend style from bar to line chart.js 2.4.0
- Change color of one value in the x-axis charts.js
- Different gridline steps on chart js line chart
- Hide x-axis when it has no value on chart.js
- Why must I create my VueJS application before using ChartJS?