score:1
Accepted answer
you can set the ticks display to false like so:
options: {
scales: {
y: {
ticks: {
display: false
}
},
x: {
ticks: {
display: false
}
}
}
}
example:
var options = {
type: 'line',
data: {
labels: ["red", "blue", "yellow", "green", "purple", "orange"],
datasets: [{
label: '# of votes',
data: [12, 19, 3, 5, 2, 0],
borderwidth: 1,
backgroundcolor: ["red", "blue", "yellow", "green", "purple", "orange"]
},
{
label: '# of counts',
data: [1, 2, 3, 4, 5, 2],
borderwidth: 1,
backgroundcolor: ["red", "blue", "yellow", "green", "purple", "orange"]
}
]
},
options: {
scales: {
y: {
ticks: {
display: false
}
},
x: {
ticks: {
display: false
}
}
}
}
}
var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
const chart = new chart(ctx, options);
<body>
<canvas id="chartjscontainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/3.1.0/chart.js" integrity="sha512-llfvdzpyhqdasf4azfspmyhd6+wayvfjrwfjrbgki7/uh+txmlfyckmrim65+o3lfsfk20vrk9sjdute7buauw==" crossorigin="anonymous"></script>
</body>
score:0
if you have a label with ticks you can use
options: {
scales: {
y: {
ticks: {
display: false
},
scalelabel: {
display: false,
labelstring: 'yaxes scalelabel text'
}
},
x: {
ticks: {
display: false
},
scalelabel: {
display: false,
labelstring: 'xaxes scalelabel text'
}
}
}
}
Source: stackoverflow.com
Related Query
- Chart.js how to show line chart without displaying the labels on xaxis and yaxis
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How remove duplicates xAxis labels and show all values on chart
- How to show tick marks and labels with grid line for the specific one on the X axis with Chart.js?
- how to show X and Y labels on points in Chart js 2 Line Chart
- Chart.js how to show cursor pointer for labels & legends in line chart
- 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 show data values in top of bar chart and line chart in chart.js 3
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- How to change the label and grid line position on a timeseries chart in Chart.js 3?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- how can i use chart.js to create a chart that has one time series line and one linear line on it at the same time?
- How to show the chartjs bar chart data values labels as text?
- how to reduce list chart to one and use select dropdown to show selection without refresh page?
- how can i show labels and value in both on bar chart
- X and Y axis labels not displaying on line chart (Chart.js)
- How to plot a line chart which has both the start and points outside the canvas area using Chart.js
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- How to start the chart from specific time and offest hour and then show the data on chart from target datetime in chartjs
- how to show several labels and data's in the chart.js similar to npmtrend website?
- How to increase the spacing between labels and the chart
- chart js how do I only show just the low/high dots on line chart?
- How to configure chart.js line chart with very low minimum height, and only 0 and 1 (no decimals) as ticks on the y-axis
- How to show the data labels without hovering the mouse on the bubbles
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to display Line Chart dataset point labels with Chart.js?
- How to add second Y-axis for Bar and Line chart in Chart.js?
- chart js tooltip how to control the data that show
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
More Query from same tag
- convert csv to json for javascript plotting library chartjs in Python or PHP
- Chart.js Dropdown to select 1 day, yesterday and 7 days
- Position Label under the Horizontal Bar
- ChartJS: Adjust Tooltip with sums in body
- Emphasize a point in Chart.js
- Dynamically change type with react-chartjs-2 React
- Chart.js (v3) Doughnut with rounded edges, but not everywhere
- In Chart.js set chart title, name of x axis and y axis?
- Chart.js dynamically-created charts do not obey chart options
- Charts.js not using the right colors
- Chart.js combine two pieces of data into one bar
- How to make gap in chart.js graph?
- Chart.js timeline
- ChartJs does not render chart when binding canvas id in Angular
- ChartJS getting an unwanted line between first data point and last data point
- Create New Array from Existing Array Values With Unique and Sum
- Chart JS flicker when new data is added to chart (Vue)
- How to add data labels in each bar in stacked bar chart in chart.js?
- Change tooltips title at chart.js?
- How to create rounded bar graph with Angular 7 and Chartjs (v2)
- Char.js Interpolation linear
- Chart.js does not display any data
- How do I change the interpolator used in Chart.js?
- ChartJS Bar Chart not respecting disabled legend when using cdn
- How to use chart.js in angular
- Extension for chart.js 2.X
- Remove 0's (zeros) from x-axis of bar chart in Chart.js
- How to realize a discontinuous section (jumps) in a continuous line plot with Chart.js?
- charts.js chart size it's diferente than container setted size
- How to add label for ChartJs Legend