react-native-echarts/src/components/Echarts/renderChart.js

12 lines
363 B
JavaScript
Raw Normal View History

2016-10-21 07:54:29 +00:00
import echarts from './echarts.min';
import toString from '../../util/toString';
2016-10-21 07:54:29 +00:00
2016-11-01 09:31:14 +00:00
export default function renderChart(props) {
const height = props.height || 400;
2016-10-21 07:54:29 +00:00
return `
2016-11-01 09:31:14 +00:00
document.getElementById('main').style.height = "${height}px";
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption(${toString(props.option)});
`
2016-10-21 07:54:29 +00:00
}