score:0
the x and y should not be arrays but objects, also the scaleLabel
prop is called title
now. For all the changes please read the migration guide (https://www.chartjs.org/docs/master/getting-started/v3-migration.html)
Example:
var options = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderColor: 'pink'
}]
},
options: {
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'yAxis'
}
},
x: {
title: {
display: true,
text: 'xAxis'
}
}
}
}
}
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.4.1/chart.js"></script>
</body>
Source: stackoverflow.com
Related Query
- How do you set x and y axis and Title for a line chart using charts.js?
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- Line chart plotting multiple points for duplicate data on x and y axis using chart.js
- How to set max and min value for Y axis
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to add second Y-axis for Bar and Line chart in Chart.js?
- how to set chart.js grid color for line chart
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- How to use set the color for each bar in a bar chart using chartjs?
- How to set min max for x axis depend on data with Chartjs and Spring Boot?
- How to set 3 axis in google chart (V-Axis Left as Qty, V-Axis Right as Series Column and H-Axis as TimeOrder)?
- How do you set up a chart.js scatter line chart through angular-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 tick marks and labels with grid line for the specific one on the X axis with Chart.js?
- How to start Y Axis Line at 0 from right for negative values in chart js 2?
- 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
- how to draw Line chart using chart.js and datalabels should be shown
- Chart.js 3.6.2, Angular 10: Logarithmic Line chart Y-Axis problems. How to set and keep Y-Axis properties, even when data changes?
- How to achieve a mixed chart of 'horizontal' bars and line chart using Chart.js?
- The dataset for bar graph is not set properly using ng2 charts and ng5-slider in Angular
- Using custom dataformat in chart.js for Multi Axis Line Chart
- How to add vertical line in bar chart using chartJs and ng2-charts?
- how to create bar chart with group and sam color for each group using chart.js?
- In Chart.js set chart title, name of x axis and y axis?
- Chart.js - How to set a line chart dataset as disabled on load
- Chart Js Change Label orientation on x-Axis for Line Charts
- ChartJS: How to set fixed Y axis max and min
- How to add an on click event to my Line chart using Chart.js
- Chart.js how to show cursor pointer for labels & legends in line chart
- How do you hide the title of a chart tooltip?
More Query from same tag
- Line formatting in Chart.js for vertical steps
- Chart.JS Display 5 largest values in the legend
- Displaying JSON data with Chartjs
- How to use PrimeNg Chart of Width and Height?
- chart.js Radar shows 0 when value is 12
- how to set title in legend of chart.js?
- Chartjs create chart with big data and fixed labels
- Chart.js - annotation Vertical line moves with mouse in Angular 6
- Chart.JS Not Formatting Y-Axis-1 Properly
- Using data saved as a variable in HTML from Python
- Chart.js - Adding Legend in a JSP Page
- ChartJS disable gridlines outside chart area
- Add Text to Doughnut Chart - ChartJS
- Charts not showing in wicked pdf
- How to use JSON data in creating a chart with chartjs?
- Radar charts for chartjs always stay filled
- Two charts using same options, but I need different titles for the charts
- ChartJS Email HTTP Request API
- Chart.js won't draw the line on chart line
- How to make a chart with chartjs and Angular?
- How to make fixed width of column without ticks.min/max in chart.js?
- how to use chart.js in angular 7
- how to fix this error Array to string conversion in laravel and chartjs?
- ChartJS - Highlight Weekends and Lowest and Highest Values
- Issue with HTML2Canvas - Green overlay while exporting
- Chart JS add max value to legend
- Grouped bar charts with intersecting ticks
- chart.js labels text font size and digits text font size too small
- Does iFrame have any events suitable for when a JavaScript & HTML page are embedded in modal(Bootstrap)
- graph (chartjs.org) does not stretch properly when sidebar(menu) is collapsed