Skip to content

Commit

Permalink
chart data added
Browse files Browse the repository at this point in the history
  • Loading branch information
niyam239 committed Nov 12, 2021
1 parent da24ae5 commit 471faaf
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 19 deletions.
103 changes: 89 additions & 14 deletions client/src/components/Dashboard/DashboardHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ const useStyles = makeStyles((theme) => ({
text: {
display: "flex",
alignItems:"centre",

},
textAlign: 'center',
},
charttext: {
display: "flex",
alignItems:"centre",
textAlign: 'center',
marginLeft: "180px",
},
chartContainer: {
marginTop: "30px",
}
}))


Expand Down Expand Up @@ -96,9 +105,45 @@ function DashboardHome() {
return count;
}

const stocks = [
const stocks1 = [
{
name: ''
name: 'Wireless Earbuds',
quantity: 50,
},
{
name: 'mouse',
quantity: 40,
},
{
name: 'Sony Speaker',
quantity: 100,
},
{
name: 'surface laptop',
quantity: 46,
}
]

const stocks2 = [
{
name: 'T-shirt',
quantity: 20,
},
{
name: "Sandle",
quantity: 45,
},
{
name: "Topwear",
quantity: 44,
},
{
name: "Handbag",
quantity: 44,
},
{
name: "Sandwich",
quantity: 37,
}
]

Expand Down Expand Up @@ -154,31 +199,61 @@ function DashboardHome() {

</Grid>

<Grid container spacing={5}>
<Grid container spacing={5} className={classes.chartContainer}>

<Grid item xs={12} sm={6} md={4}>
<Grid item xs={12} sm={6} lg={6}>
{
<BarChart
width={500}
width={600}
height={300}
data={stocks}
data={stocks1}
margin={{
top: 5,
right: 10,
left: 10,
bottom: 5
right: 30,
left: 20,
bottom: 5,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="Product Name" />
<YAxis dataKey="Quantity" />
<XAxis dataKey="name" />
<YAxis/>
<Tooltip />
<Legend />

<Bar dataKey="quantity" fill="#82ca9d" />
</BarChart>
}

<Typography variant="h6" className={classes.charttext}>
M-Mart Store's Stock
</Typography>

</Grid>

<Grid item xs={12} sm={6} lg={6}>
{
<BarChart
width={600}
height={300}
data={stocks2}
margin={{
top: 5,
right: 30,
left: 20,
bottom: 5,
}}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis/>
<Tooltip />
<Legend />

<Bar dataKey="quantity" fill="#8884d8" />
</BarChart>
}
<Typography variant="h6" className={classes.charttext}>
V-Mart Store's Stock
</Typography>

</Grid>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Dashboard/ProductList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function ProductList() {
}}
variant="outlined"
>
{user.user.stores.map((store)=>{
{user.user.stores.reverse().map((store)=>{
return(
<MenuItem value={store._id}>{store.name}</MenuItem>
)
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/Dashboard/ShopList.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ const ShopList = () => {
{
field: "_id",
headerName: "ID",
width: 100,
width: 220,
},
{
field: "name",
headerName: "Store Name",
width: 200,
width: 180,
editable: false,
},
{
field: "description",
headerName: "Description",
width: 300,
width: 520,
editable: false,
},
{
field: "action",
headerName: "Action",
width: 120,
width: 150,
renderCell: (params) => {
const deleteProduct = async () => {
const sure = window.confirm("This record will be deleted permanently.");
Expand Down

0 comments on commit 471faaf

Please sign in to comment.