From 474e77fbc75886ad14009c3b88834ee741a987cc Mon Sep 17 00:00:00 2001 From: Andrew Shini Date: Mon, 15 May 2017 16:48:47 +1000 Subject: [PATCH] Add width --- src/components/Echarts/renderChart.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Echarts/renderChart.js b/src/components/Echarts/renderChart.js index 7a595f0..a76bc85 100644 --- a/src/components/Echarts/renderChart.js +++ b/src/components/Echarts/renderChart.js @@ -2,9 +2,11 @@ import echarts from './echarts.min'; import toString from '../../util/toString'; export default function renderChart(props) { - const height = props.height || 400; + const height = `${props.height || 400}px`; + const width = props.width ? `${props.width}px` : 'auto'; return ` - document.getElementById('main').style.height = "${height}px"; + document.getElementById('main').style.height = "${height}"; + document.getElementById('main').style.width = "${width}"; var myChart = echarts.init(document.getElementById('main')); myChart.setOption(${toString(props.option)}); `