diff --git a/src/ts/@overflow/metric/react/components/Metric.tsx b/src/ts/@overflow/metric/react/components/Metric.tsx index 2a8855a..76dff46 100644 --- a/src/ts/@overflow/metric/react/components/Metric.tsx +++ b/src/ts/@overflow/metric/react/components/Metric.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; -import { Button } from 'semantic-ui-react'; +import { Button, Label } from 'semantic-ui-react'; import { BarChart, Bar, XAxis, YAxis, ZAxis, Cell, CartesianGrid, Tooltip, Legend, LineChart, Line, - ResponsiveContainer, AreaChart, Area, PieChart, Pie, + ResponsiveContainer, AreaChart, Area, PieChart, Pie, ReferenceLine, Brush, ComposedChart, } from 'recharts'; export interface StateProps { @@ -46,16 +46,11 @@ export class Metric extends React.Component { }); } - private tooltipPayload(): Array { - return [{ name: '05-01', value: 12, unit: '%' }]; - } - private showTooltipData = (data: any) => { - if (data.active) { - console.log(data.payload[0].payload.user); + if (data.active && data.payload) { return (
-

{`Total Usage : ${data.payload[0].value}%`}

+

{`Total Usage : ${data.payload[0].value}%`}

{`User : ${data.payload[0].payload.user}`}

{`Nice : ${data.payload[0].payload.nice}`}

{`System : ${data.payload[0].payload.system}`}

@@ -66,32 +61,41 @@ export class Metric extends React.Component { return null; } + public render(): JSX.Element { + const chartData = [ + { name: 'Used', value: 80, fill: '#8884d8', unit: '%' }, + { name: 'Free', value: 20, fill: '#82ca9d', unit: '%' }, + ]; + + return (
+ data={this.state.data} margin={{ top: 5, right: 30, left: 20, bottom: 5 }} > - + {/* */} - + + + data={this.state.data} margin={{ top: 5, right: 30, left: 20, bottom: 5 }} > {/* */} - - + + + @@ -101,29 +105,41 @@ export class Metric extends React.Component { - + - + - + - - - - - + + + + + + + + + {chartData[0].value}% + + + + + - {/* - - - - ; */}
); } } +