Skip to content

Commit

Permalink
Merge pull request #261 from 100-hours-a-week/feature/veronica
Browse files Browse the repository at this point in the history
Feature/veronica
  • Loading branch information
yzooop authored Oct 7, 2024
2 parents a65a0f6 + bc54b28 commit 421817d
Show file tree
Hide file tree
Showing 6 changed files with 678 additions and 608 deletions.
55 changes: 29 additions & 26 deletions src/Component/Chart/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,41 @@ import { ApexOptions } from "apexcharts";
import { StockProps } from "../../constants/interface";

interface PieChartProps {
stockData: StockProps[];
stockData: StockProps[];
}

const PieChart: React.FC<PieChartProps> = ({ stockData }) => {
const series = stockData.map((item) => item.quantity);
const labels = stockData.map((item) => item.name);
console.log(stockData);
const series = stockData.map(
(item) => item.average * item.quantity * item.profitRate * 0.01
);
const labels = stockData.map((item) => item.name);

const options: ApexOptions = {
chart: {
type: "donut",
},
labels: labels,
legend: {
position: "bottom",
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 450,
},
const options: ApexOptions = {
chart: {
type: "donut",
},
},
],
};
labels: labels,
legend: {
position: "bottom",
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 450,
},
},
},
],
};

return (
<div id="chart" style={{ marginTop: "4rem", marginBottom: "10rem" }}>
<ReactApexChart options={options} series={series} type="donut" />
</div>
);
return (
<div id="chart" style={{ marginTop: "4rem", marginBottom: "10rem" }}>
<ReactApexChart options={options} series={series} type="donut" />
</div>
);
};

export default PieChart;
Loading

0 comments on commit 421817d

Please sign in to comment.