React Native使用Echarts图表本质是通过webview展示的。 react-native-echarts-pro官网
安装
npm install react-native-echarts-pro --save 或者 yarn add react-native-echarts-pro
环境要求
react-native 版本大于或等于 0.59.
react-native-webview 版本大于或等于 6.9.0.
使用案例
import React from "react";
import { View } from "react-native";
import RNEChartsPro from "react-native-echarts-pro";
export default function RNEPDemo() {
const pieOption = {
series: [
{
name: "Source",
type: "pie",
legendHoverLink: true,
hoverAnimation: true,
avoidLabelOverlap: true,
startAngle: 180,
radius: "55%",
center: ["50%", "35%"],
data: [
{ value: 105.2, name: "android" },
{ value: 310, name: "iOS" },
{ value: 234, name: "web" },
],
label: {
normal: {
show: true,
textStyle: {
fontSize: 12,
color: "#23273C",
},
},
},
},
],
};
return (
);
}
props
methods
推荐阅读
发表评论