-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54f2ed7
commit 158a41e
Showing
11 changed files
with
278 additions
and
156 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import ReactEcharts from "echarts-for-react" | ||
import { InfoIcon } from "../icons" | ||
|
||
const BarChart = () => { | ||
const data = [ | ||
{ day: "may1", positive: 28, negative: 2 }, | ||
{ day: "may2", positive: 12, negative: 3 }, | ||
{ day: "may3", positive: 19, negative: 3 }, | ||
{ day: "may4", positive: 20, negative: 3 }, | ||
{ day: "may5", positive: 21, negative: 3 }, | ||
{ day: "may6", positive: 29, negative: 3 }, | ||
{ day: "may7", positive: 30, negative: 3 }, | ||
] | ||
|
||
const chartData = data.map((item) => ({ | ||
name: item.day, | ||
value: [item.negative, item.positive], | ||
})) | ||
|
||
const option = { | ||
tooltip: {}, | ||
grid: { | ||
left: "5%", | ||
right: "5%", | ||
top: "10%", | ||
bottom: "10%", | ||
}, | ||
xAxis: { | ||
type: "category", | ||
data: data.map((item) => item.day), | ||
}, | ||
yAxis: { | ||
type: "value", | ||
}, | ||
series: [ | ||
{ | ||
name: "Success", | ||
stack: "total", | ||
type: "bar", | ||
data: chartData.map((item) => item.value[1]), | ||
itemStyle: { | ||
color: "#2196F3", | ||
}, | ||
barWidth: 60, | ||
}, | ||
{ | ||
name: "Failure", | ||
stack: "total", | ||
type: "bar", | ||
data: chartData.map((item) => item.value[0]), | ||
itemStyle: { | ||
color: "#FF5722", | ||
}, | ||
barWidth: 60, | ||
}, | ||
], | ||
} | ||
|
||
return ( | ||
<div className="bg-white rounded-md flex flex-col p-4 shadow-md"> | ||
<div className="flex justify-between px-10 items-center"> | ||
<h4 className="text-xl font-semibold">Proposal</h4> | ||
|
||
<InfoIcon /> | ||
</div> | ||
|
||
<ReactEcharts option={option} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default BarChart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,16 @@ | ||
import React from "react" | ||
import ReactDOM from "react-dom/client" | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom" | ||
import { RouterProvider } from "react-router-dom" | ||
import "./index.css" | ||
import Bugs from "./routes/Bugs" | ||
import Root from "./routes/root" | ||
import Blockchain from "./routes/Blockchain" | ||
import User from "./routes/User" | ||
import { router } from "./routes/Router" | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query" | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: "/", | ||
element: <Root />, | ||
children: [ | ||
{ | ||
element: <Blockchain />, | ||
index: true, | ||
}, | ||
{ | ||
path: "user", | ||
element: <User />, | ||
}, | ||
{ | ||
path: "bugs", | ||
element: <Bugs />, | ||
}, | ||
], | ||
}, | ||
]) | ||
const queryClient = new QueryClient() | ||
|
||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( | ||
<React.StrictMode> | ||
<RouterProvider router={router} /> | ||
<QueryClientProvider client={queryClient}> | ||
<RouterProvider router={router} /> | ||
</QueryClientProvider> | ||
</React.StrictMode> | ||
) |
Oops, something went wrong.