You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
796 B
29 lines
796 B
import React, { useState, useEffect } from 'react';
|
|
import { View, CoverView } from '@tarojs/components';
|
|
import * as echarts from "../ec-canvas/echarts";
|
|
import './common.scss'
|
|
|
|
const Common = ({ ...props }) => {
|
|
const { option } = props;
|
|
const ec = {
|
|
onInit: function (canvas, width, height, dpr) {
|
|
const chart = echarts.init(canvas, null, {
|
|
width: width,
|
|
height: height,
|
|
devicePixelRatio: dpr
|
|
});
|
|
canvas.setChart(chart);
|
|
|
|
chart.setOption(option);
|
|
|
|
return chart;
|
|
}
|
|
}
|
|
|
|
return (
|
|
<View style={{ width: '100%', height: '100%' }}>
|
|
<ec-canvas ec={ec} force-use-old-canvas='true'></ec-canvas>
|
|
</View>
|
|
);
|
|
}
|
|
export default Common;
|
|
|