diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f5f90df..e245c21 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "frontend", "version": "0.0.0", "dependencies": { + "@canvasjs/react-charts": "^1.0.2", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.0.2", @@ -373,6 +374,23 @@ "node": ">=6.9.0" } }, + "node_modules/@canvasjs/charts": { + "version": "3.10.8", + "resolved": "https://registry.npmjs.org/@canvasjs/charts/-/charts-3.10.8.tgz", + "integrity": "sha512-nsCONjmrNhAiPnuVQ+hJq6ByUmIh5FjQOwIEDtmuyAlzb/bXVPnlshcTiKIN3tOQ3EOdd087/It71RIVw3Kfiw==", + "license": "SEE LICENSE IN ", + "peer": true + }, + "node_modules/@canvasjs/react-charts": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@canvasjs/react-charts/-/react-charts-1.0.2.tgz", + "integrity": "sha512-PZgJlDbGdMF4AN/KvrvGY9X50EByJMZ7MHfQB/U0aky9Onn9mt0CpsvwudBsBe+DofaV3SHR4SHn/Wfo/pubDw==", + "license": "MIT", + "peerDependencies": { + "@canvasjs/charts": "^3.7.5", + "react": ">=16.0.0" + } + }, "node_modules/@emotion/babel-plugin": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.12.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 6fcfeaf..1bb9a49 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@canvasjs/react-charts": "^1.0.2", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@mui/icons-material": "^6.0.2", diff --git a/frontend/src/components/Preview.tsx b/frontend/src/components/Preview.tsx new file mode 100644 index 0000000..402c1bd --- /dev/null +++ b/frontend/src/components/Preview.tsx @@ -0,0 +1,89 @@ +// import React from 'react'; +// // @ts-ignore +// import CanvasJSReact from '@canvasjs/react-charts'; + +// const CanvasJS = CanvasJSReact.CanvasJS; +// const CanvasJSChart = CanvasJSReact.CanvasJSChart; + +// const Preview = () => { +// const options = { +// animationEnabled: true, +// title: { +// text: "Fruit Distribution" +// }, +// data: [{ +// type: "doughnut", +// showInLegend: true, +// indexLabel: "{name}: {y}%", +// yValueFormatString: "#,###'%'", +// dataPoints: [ +// { name: "Open", y: 45 }, +// { name: "IN Progress", y: 25 }, +// { name: "Review", y: 20 }, +// ] +// }] +// }; + +// return ( +//
+// +//
+// ); +// }; + +// export default Preview; + +import React from 'react'; +// @ts-ignore +import CanvasJSReact from '@canvasjs/react-charts'; + +const CanvasJS = CanvasJSReact.CanvasJS; +const CanvasJSChart = CanvasJSReact.CanvasJSChart; + +const Preview = () => { + + const options = { + animationEnabled: true, + title: { + text: "Preview", + horizontalAlign: "left", // Align the title to the right + verticalAlign: "top", // Position the title at the top + fontSize: 16, // Adjust font size + fontWeight: "bold", // Make the title less bold + fontFamily: "Arial", // Change the font family if desired + }, + data: [{ + type: "doughnut", + showInLegend: true, // Show the legend if you want to keep it + indexLabel: null, // Remove the lined labels on the segments + yValueFormatString: "#,###'%'", + dataPoints: [ + { name: "Open", y: 45, color: "#2986cc" }, + { name: "In Progress", y: 25, color: "#9fc5e8" }, + { name: "Review", y: 20, color:"#0b5394" }, + ] + , + innerRadius: "60%", // Adjust this value to change the inner radius of the doughnut + radius: "80%", + }], + legend: { + // Customize the legend here if needed + verticalAlign: "bottom", + horizontalAlign: "center", + fontSize: 12, + fontFamily: "tahoma", + cursor: "pointer", + itemclick: function(e:React.MouseEvent) { + // function if want to add some event on clicking over the labels + } + } + }; + + return ( +
+ +
+ ); +}; + +export default Preview; diff --git a/frontend/src/components/ProjectSummary.tsx b/frontend/src/components/ProjectSummary.tsx index 879094d..e945c28 100644 --- a/frontend/src/components/ProjectSummary.tsx +++ b/frontend/src/components/ProjectSummary.tsx @@ -37,7 +37,7 @@ interface ProjectSummaryProps { ]; return ( -
+

Project Summary

@@ -48,9 +48,9 @@ interface ProjectSummaryProps { ))}
-
+
- +
Project Name diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 6cebc5e..b2f89ec 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -14,7 +14,7 @@ const menuItems = [ const Sidebar: React.FC<{ isOnlyIcon: boolean }> = ({ isOnlyIcon }) => { return ( -