score:0
Accepted answer
As described in the documentation (https://www.chartjs.org/docs/master/axes/#common-options-to-all-axes) you can set in the options of the scale the display to true or false or 'auto' where auto hides the scale if no dataset is visable that is linked to that axis.
For not showing data on hover you can set the tooltip to enabled: false
Example (y auto display and no x axis):
var options = {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1,
backgroundColor: 'red'
}, ]
},
options: {
plugins: {
tooltip: {
enabled: false
}
},
scales: {
y: {
display: 'auto'
},
x: {
display: false
}
}
}
}
var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
<canvas id="chartJSContainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.3.2/chart.js"></script>
</body>
Source: stackoverflow.com
Related Query
- How do I remove cartesian axes from chart js?
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- How to remove border from stacked column chart in Chartkick - Chart.js
- How to Remove axis Lines from chart in chart js
- How to remove all gridlines and ticks all lines in lines chart in javascript taken from cdn)
- ChartJs 2 How to remove numbers from the doughnut chart on loading
- How to remove the extra Y axis from a bar chart in chart.js
- How to remove the Legend of chart from angular Chart.js
- How can I remove the white border from Chart.js pie chart when all legends are hidden?
- how to remove old data from Chart js on mouse hover using mvc c#?
- How to clear a chart from a canvas so that hover events cannot be triggered?
- How to remove square label from tooltip and make its information in one line?
- How to prevent first/last bars from being cut off in a chart with time scale
- Chart.js Bar Chart - how to chart bars from 0
- How to add datas to chart js from javascript array itself?
- How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- Chart.js Radar Chart How to Remove Outer Labels
- impossible to remove scale from radar chart (chart.js)
- How can I trigger the hover mode from outside the chart with charts.js 2?
- How to start the line graph from the left Y axis in a line/bar mixed chart (Chart.js)?
- Chart.js – how to remove data entries from the tooltip?
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- In Stacked horizontal bar chart how to remove the vertical line in Chart.js?
- How to create chartjs chart with data from database C#
- How to remove background color and color example from tooltip in Chart.js?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Remove padding from chartJs horizontal bar chart
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- How to create Bar chart that gets updated from new ajax requests with ChartJS?
More Query from same tag
- charts js, doughnut chart not rendering tooptips correctly
- Chart.js - Same min and max value of two charts
- Gantt Chart Variation with Chart JS or other libraries
- Chart.js in AngularJS tabset does not render
- Chartjs - custom y axis range
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Uncaught Error: Can't resolve all parameters for Chart: (?, ?) in Ionic2
- Chartjs - Stacked bar chart data order causes invisible other values
- Align data label right. Horizontal bar chart Vue JS
- Load JSON to display data, using ng-repeat {ANGULAR.JS}
- Chart.js horizontalBar customization
- chartjs-node-canvas doughnut chart
- ChartJS Legend Not Lining Up
- Modifying values in a radar chart.js based on user input
- how to add a background that display "no data" on Canvas using ChartJS?
- How to populate multiple charts dynamically with Chart.js in Typescript
- Displaying the first value of the array in datasets.label Chartjs
- Doughnut Chart not displaying data with Chart Js and Backbone js
- Chart.js Plugin Not Recognized as Options Property in Angular
- How to get ChartJs object from dynamically created chart
- How can I create custom tooltips for each data point in a graph?
- ChartJS doesn't draw the chart
- How to unregister chartjs-plugin-labels globally?
- Chart.js: get chart data from canvas
- chart.js LIne Graphs: Fill area above line as opposed to below and to the right
- Chart.js beginAtZero doesn't work
- How to add a coloured legend box to a pie chart with Chart.js v1?
- How to get chart size (without labels) with chart.js?
- Modify the labels in chart.js when I update the chart
- How to install chartjs on laravel 6 via npm