From: Hongyuan Ma Date: Thu, 24 May 2018 15:52:52 +0000 (+0800) Subject: add RateBat component X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a524caef7025bb3d34a059a1a4dc7b26655122d1;p=pgperffarm.git add RateBat component --- diff --git a/front-end/package.json b/front-end/package.json index e42d081..522b8ac 100644 --- a/front-end/package.json +++ b/front-end/package.json @@ -25,6 +25,7 @@ "webpack-dev-server": "2.9.7" }, "dependencies": { + "echarts": "^4.1.0", "font-awesome": "^4.7.0", "rc-pagination": "^1.16.3", "react": "16.2.0", diff --git a/front-end/src/page/Status/index.jsx b/front-end/src/page/Status/index.jsx index a60fe2a..c1d4b36 100644 --- a/front-end/src/page/Status/index.jsx +++ b/front-end/src/page/Status/index.jsx @@ -1,6 +1,7 @@ import React from 'react'; // import './index.scss'; import ResultFilter from 'component/result-filter/index.jsx'; +import RateBar from 'util/rate-bar/index.jsx'; class Status extends React.Component{ render(){ @@ -12,6 +13,7 @@ class Status extends React.Component{ Use the farm member link for history of that member on the relevant branch.

+ ) } diff --git a/front-end/src/util/rate-bar/index.jsx b/front-end/src/util/rate-bar/index.jsx new file mode 100644 index 0000000..12c195d --- /dev/null +++ b/front-end/src/util/rate-bar/index.jsx @@ -0,0 +1,90 @@ +import React from 'react'; + +import echarts from 'echarts/lib/echarts'; +// import 'echarts/lib/chart/line'; +import 'echarts/lib/component/tooltip' +import 'echarts/lib/component/grid' +import 'echarts/lib/chart/bar' + +import 'echarts/lib/component/title'; +import lineChart from './lineChart'; + +// import { pieOption, barOption, lineOption, scatterOption, mapOption, radarOption, candlestickOption } from './optionConfig/options' +// const BarReact = asyncComponent(() => import(/* webpackChunkName: "BarReact" */'./EchartsDemo/BarReact')) // bar component + + +// General rate bar +class RateBar extends React.Component { + constructor(props) { + super(props); + this.state = { + + } + } + + componentDidMount() { + // init echarts + let myChart = echarts.init(document.getElementById('main')); + let option = { + tooltip : { + trigger: 'axis', + axisPointer : { + type : 'shadow' + } + }, + legend: { + data: ['std', 'current'] + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: { + type: 'value' + }, + yAxis: { + type: 'category', + data: ['2 clients','4 clients'] + }, + series: [ + { + name: 'std', + type: 'bar', + stack: 'current', + label: { + normal: { + show: true, + position: 'insideRight' + } + }, + data: [320, 302] + }, + { + name: 'std', + type: 'bar', + stack: 'current', + label: { + normal: { + show: true, + position: 'insideRight' + } + }, + data: [120, 132] + }, + ] + }; + + myChart.setOption(option); + + + } + render() { + return ( +
+ ); + } +} + +export default RateBar; \ No newline at end of file diff --git a/front-end/src/util/rate-bar/lineChart b/front-end/src/util/rate-bar/lineChart new file mode 100644 index 0000000..9d41f48 --- /dev/null +++ b/front-end/src/util/rate-bar/lineChart @@ -0,0 +1,3 @@ +module.exports = { + +}; \ No newline at end of file diff --git a/front-end/yarn.lock b/front-end/yarn.lock index 2a3d84e..246f47a 100644 --- a/front-end/yarn.lock +++ b/front-end/yarn.lock @@ -1730,6 +1730,12 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +echarts@^4.1.0: + version "4.1.0" + resolved "http://registry.npm.taobao.org/echarts/download/echarts-4.1.0.tgz#d588c95f73c1a9928b9c73d5b769751c3185bcdc" + dependencies: + zrender "4.0.4" + ee-first@1.1.1: version "1.1.1" resolved "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -5741,3 +5747,7 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" + +zrender@4.0.4: + version "4.0.4" + resolved "http://registry.npm.taobao.org/zrender/download/zrender-4.0.4.tgz#910e60d888f00c9599073f23758dd23345fe48fd"