<gh_stars>0
{"ast":null,"code":"var _jsxFileName = \"/home/rafael/Workspace/GitHub/Meus Projetos/project-sds4/frontend/src/components/DonutChart/index.tsx\",\n    _s = $RefreshSig$();\n\nimport axios from \"axios\";\nimport { useState } from \"react\";\nimport Chart from \"react-apexcharts\";\nimport { BASE_URL } from \"utils/request\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nfunction DonutChart() {\n  _s();\n\n  const [chartData, setChartData] = useState({\n    labels: [],\n    series: []\n  }); // const mockData = {\n  // series: [477138, 499928, 444867, 220426, 473088],\n  //   labels: ['Anakin', '<NAME>', 'Kal-El', 'Logan', 'Padmé']\n  // }\n\n  axios.get(`${BASE_URL}/sales/amount-by-seller`).then(response => {\n    const data = response.data;\n    const myLabels = data.map(x => x.sellerName);\n    const mySeries = data.map(x => x.sum);\n    setChartData({\n      labels: myLabels,\n      series: mySeries\n    });\n    console.log(chartData);\n  });\n  const options = {\n    legend: {\n      show: true\n    }\n  };\n  return /*#__PURE__*/_jsxDEV(Chart, {\n    options: { ...options,\n      labels: chartData.labels\n    },\n    series: chartData.series,\n    type: \"donut\",\n    height: \"244\"\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 40,\n    columnNumber: 9\n  }, this);\n}\n\n_s(DonutChart, \"Y41msl4W/VySyfI838wXCDvFS6A=\");\n\n_c = DonutChart;\nexport default DonutChart;\n\nvar _c;\n\n$RefreshReg$(_c, \"DonutChart\");","map":{"version":3,"sources":["/home/rafael/Workspace/GitHub/Meus Projetos/project-sds4/frontend/src/components/DonutChart/index.tsx"],"names":["axios","useState","Chart","BASE_URL","DonutChart","chartData","setChartData","labels","series","get","then","response","data","myLabels","map","x","sellerName","mySeries","sum","console","log","options","legend","show"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,OAAzB;AACA,OAAOC,KAAP,MAAkB,kBAAlB;AAEA,SAASC,QAAT,QAAyB,eAAzB;;;AAQA,SAASC,UAAT,GAAsB;AAAA;;AAElB,QAAM,CAACC,SAAD,EAAaC,YAAb,IAA6BL,QAAQ,CAAY;AAACM,IAAAA,MAAM,EAAC,EAAR;AAAaC,IAAAA,MAAM,EAAC;AAApB,GAAZ,CAA3C,CAFkB,CAKnB;AACI;AACF;AACF;;AAECR,EAAAA,KAAK,CAACS,GAAN,CAAW,GAAEN,QAAS,yBAAtB,EACMO,IADN,CACWC,QAAQ,IAAG;AACb,UAAMC,IAAI,GAAGD,QAAQ,CAACC,IAAtB;AACA,UAAMC,QAAQ,GAAGD,IAAI,CAACE,GAAL,CAASC,CAAC,IAAIA,CAAC,CAACC,UAAhB,CAAjB;AACA,UAAMC,QAAQ,GAAGL,IAAI,CAACE,GAAL,CAASC,CAAC,IAAIA,CAAC,CAACG,GAAhB,CAAjB;AAEDZ,IAAAA,YAAY,CAAC;AAACC,MAAAA,MAAM,EAAGM,QAAV;AAAqBL,MAAAA,MAAM,EAACS;AAA5B,KAAD,CAAZ;AAEAE,IAAAA,OAAO,CAACC,GAAR,CAAYf,SAAZ;AACF,GATN;AAWA,QAAMgB,OAAO,GAAG;AACZC,IAAAA,MAAM,EAAE;AACJC,MAAAA,IAAI,EAAE;AADF;AADI,GAAhB;AAKA,sBACI,QAAC,KAAD;AACI,IAAA,OAAO,EAAI,EAAC,GAAGF,OAAJ;AAAcd,MAAAA,MAAM,EAACF,SAAS,CAACE;AAA/B,KADf;AAEI,IAAA,MAAM,EAAGF,SAAS,CAACG,MAFvB;AAGI,IAAA,IAAI,EAAC,OAHT;AAII,IAAA,MAAM,EAAC;AAJX;AAAA;AAAA;AAAA;AAAA,UADJ;AASD;;GAnCMJ,U;;KAAAA,U;AAqCT,eAAeA,UAAf","sourcesContent":["import axios from \"axios\";\nimport { useState } from \"react\";\nimport Chart from \"react-apexcharts\";\nimport { SaleSum } from \"types/sale\";\nimport { BASE_URL } from \"utils/request\";\n\n\ntype ChartData ={\n    labels : string[];\n    series : number[];\n}\n\nfunction DonutChart() {\n\n    const [chartData , setChartData] = useState<ChartData>({labels:[] , series:[]});\n\n\n   // const mockData = {\n       // series: [477138, 499928, 444867, 220426, 473088],\n     //   labels: ['Anakin', '<NAME>', 'Kal-El', 'Logan', 'Padmé']\n   // }\n\n    axios.get(`${BASE_URL}/sales/amount-by-seller`)\n         .then(response =>{\n             const data = response.data as SaleSum[];\n             const myLabels = data.map(x => x.sellerName);\n             const mySeries = data.map(x => x.sum);\n\n            setChartData({labels : myLabels , series:mySeries});\n\n            console.log(chartData);\n         });\n    \n    const options = {\n        legend: {\n            show: true\n        }\n    }\n    return (\n        <Chart\n            options = {{...options , labels:chartData.labels}}\n            series ={chartData.series}\n            type=\"donut\"\n            height=\"244\"\n        \n        />\n    );\n  }\n  \nexport default DonutChart;"]},"metadata":{},"sourceType":"module"}