ChartDataBar.js 1.9 KB

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