chart-bar-demo.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Set new default font family and font color to mimic Bootstrap's default styling
  2. Chart.defaults.global.defaultFontFamily = '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
  3. Chart.defaults.global.defaultFontColor = '#292b2c';
  4. // Bar Chart Example
  5. var ctx = document.getElementById("myBarChart");
  6. var myLineChart = new Chart(ctx, {
  7. type: 'bar',
  8. data: {
  9. labels: ["January", "February", "March", "April", "May", "June"],
  10. datasets: [{
  11. label: "Revenue",
  12. backgroundColor: "rgba(2,117,216,1)",
  13. borderColor: "rgba(2,117,216,1)",
  14. data: [4215, 5312, 6251, 7841, 9821, 14984],
  15. }],
  16. },
  17. options: {
  18. scales: {
  19. xAxes: [{
  20. time: {
  21. unit: 'month'
  22. },
  23. gridLines: {
  24. display: false
  25. },
  26. ticks: {
  27. maxTicksLimit: 6
  28. }
  29. }],
  30. yAxes: [{
  31. ticks: {
  32. min: 0,
  33. max: 15000,
  34. maxTicksLimit: 5
  35. },
  36. gridLines: {
  37. display: true
  38. }
  39. }],
  40. },
  41. legend: {
  42. display: false
  43. }
  44. }
  45. });