| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <!-- 虫害饼状图-->
- <view>
- <ui-charts ref="ringChart" :loadingType="0" type="ring" :opts="opts" :chartData="chartData"></ui-charts>
- </view>
- </template>
- <script>
- /**
- * 虫害饼状图
- * @example <w-ring-charts :chartData="chartData"></w-ring-charts>
- * @description 统计图官方说明文档 https://www.ucharts.cn
- */
- export default {
- name: 'w-ring-charts',
- data() {
- return {
- opts: {
- rotate: false,
- rotateLock: false,
- color: ["#43B693", "#317AFD", "#8543E0"],
- padding: [10, 10, 10, 10],
- dataLabel: true,
- legend: {
- show: false,
- position: "right",
- lineHeight: 25
- },
- title: {
- name: "收益率",
- fontSize: 14,
- color: "#4E5969"
- },
- subtitle: {
- name: "70%",
- fontSize: 16,
- color: "#4E5969"
- },
- extra: {
- ring: {
- ringWidth: 36,
- activeOpacity: 0.5,
- activeRadius: 10,
- offsetAngle: 0,
- labelWidth: 15,
- border: true,
- borderWidth: 3,
- borderColor: "#FFFFFF"
- }
- }
- }
- }
- },
- props: {
- chartData: {
- type: [Array, Object],
- default () {
- return []
- }
- },
- // 标题
- title: String,
- // 副标题
- subtitle: String,
- color:{
- type:[Array],
- default () {
- return ["#43B693", "#317AFD", "#8543E0"]
- }
- }
- },
- watch: {
- chartData: {
- deep: true, // 深度监听
- handler(val) {
- this.initData();
- }
- }
- },
- mounted() {
- this.initData();
- },
- methods: {
- // 初始化数据
- initData(){
- this.opts.title = this.title;
- this.opts.subtitle = this.subtitle;
- this.opts.color=this.color;
- }
- }
- };
- </script>
- <style lang="scss">
- </style>
|