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

40 lines
999 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import echarts from './echarts.min';
import toString from '../../util/toString';
export default function renderChart(option) {
return `
<!DOCTYPE html>\n
<html>
<head>
<title>echarts</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
html,body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#main {
height: 100%;
}
</style>
<script>
${echarts}
</script>
</head>
<body>
<div id="main" ></div>
<script>
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(${toString(option)});
</script>
<body>
<html>
`
}