在移动端开发图表,uniapp+echarts,必要特殊处理惩罚,使用renderjs ...

打印 上一主题 下一主题

主题 843|帖子 843|积分 2531

1.首先要创建一个组件warning,用来装图表(我排除绿色那段代码为我的需求,不是必要代码)
<template>
     <div class="task_container">
         <div class="pop_body">
             <div class="footer">
                 <warningchild ref="childRef" class="jiuming" id="chartwaring" width="100%" height="100%"
                     ption="option13">
                 </warningchild>

             </div>

         </div>
     </div>
</template>
<script>
     import warningchild from '@/components/echarts/warningchild'
     import {
         mapGetters
     } from 'vuex';
     export default {
         components: {
             warningchild
         },
         data() {
             return {
                 activeButton: 0,
                 option13: {},
                 option131: {},
                 option132: {},
                 option133: {},
                 namearray: [],
                 valuearray: [],
                 buttons: ['今日', '昨日', '7天', '30天'],
                 reslist: [],
                 reslist1: [],
                 reslist2: [],
                 reslist3: [],
                 datalist: [],
                 datalist1: [],
                 datalist2: [],
                 datalist3: [],
                 data: [{
                         value: 20,
                         // legendname: "种类01",
                         name: "处理惩罚中",
                         // itemStyle: { color: "#8d7fec" }
                         itemStyle: {
                             borderColor: 'rgba(255, 255, 255, 0.1)',
                             // shadowBlur: 10,
                             borderRadius: 80,
                             color: "#4A75FF",
                             shadowColor: 'rgba(255, 255, 255, 1)'
                         }
                     },
                     {
                         value: 19,
                         legendname: "种类03",
                         name: "待处理惩罚",
                         itemStyle: {
                             color: "#01B4FF",
                             borderColor: 'rgba(255, 255, 255, 0.1)',
                             // shadowBlur: 10,
                             borderRadius: 80,
                             shadowColor: 'rgba(142, 152, 241, 1)'
                         },
                     },
                     {
                         value: 24,
                         legendname: "",
                         name: "审核中",
                         itemStyle: {
                             color: "#23EABD",
                             borderColor: 'rgba(255, 255, 255, 0.1)',
                             // shadowBlur: 10,
                             borderRadius: 80,
                             shadowColor: 'rgba(142, 152, 241, 1)'
                         },
                     },
                     {
                         value: 32,
                         legendname: "",
                         name: "已处理惩罚",
                         itemStyle: {
                             color: "#FF7482",
                             borderColor: 'rgba(255, 255, 255, 0.1)',
                             // shadowBlur: 10,
                             borderRadius: 80,
                             shadowColor: 'rgba(142, 152, 241, 1)'
                         },
                     },
                 ]
             }
         },
     
         methods: {
             getcount() {
                 console.log('sisisisiis')
                 this.$http.get(`///`
                     // {
                     //     params: {
                     //         eventStatus: buttonIndex
                     //     }
                     // },
                 ).then(res => {
                     this.reslist = res.data.result
                     console.log("warning", res.data.result)
                     this.modifiedCountList()
                     this.option13 = {
                         title: [
                         ],

                         series: [{
                             // name: "标题",
                             type: "pie",
                             center: ["50%", "50%"],
                             // zuoyou/shangxia
                             radius: ["60%", "65%"],
                             width: 'auto',
                             height: 150,
                             clockwise: false, //饼图的扇区是否是顺时针排布
                             avoidLabelOverlap: false,
                             label: {
                                 normal: {
                                     show: false,
                                     position: "outter",
                                     // formatter: function(parms) {
                                     //     return parms.datalist.name;
                                     // },
                                 },
                             },
                             labelLine: {
                                 normal: {
                                     length: 5,
                                     length2: 3,
                                     smooth: true,
                                 },
                             },
                             itemStyle: { // 此设置
                                 normal: {
                                     borderWidth: 3,
                                     borderColor: 'rgba(0, 0, 0, 0.5)',
                                 },
                             },
                             data: this.datalist
                         }, ],
                     }
                     this.$refs.childRef.changeonlys(this.option13);
                  
                 })
             },

             handleButtonClick(buttonIndex) {
                 this.activeButton = buttonIndex;
                 if (this.activeButton == 0) {
                     this.getcount()
                 } else if (
                     this.activeButton == 1
                 ) {
                     this.getcount1()
                 } else if (this.activeButton == 2) {
                     this.getcount2()
                 } else if (this.activeButton == 3) {
                     this.getcount3()
                 }

                 // this.getcount()
                 // this.getcount1()
                 // this.getcount2()
                 // this.getcount3()
             },
             modifiedCountList() {
                 // 界说不同警报级别的 itemStyle 设置
                 const alertStyles = {
                     '橙色': {
                         borderColor: 'rgba(255, 255, 255, 0.1)',
                         borderRadius: 80,
                         color: "#FE7B41",
                         shadowColor: 'rgba(255, 255, 255

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

拉不拉稀肚拉稀

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表