diff --git a/example/package.json b/example/package.json index fe209b72..e2a511eb 100755 --- a/example/package.json +++ b/example/package.json @@ -9,7 +9,7 @@ "dependencies": { "react": "15.3.2", "react-native": "0.35.0", - "native-echarts": "0.1.0" + "native-echarts": "0.2.0" }, "jest": { "preset": "jest-react-native" diff --git a/package.json b/package.json index 4abafd8f..6041eb86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "native-echarts", - "version": "0.1.2", + "version": "0.2.0", "description": "echarts for react-native", "main": "src/index.js", "directories": { diff --git a/src/components/Echarts/index.js b/src/components/Echarts/index.js index e00ca9b3..c433b17a 100644 --- a/src/components/Echarts/index.js +++ b/src/components/Echarts/index.js @@ -8,10 +8,11 @@ export default class App extends Component { return ( ); } diff --git a/src/components/Echarts/renderChart.js b/src/components/Echarts/renderChart.js index e76b23af..7a595f09 100644 --- a/src/components/Echarts/renderChart.js +++ b/src/components/Echarts/renderChart.js @@ -1,39 +1,11 @@ import echarts from './echarts.min'; import toString from '../../util/toString'; -export default function renderChart(option) { +export default function renderChart(props) { + const height = props.height || 400; return ` - \n - - - echarts - - - - - - -
- - - - ` + document.getElementById('main').style.height = "${height}px"; + var myChart = echarts.init(document.getElementById('main')); + myChart.setOption(${toString(props.option)}); + ` } diff --git a/src/components/Echarts/tpl.html b/src/components/Echarts/tpl.html new file mode 100644 index 00000000..763fde70 --- /dev/null +++ b/src/components/Echarts/tpl.html @@ -0,0 +1,65 @@ + + + + echarts + + + + + + +
+ + + \ No newline at end of file