ChartDataBar.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import React, { Component } from "react";
  2. import ContentWrapper from "@/components/Layout/ContentWrapper";
  3. import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
  4. import dynamic from "next/dynamic";
  5. const ReactApexChart = dynamic(() => import("react-apexcharts"), { ssr: false });
  6. class ChartDataBar extends React.Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. series: [
  11. {
  12. data: [
  13. 44, 55, 41, 64, 22, 43, 21, 44, 42, 67, 43, 86, 42, 99, 131, 313,
  14. ],
  15. },
  16. ],
  17. options: {
  18. chart: {
  19. type: "bar",
  20. height: 430,
  21. },
  22. plotOptions: {
  23. bar: {
  24. horizontal: true,
  25. dataLabels: {
  26. position: "top",
  27. },
  28. },
  29. },
  30. chart: {
  31. toolbar: {
  32. show: true,
  33. tools: {
  34. download: false,
  35. },
  36. },
  37. },
  38. colors: ["#B2B0D2"],
  39. dataLabels: {
  40. enabled: true,
  41. offsetX: -6,
  42. style: {
  43. fontSize: "12px",
  44. colors: ["#333333"],
  45. },
  46. },
  47. stroke: {
  48. show: true,
  49. width: 1,
  50. colors: ["#fff"],
  51. },
  52. tooltip: {
  53. shared: true,
  54. intersect: false,
  55. },
  56. xaxis: {
  57. categories: [
  58. "I",
  59. "II",
  60. "III",
  61. "IV",
  62. "V",
  63. "VI",
  64. "VII",
  65. "VIII",
  66. "IX",
  67. "X",
  68. "XI",
  69. "XII",
  70. "XIII",
  71. "XIV",
  72. "XV",
  73. "XVI",
  74. ],
  75. },
  76. },
  77. };
  78. }
  79. render() {
  80. return (
  81. <div id="chart">
  82. <ReactApexChart
  83. options={this.state.options}
  84. series={this.state.series}
  85. type="bar"
  86. height={430}
  87. />
  88. </div>
  89. );
  90. }
  91. }
  92. export default ChartDataBar;