Skip to content

Commit 474e77f

Browse files
Add width
1 parent 9fc5b29 commit 474e77f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Echarts/renderChart.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import echarts from './echarts.min';
22
import toString from '../../util/toString';
33

44
export default function renderChart(props) {
5-
const height = props.height || 400;
5+
const height = `${props.height || 400}px`;
6+
const width = props.width ? `${props.width}px` : 'auto';
67
return `
7-
document.getElementById('main').style.height = "${height}px";
8+
document.getElementById('main').style.height = "${height}";
9+
document.getElementById('main').style.width = "${width}";
810
var myChart = echarts.init(document.getElementById('main'));
911
myChart.setOption(${toString(props.option)});
1012
`

0 commit comments

Comments
 (0)