score:0
Accepted answer
you can make the scale a linear scale and just provide the x and y as coordinates.
var options = {
type: 'bar',
data: {
datasets: [{
label: 'nice label',
data: [{
x: 10,
y: 5
}, {
x: 13,
y: 3
}, {
x: 20,
y: 8
}, {
x: 22,
y: 15
}],
backgroundcolor: 'pink'
}]
},
options: {
scales: {
x: {
type: 'linear',
ticks: {
maxtickslimit: 4
},
grid: {
display: false
}
},
y: {
grid: {
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.6.0/chart.js"></script>
</body>
Source: stackoverflow.com
Related Query
- Using chart.js for isotopic patterns
- X-axis multiple colored label for bar chart using chart.js
- Using Chart.js - Creating Legend for Doughnut Chart
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- Displaying line chart for multiple months using chart.js
- How to use set the color for each bar in a bar chart using chartjs?
- How do you set x and y axis and Title for a line chart using charts.js?
- chart js using for loop
- Using lodash to prepare data for "last day user registration" chart
- getting additional value fields from data source for dx.chartjs doughnut chart
- How to import a doughnut Chart using Chart JS for Blazor?
- 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
- Frontend and backend for chart using chartjs, mongodb, and controller
- Line chart plotting multiple points for duplicate data on x and y axis using chart.js
- Display ellipsis for null or empty values in the bar chart using Chart.js
- Displaying line chart for multiple datasets using chart.js
- subcategories for each bar in multibar chart using chartjs
- null values for instead of date causes the browser to crash while using chart js
- Using custom dataformat in chart.js for Multi Axis Line Chart
- How to run Chart.js samples using source code
- Angular 4: Different color for bar in bar chart dynamically using ChartJS
- Non-static values for chart using CanvasJS?
- Chart JS is using 1,2,3 as y values for my points for the second dataset instead of their passed in labels
- how to create bar chart with group and sam color for each group using chart.js?
- How to add text inside the doughnut chart using Chart.js?
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- Chart Js Change Label orientation on x-Axis for Line Charts
- Converting Chart.js canvas chart to image using .toDataUrl() results in blank image
- Chartjs random colors for each part of pie chart with data dynamically from database
- Moving vertical line when hovering over the chart using chart.js
More Query from same tag
- Having trouble fetching data from database for chart in ASP .NET Core
- ChartJS – Set baseline above zero
- Dynamic Chart Data
- How to get multiple elements on a page using flask (tables, pie charts, etc.)
- How can I show Bootstrap modal when on click in individual bars in chart.js
- How can I get the active label element on click in ChartJS?
- Chart.js Doughnut chart inner label different than outer
- Example: Doughnut | Error: Uncaught ReferenceError: Utils is not defined
- React ChartJS prevent new data from being added into state after it's redrawn?
- How to populate entire box inside a React chart (between two axes)
- Position tooltip based on mouse position
- ChartJS remove vertical grid lines one on two
- Chart Js - Limit points on graph without limiting data
- Adding text inside 2 different Doughuts chartjs
- Chart.js : Multiple colors for tooltipFontColor
- Chart.js with plotting durations against dates
- how to show bar graph on y axis in charjs
- How can I make line on chart thinner?
- Chart Js V2 draw Horizontal Bar(Average) Over Vertical Bar
- Angular 2 Chart.js and NG2-Charts Not Binding Data Objects After Updates To Project
- Chart.js random rgb background color generator not working
- problem with chart js pie chart dataset data
- How to set the data of chart in angular which is taken from the backend nodejs api that is store in mongodb and showing on the html page
- ChartJS: Mapping Non numeric Y and X
- Multiple charts in one page with chart.js
- Chart.js pie chart not showing
- Execute SQL prepared statement in AJAX
- "Maximum call stack size" Error When Adding Data to Chartjs Using Props With Fetch (Vue/Chartjs)
- Setting specific color per label in chart.js
- nodejs express jade mongodb project: how to import include chart.js