Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
final-exam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
final-exam
Commits
756c7ccd
Commit
756c7ccd
authored
Oct 05, 2023
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: graph not show
parent
51f5a041
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
+8
-19
Chart.js
src/components/dashboard/Chart.js
+8
-19
No files found.
src/components/dashboard/Chart.js
View file @
756c7ccd
...
...
@@ -24,17 +24,7 @@ export default function Chart() {
const
[
month
,
setMonth
]
=
React
.
useState
(
""
);
const
[
year
,
setYear
]
=
React
.
useState
(
"2023"
);
const
[
data
,
setData
]
=
React
.
useState
([
createData
(
"00:00"
,
0
),
createData
(
"03:00"
,
300
),
createData
(
"06:00"
,
600
),
createData
(
"09:00"
,
800
),
createData
(
"12:00"
,
1500
),
createData
(
"15:00"
,
2000
),
createData
(
"18:00"
,
2400
),
createData
(
"21:00"
,
2400
),
createData
(
"24:00"
,
undefined
),
]);
const
[
data
,
setData
]
=
React
.
useState
([]);
React
.
useEffect
(()
=>
{
if
(
!
user
.
value
?.
token
||
adminOrder
.
value
.
length
===
0
)
return
;
...
...
@@ -60,14 +50,13 @@ export default function Chart() {
}
setMonth
(
month_now
);
setYear
(
year_now
);
date_all
.
reverse
()
let
graph
=
[]
date_all
.
map
(
dat
=>
{
graph
.
push
(
createData
(
dat
,
date_price
[
dat
]))
})
setData
(
graph
)
},
[
user
]);
date_all
.
reverse
();
let
graph
=
[];
date_all
.
map
((
dat
)
=>
{
graph
.
push
(
createData
(
dat
,
date_price
[
dat
]));
});
setData
(
graph
);
},
[
user
,
adminOrder
]);
return
(
<
React
.
Fragment
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment