summaryrefslogtreecommitdiff
path: root/src/components/TrafficChartSample.js
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-10-31 18:18:04 +0800
committerHaishan <[email protected]>2020-11-01 17:42:52 +0800
commitff1a39d04e53b428e34d46c55ecd6689189b5443 (patch)
tree94a60abe3d28a1d729b877356bdd38d75ce655a5 /src/components/TrafficChartSample.js
parente62c9165481ef12ee2310dee1c32f890b3fe4b78 (diff)
chore: run ts-migrate
Diffstat (limited to 'src/components/TrafficChartSample.js')
-rw-r--r--src/components/TrafficChartSample.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/components/TrafficChartSample.js b/src/components/TrafficChartSample.js
deleted file mode 100644
index 0723505..0000000
--- a/src/components/TrafficChartSample.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import React, { useMemo } from 'react';
-
-import useLineChart from '../hooks/useLineChart';
-import {
- chartJSResource,
- chartStyles,
- commonDataSetProps,
-} from '../misc/chart';
-
-const extraChartOptions = {
- legend: {
- display: false,
- },
- scales: {
- xAxes: [{ display: false }],
- yAxes: [{ display: false }],
- },
-};
-
-const data1 = [23e3, 35e3, 46e3, 33e3, 90e3, 68e3, 23e3, 45e3];
-const data2 = [184e3, 183e3, 196e3, 182e3, 190e3, 186e3, 182e3, 189e3];
-const labels = data1;
-
-export default function TrafficChart({ id }) {
- const Chart = chartJSResource.read();
-
- const data = useMemo(
- () => ({
- labels,
- datasets: [
- {
- ...commonDataSetProps,
- ...chartStyles[id].up,
- data: data1,
- },
- {
- ...commonDataSetProps,
- ...chartStyles[id].down,
- data: data2,
- },
- ],
- }),
- [id]
- );
-
- const eleId = 'chart-' + id;
- useLineChart(Chart, eleId, data, null, extraChartOptions);
-
- return (
- <div
- style={{
- width: 130,
- padding: 5,
- }}
- >
- <canvas id={eleId} />
- </div>
- );
-}