暫無描述
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.

DoughnutChart.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Doughnut } from "react-chartjs-2";
  2. function DoughnutChart({ doughnutData }) {
  3. const data = {
  4. datasets: [
  5. {
  6. data: doughnutData.data,
  7. backgroundColor: [
  8. "rgba(22, 82, 240,1)",
  9. "rgba(22, 82, 240,0.5)",
  10. "rgba(22, 82, 240,0.15)",
  11. ],
  12. },
  13. ],
  14. labels: ["Facebook", "Youtube", "Google"],
  15. };
  16. const options = {
  17. responsive: true,
  18. cutoutPercentage: 80,
  19. maintainAspectRatio: false,
  20. animation: {
  21. animateRotate: true,
  22. animateScale: true,
  23. },
  24. legend: {
  25. display: true,
  26. position: "bottom",
  27. labels: {
  28. usePointStyle: true,
  29. // fontFamily: "Segoe UI",
  30. fontSize: 12,
  31. fontColor: "#464a53",
  32. padding: 20,
  33. },
  34. },
  35. };
  36. return (
  37. <>
  38. <Doughnut
  39. data={data}
  40. height={150}
  41. options={options}
  42. id="most-selling-items"
  43. />
  44. </>
  45. );
  46. }
  47. export default DoughnutChart;