text4u
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chart-area-demo.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. // Area Chart Example
  5. var ctx = document.getElementById("myAreaChart");
  6. var myLineChart = new Chart(ctx, {
  7. type: 'line',
  8. data: {
  9. labels: ["Mar 1", "Mar 2", "Mar 3", "Mar 4", "Mar 5", "Mar 6", "Mar 7", "Mar 8", "Mar 9", "Mar 10", "Mar 11", "Mar 12", "Mar 13"],
  10. datasets: [{
  11. label: "Sessions",
  12. lineTension: 0.3,
  13. backgroundColor: "rgba(2,117,216,0.2)",
  14. borderColor: "rgba(2,117,216,1)",
  15. pointRadius: 5,
  16. pointBackgroundColor: "rgba(2,117,216,1)",
  17. pointBorderColor: "rgba(255,255,255,0.8)",
  18. pointHoverRadius: 5,
  19. pointHoverBackgroundColor: "rgba(2,117,216,1)",
  20. pointHitRadius: 50,
  21. pointBorderWidth: 2,
  22. data: [10000, 30162, 26263, 18394, 18287, 28682, 31274, 33259, 25849, 24159, 32651, 31984, 38451],
  23. }],
  24. },
  25. options: {
  26. scales: {
  27. xAxes: [{
  28. time: {
  29. unit: 'date'
  30. },
  31. gridLines: {
  32. display: false
  33. },
  34. ticks: {
  35. maxTicksLimit: 7
  36. }
  37. }],
  38. yAxes: [{
  39. ticks: {
  40. min: 0,
  41. max: 40000,
  42. maxTicksLimit: 5
  43. },
  44. gridLines: {
  45. color: "rgba(0, 0, 0, .125)",
  46. }
  47. }],
  48. },
  49. legend: {
  50. display: false
  51. }
  52. }
  53. });