score:5
Accepted answer
You're using version 0.2.0
. Works fine if you use the version in the demo (2.4.0
) or the newest version (2.6.0
). The CDN link for that is https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js
<html>
<head>
<meta charset="utf-8" />
<title>Chart.js demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
</head>
<body>
<h1>Chart.js Sample</h1>
<canvas id="myChart" width="600" height="400"></canvas>
<script>
var ctx = document.getElementById("myChart").getContext("2d");
var chart = new Chart(ctx, {
// The type of chart we want to create
type: "line",
// The data for our dataset
data: {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
backgroundColor: "rgb(255, 99, 132)",
borderColor: "rgb(255, 99, 132)",
data: [0, 10, 5, 2, 20, 30, 45]
}
]
},
// Configuration options go here
options: {
responsive:false,
maintainAspectRatio: false
}
});
</script>
</body>
</html>
Source: stackoverflow.com
Related Query
- chartjs + Angular6 is not showing charts or any error
- Charts js not showing
- Charts not showing in wicked pdf
- ng2-charts not showing charts in Angular 10
- Charts not showing on ASP.NET MVC page
- Pie Chart using chart.js not showing up but bar charts are?
- Mixed chart not showing both charts simultaneously chart.js
- Colors not showing up on charts in ionic 3
- Angular charts not working with Angular 5, Showing below error attached screen shot
- how to not repeat code while creating multiple charts in chart js
- Chartjs is not showing charts in my Django project
- ChartJs title not showing
- Bootstrap 3 tabs & Chart.js - charts not loading on tabs
- Chart.js v2 charts do not display inside angular 2 (but Chart.js v1 works perfectly)
- Using Chart.js - The X axis labels are not all showing
- Chart.js ng2-charts colors in pie chart not showing
- Chart.JS Mixed Chart - Bars Not Showing
- Bootstrap modal showing when clicking individual points in Linechart but not in individual bars in Barchart
- Chart.js not showing legends
- ChartJS bar not showing up for simple data points
- Series Details Not Showing in Angular Chart with Charts.js
- Last value not showing in bar graph of charts.js-library
- Charts js only showing 2 data points on sparkline
- Multiple charts on same page not working - ng2-charts
- Chart.js pie chart not showing in Google Chrome canvas
- Chartjs Graph is not showing in colorbox
- Chartjs bar dataset label not showing
- ChartJS charts not generating within tabs
- ChartJS / MomentJS - Unable to remove deprecation warning. Graph not showing in firefox/opera
- Chart JS custom tooltip not showing
More Query from same tag
- Tooltip backgroundColor depending on chart color ChartJS
- Multiple lines / data series from JSON file with Chart.js
- Smallest values are invisible in ng2-charts bar charts
- How do you label points in a scatterChart built using ng2-chart
- ChartJS - Uncaught SyntaxError: Unexpected number
- Tooltip overriding the text in chart js
- chartJS - points overplotting, jittering, noise?
- How to set additional options for Chart.js BarCharts using React-Chartkick
- Chart.js. Edit bar width -v2.5-
- Chart.js isn't able to read elements from php as label
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- Cannot get Chart.js working
- Where is the documention for the chart.js Chart constructor?
- Can't change labels' font color. Chartkick Ruby on rails
- Unable to update state in ReactJS
- How can I make lines fully connected in a multi-line chart even when one dataset is more sparse than another?
- Vue ChartKick Donut custom cutoutPercentage
- Chart.js ignoring canvas height & width
- Chart.js: changing tooltip template
- How can I display desired/particular chart in App.vue from Charts.vue which contains different charts in Vuejs
- Chart is not rendering properly time axis
- canvas does not display proper width and height chart.js
- Access data arrays from c# method inside JavaScript inside .cshtml file
- X and Y axis labels not displaying on line chart (Chart.js)
- Primevue Chart not rendered
- How to show the chartjs bar chart data values labels as text?
- Specific grid line in X axis in ChartJs
- How can i change the every legend label font color using chart.js version 2.8.0 (spacial line chart)?
- Combine multiple columns values to one label in chart.js
- How to give link for lable/Legend in chart.js? and if the value is 0 how to remove the legend?