56 |
57 |
CPU0
58 |
59 |
Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz.
60 |
61 |
62 |
CPU1
63 |
64 |
Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz.
65 |
66 |
67 |
CPU2
68 |
69 |
Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz.
70 |
71 |
72 |
CPU3
73 |
74 |
Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz.
75 |
76 |
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/components/containers/stats/lineChart.css:
--------------------------------------------------------------------------------
1 | .chart {
2 | /*border: 1px dotted #ddd;*/
3 | }
4 |
5 | .chart .column {
6 | fill: RGB(230, 237, 244);
7 | }
8 |
9 | .chart .line {
10 | stroke: RGB(243, 42, 100);
11 | stroke-width: 3px;
12 | fill: none;
13 | }
14 |
15 | .chart .axis text {
16 | font: 9px sans-serif;
17 | }
18 |
19 | .chart .axis path,
20 | .chart .axis line {
21 | fill: none;
22 | stroke: RGB(230, 237, 244);
23 | stroke-width: 1.5px;
24 | shape-rendering: crispEdges;
25 | }
26 |
27 | .chart .axis path {
28 | display: none;
29 | }
30 |
--------------------------------------------------------------------------------
/src/components/containers/stats/lineChart.jsx:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import Chart from 'd3-line';
3 | import Tip from 'd3-tipy';
4 | import d3 from 'd3';
5 |
6 | import {
7 | Grid, Cell } from 'react-mdl';
8 |
9 | import './lineChart.css';
10 |
11 | const gen = n => {
12 | const data = [];
13 |
14 | for (let i = 0; i < n; i++) {
15 | data.push({
16 | bin: new Date(Date.now() - (i * 3600000)),
17 | time: new Date(Date.now() - (i * 7000)),
18 | value: Math.max(250, Math.random() * 3000 | 0)
19 | });
20 | }
21 |
22 | return data;
23 | };
24 |
25 | export default class LineChart extends Component {
26 | componentDidMount() {
27 | const tip = new Tip({
28 | format: d => d3.format(',')(d.value)
29 | });
30 |
31 | this._a = new Chart({
32 | target: this.a,
33 | width: 600,
34 | xTicks: 10,
35 | yTicks: 12,
36 | mouseover: tip.show,
37 | mouseout: tip.hide
38 | });
39 |
40 | this._b = new Chart({
41 | target: this.b,
42 | width: 600,
43 | xTicks: 10,
44 | yTicks: 12,
45 | mouseover: tip.show,
46 | mouseout: tip.hide
47 | });
48 |
49 | this._a.render(gen(24));
50 | this._b.render(gen(24));
51 | }
52 |
53 | componentDidUpdate() {
54 | this.changeData();
55 | }
56 |
57 | changeData = _ => {
58 | this._a.render(gen(24));
59 | this._b.update(gen(24));
60 | }
61 |
62 | render() {
63 | return (
64 |