Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <canvas id="myChart"></canvas>
- <script type="text/javascript">
- jQuery(document).ready(function () {
- (function ($) {
- var barChartData = {
- "labels":["A","B","C","D"],
- "datasets":[
- {
- "labels":"",
- "backgroundColor":["rgba(255, 99, 132, 0.8)",
- "rgba(255, 159, 64, 0.8)",
- "rgba(255, 205, 86, 0.8)",
- "rgba(75, 192, 192, 0.8)"],
- "borderColor":["rgba(255, 99, 132, 1)",
- "rgba(255, 159, 64, 1)",
- "rgba(255, 205, 86, 1)",
- "rgba(75, 192, 192, 1)"],
- "borderWidth":1,
- "data":[8495,7351,5157,8296]
- }
- ]
- };
- if (Object.entries(barChartData).length) {
- var myCanvas = document.getElementById('myChart').getContext('2d');
- mybarChart = new Chart(myCanvas, {
- type: 'bar',
- data: barChartData,
- options: {
- responsive: true,
- maintainAspectRatio: false,
- scales: {
- xAxes: [{
- gridLines: {
- color: "#454d54"
- },
- ticks: {
- fontColor: "#fff",
- },
- }],
- yAxes: [{
- gridLines: {
- color: "#454d54"
- },
- ticks: {
- beginAtZero: true,
- fontColor: "#fff",
- callback: function(value) {if (value % 1 === 0) {return value;}}
- },
- }],
- },
- legend: {
- display: false,
- },
- title: {
- display: false,
- }
- }
- });
- }
- }(jQuery));
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement