Ei kuvausta
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.

DarkLightToggle.js 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { Bar } from "react-chartjs-2";
  2. function StackedBarChart() {
  3. const data = {
  4. labels: [
  5. "4 Jan",
  6. "5 Jan",
  7. "6 Jan",
  8. "7 Jan",
  9. "8 Jan",
  10. "9 Jan",
  11. "10 Jan",
  12. ],
  13. datasets: [
  14. {
  15. label: "Youtube",
  16. backgroundColor: "#1652F0",
  17. borderColor: "transparent",
  18. data: [35, 65, 52, 115, 98, 185, 125],
  19. lineTension: 0,
  20. pointRadius: 0,
  21. borderWidth: 2,
  22. },
  23. {
  24. label: "Facebook",
  25. backgroundColor: "#f73164",
  26. borderColor: "transparent",
  27. data: [40, 105, 92, 155, 138, 205, 165],
  28. lineTension: 0,
  29. // borderDash: [10, 5],
  30. borderWidth: 1,
  31. pointRadius: 0,
  32. },
  33. ],
  34. };
  35. const options = {
  36. responsive: true,
  37. maintainAspectRatio: false,
  38. legend: {
  39. display: false,
  40. },
  41. scales: {
  42. xAxes: [
  43. {
  44. stacked: true,
  45. barPercentage: 0.63,
  46. gridLines: {
  47. display: false,
  48. drawBorder: false,
  49. },
  50. ticks: {
  51. fontColor: "#8a909d",
  52. },
  53. },
  54. ],
  55. yAxes: [
  56. {
  57. stacked: true,
  58. gridLines: {
  59. display: true,
  60. color: "#eee",
  61. },
  62. ticks: {
  63. stepSize: 50,
  64. fontColor: "#8a909d",
  65. },
  66. },
  67. ],
  68. },
  69. tooltips: {
  70. mode: "index",
  71. intersect: false,
  72. titleFontColor: "#888",
  73. bodyFontColor: "#555",
  74. titleFontSize: 12,
  75. bodyFontSize: 15,
  76. backgroundColor: "rgba(256,256,256,0.95)",
  77. displayColors: true,
  78. xPadding: 10,
  79. yPadding: 7,
  80. borderColor: "rgba(220, 220, 220, 0.9)",
  81. borderWidth: 2,
  82. caretSize: 6,
  83. caretPadding: 5,
  84. },
  85. };
  86. return (
  87. <>
  88. <Bar data={data} height={150} options={options} id="activityBar" />
  89. </>
  90. );
  91. }
  92. export default StackedBarChart;