饼图样式修改

test
zhangdi 1 year ago
parent aa170572c8
commit 076457fd7a
  1. 10
      pages/home/components/eacharts.vue
  2. 131
      pages/home/components/eacharts_nightpie.vue
  3. 6
      pages/home/index.vue

@ -54,12 +54,14 @@ export default {
legend: {
//
data: ["总计", "已完成", "未完成"],
itemWidth: 15,
itemHeight: 10,
},
xAxis: {
data: this.upkeepStatInfo.xData,
},
grid: {
top: "15%",
top: "25%",
left: "10%",
right: "5%",
bottom: "15%",
@ -70,7 +72,7 @@ export default {
name: "总计",
type: "bar",
data: this.upkeepStatInfo.total,
barWidth: 30, //
barWidth: 25, //
barGap: "0", // 0
itemStyle: {
color: "#2478f2",
@ -80,7 +82,7 @@ export default {
name: "已完成",
type: "bar",
data: this.upkeepStatInfo.completed,
barWidth: 30, //
barWidth: 25, //
barGap: "0", // 0
itemStyle: {
color: "#84b7f9",
@ -90,7 +92,7 @@ export default {
name: "未完成",
type: "bar",
data: this.upkeepStatInfo.unCompleted,
barWidth: 30, //
barWidth: 25, //
barGap: "0", // 0
itemStyle: {
color: "#5f9cf8",

@ -0,0 +1,131 @@
<template>
<view class="eacharts-box">
<!-- 饼状图 -->
<view class="echartsPie">
<view class="pie-item">
<view style="height:308rpx;margin-top: 40rpx;"><l-echart ref="chartRefPieLeft" :key="Math.random()"></l-echart></view>
</view>
</view>
</view>
</template>
<script>
import * as echarts from "echarts";
import lEchart from "@/uni_modules/lime-echart/components/lime-echart/";
export default {
components: { lEchart },
props: {
type: {
type: String,
default: "",
},
echartData: {
type: Array,
default: []
}
},
watch: {
echartData(val) {
this.pieInfo = val
this.maintenancePieInit()
}
},
data() {
return {
form: {
searchTime: "",
startTime: "",
endTime: "",
},
pieInfo: [],//
};
},
mounted() { },
methods: {
//
maintenancePieInit() {
let opts = {
series: [
{
name: "",
type: "pie",
radius: [20, 50],
center: ['50%', '50%'],
roseType: 'area',
label: {
// .
normal: {
show: true,
fontSize: 8, // [ default: false ]
position: "outside", // 'outside'线'inside','inner' 'inside','center'
formatter: "{b}\n {c}", //
color: '#000'
},
},
data: this.pieInfo,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 1)",
},
},
labelLine: {
// 线, label 'outside'线
normal: {
show: true, // 线
length: 5, // label 'outside'线
length2: 5,
//
lineStyle: {
// 线
type: "solid",
},
},
},
},
],
};
this.$refs.chartRefPieLeft.init((config) => {
const { canvas } = config;
const chart = echarts.init(canvas, null, config);
chart.setOption(opts);
// chart
return chart;
});
},
},
};
</script>
<style lang="scss" scoped>
.eacharts-box {
background: #fff;
margin: 0 32rpx 32rpx;
border-radius: 20rpx;
overflow: hidden;
.echarts {
width: calc(100% - 64rpx);
height: 368rpx;
margin: 0 auto 20rpx;
}
.echartsPie {
width: calc(100% - 64rpx);
min-height: 308rpx;
margin: 0 auto 0;
.pie-item {
width: 100%;
height: 368rpx;
overflow: hidden;
// float: left;
}
}
}
</style>

@ -39,7 +39,7 @@
<eachartsPie :echartData="pieInfo"></eachartsPie>
<view class="work-title">检修单状态</view>
<eachartsPie :echartData="pieInfo"></eachartsPie>
<eachartsNightpie :echartData="pieInfo"></eachartsNightpie>
<view class="work-title">维修统计</view>
<view class="statistics">
@ -56,12 +56,14 @@ import swiperSlider from "./components/swiper.vue";
import alarm from "./components/alarm.vue";
import eacharts from "./components/eacharts.vue";
import eachartsPie from "./components/eacharts_pie.vue";
import eachartsNightpie from "./components/eacharts_nightpie.vue";
export default {
components: {
swiperSlider,
alarm,
eacharts,
eachartsPie
eachartsPie,
eachartsNightpie
},
data() {
return {

Loading…
Cancel
Save