From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/menu/components/chart/antv-pie/index.jsx | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 9009ffd..a7e3f8a 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -9,7 +9,7 @@ import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' -import { resetStyle, getTables } from '@/utils/utils-custom.js' +import { resetStyle, getTables, getHeight } from '@/utils/utils-custom.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -143,6 +143,22 @@ } } + getHeight = (val) => { + if (typeof(val) === 'string') { + if (val.indexOf('px') > -1) { + val = parseFloat(val) + } else if (val.indexOf('vw') > -1) { + val = parseFloat(val) + val = document.body.clientWidth * val / 100 + } else if (val.indexOf('vh') > -1) { + val = parseFloat(val) + val = document.body.clientHeight * val / 100 + } + } + + return parseInt(val || 400) + } + viewrender = () => { const { card } = this.state @@ -248,7 +264,7 @@ const chart = new Chart({ container: card.uuid + 'canvas', autoFit: true, - height: this.wrap.offsetHeight - 30, + height: getHeight(plot.height), padding: 0, }) @@ -419,7 +435,7 @@ const chart = new Chart({ container: card.uuid + 'canvas', autoFit: true, - height: this.wrap.offsetHeight - 30 + height: getHeight(plot.height) }) if (plot.shape !== 'nightingale' && plot.show !== 'value') { @@ -665,7 +681,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle) } getStyle = (style) => { @@ -689,9 +705,10 @@ render() { const { card, appType } = this.state let _style = resetStyle(card.style) + _style.height = 'auto' return ( - <div className="menu-pie-chart-edit-box" style={{..._style, height: card.plot.height || 400}} onClick={this.clickComponent} id={card.uuid}> + <div className="menu-pie-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null} @@ -707,7 +724,7 @@ <ToolOutlined /> </Popover> <NormalHeader config={card} updateComponent={this.updateComponent}/> - <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> + <div className="canvas" id={card.uuid + 'canvas'}></div> <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> -- Gitblit v1.8.0