diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js
index 50de76e880970d0b82e665e48ce942cfa2958fba..cba420209557b5ad339e6239f4deb33805b0536d 100644
--- a/src/components/Charts/Gauge/index.js
+++ b/src/components/Charts/Gauge/index.js
@@ -4,15 +4,22 @@ import equal from '../equal';
const { Shape } = G2;
+const primaryColor = '#2F9CFF';
+const backgroundColor = '#F0F2F5';
+
/* eslint no-underscore-dangle: 0 */
class Gauge extends PureComponent {
componentDidMount() {
- this.renderChart();
+ setTimeout(() => {
+ this.renderChart();
+ }, 10);
}
componentWillReceiveProps(nextProps) {
if (!equal(this.props, nextProps)) {
- this.renderChart(nextProps);
+ setTimeout(() => {
+ this.renderChart(nextProps);
+ }, 10);
}
}
@@ -27,7 +34,7 @@ class Gauge extends PureComponent {
}
initChart(nextProps) {
- const { title, color = '#00b1f8' } = nextProps || this.props;
+ const { title, color = primaryColor } = nextProps || this.props;
Shape.registShape('point', 'dashBoard', {
drawShape(cfg, group) {
@@ -103,7 +110,9 @@ class Gauge extends PureComponent {
}
renderChart(nextProps) {
- const { height, color = '#00b1f8', bgColor = '#d3f3fe', title, percent, format } = nextProps || this.props;
+ const {
+ height, color = primaryColor, bgColor = backgroundColor, title, percent, format,
+ } = nextProps || this.props;
const data = [{ name: title, value: percent }];
if (this.chart) {
@@ -139,11 +148,13 @@ class Gauge extends PureComponent {
min: 0,
max: 100,
tickCount: 6,
- subTick: false,
});
chart.axis('value', {
+ subTick: false,
tickLine: {
stroke: color,
+ lineWidth: 2,
+ value: -14,
},
labelOffset: -12,
formatter: format,
@@ -154,7 +165,7 @@ class Gauge extends PureComponent {
/* eslint no-shadow: 0 */
function draw(data) {
const val = data[0].value;
- const lineWidth = 18;
+ const lineWidth = 12;
chart.guide().clear();
chart.guide().arc(() => {
diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js
index a517385151abe77d985c684050cf89e874df5501..5766e27745db9819e1e6b732164377f505b3aff4 100644
--- a/src/components/Charts/Pie/index.js
+++ b/src/components/Charts/Pie/index.js
@@ -204,11 +204,11 @@ class Pie extends Component {
style={{ marginLeft: left, opacity: left ? 1 : 0 }}
>
{
- subTitle &&
{subTitle}
+ subTitle && {subTitle}
}
{
// eslint-disable-next-line
- total &&
+ total &&
}
)
diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js
index 575dce14f05626d9eae3a684200167904239019f..d1275de9ce97fa6eb6cbf41f320786b4a928545c 100644
--- a/src/components/Charts/WaterWave/index.js
+++ b/src/components/Charts/WaterWave/index.js
@@ -29,21 +29,14 @@ class WaterWave extends PureComponent {
resize = () => {
const { height } = this.props;
- const realWidth = this.root.parentNode.offsetWidth;
- if (realWidth < this.props.height) {
- const radio = realWidth / height;
- this.setState({
- radio,
- });
- } else {
- this.setState({
- radio: 1,
- });
- }
+ const { offsetWidth } = this.root.parentNode;
+ this.setState({
+ radio: offsetWidth < height ? offsetWidth / height : 1,
+ });
}
renderChart() {
- const { percent, color = '#19AFFA' } = this.props;
+ const { percent, color = '#1890FF' } = this.props;
const data = percent / 100;
const self = this;
@@ -61,7 +54,7 @@ class WaterWave extends PureComponent {
const cR = radius - (lineWidth);
ctx.beginPath();
- ctx.lineWidth = lineWidth;
+ ctx.lineWidth = lineWidth * 2;
const axisLength = canvasWidth - (lineWidth);
const unit = axisLength / 8;
@@ -108,7 +101,11 @@ class WaterWave extends PureComponent {
ctx.lineTo(xOffset + axisLength, canvasHeight);
ctx.lineTo(xOffset, canvasHeight);
ctx.lineTo(startPoint[0], startPoint[1]);
- ctx.fillStyle = color;
+
+ const gradient = ctx.createLinearGradient(0, 0, 0, 170);
+ gradient.addColorStop(0, '#ffffff');
+ gradient.addColorStop(1, '#1890FF');
+ ctx.fillStyle = gradient;
ctx.fill();
ctx.restore();
}
@@ -137,7 +134,7 @@ class WaterWave extends PureComponent {
ctx.restore();
ctx.clip();
- ctx.fillStyle = '#108ee9';
+ ctx.fillStyle = '#1890FF';
}
} else {
if (data >= 0.85) {
@@ -181,7 +178,14 @@ class WaterWave extends PureComponent {
const { percent, title, height } = this.props;
return (
(this.root = n)} style={{ transform: `scale(${radio})` }}>
-