Add width
This commit is contained in:
parent
9fc5b29aec
commit
474e77fbc7
|
|
@ -2,9 +2,11 @@ import echarts from './echarts.min';
|
||||||
import toString from '../../util/toString';
|
import toString from '../../util/toString';
|
||||||
|
|
||||||
export default function renderChart(props) {
|
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 `
|
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'));
|
var myChart = echarts.init(document.getElementById('main'));
|
||||||
myChart.setOption(${toString(props.option)});
|
myChart.setOption(${toString(props.option)});
|
||||||
`
|
`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue