Merge pull request #44 from superandrew213/add-width-to-echart-container
Add width
This commit is contained in:
commit
c9efc0634f
|
|
@ -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)});
|
||||
`
|
||||
|
|
|
|||
Loading…
Reference in New Issue