After Width: | Height: | Size: 1007 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div style="height: 100%; width: 100%">
|
||||
<g-chart :echartdata="option"></g-chart>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
chartObj: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
option: {},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.setOption();
|
||||
},
|
||||
methods: {
|
||||
setOption() {
|
||||
let dataList = this.chartObj.data;
|
||||
let maxArr = [];
|
||||
let maxValue = 0;
|
||||
let xData = [];
|
||||
let yData = [];
|
||||
let total = 0;
|
||||
|
||||
dataList.forEach((item) => {
|
||||
xData.push(item.name);
|
||||
yData.push(item.value);
|
||||
if (maxValue < item.value) {
|
||||
maxValue = item.value;
|
||||
}
|
||||
});
|
||||
dataList.forEach((item) => {
|
||||
maxArr.push(maxValue);
|
||||
total = total + item.value;
|
||||
});
|
||||
if (!total) {
|
||||
total = 1;
|
||||
}
|
||||
|
||||
this.option = {
|
||||
grid: {
|
||||
left: "14",
|
||||
top: "5%", // 设置条形图的边距
|
||||
right: "0",
|
||||
bottom: "0",
|
||||
},
|
||||
xAxis: {
|
||||
show: false,
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: "category",
|
||||
inverse: true,
|
||||
data: xData,
|
||||
axisLine: {
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
verticalAlign: "bottom",
|
||||
color: "#299CD4",
|
||||
fontSize: 14,
|
||||
fontFamily: "Microsoft YaHei",
|
||||
align: "left",
|
||||
padding: [0, 0, 5, 0],
|
||||
rich: {
|
||||
index: {
|
||||
padding: [4, 0, 0, 8],
|
||||
color: "#ffffff",
|
||||
},
|
||||
name: {
|
||||
padding: [4, 8, 0, 2],
|
||||
color: "#ffffff",
|
||||
fontSize: 14,
|
||||
},
|
||||
rate: {
|
||||
align: "right",
|
||||
color: "rgba(255,255,255,0.9)",
|
||||
fontSize: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
formatter: (name, index) => {
|
||||
const _index = index + 1;
|
||||
if (dataList.length) {
|
||||
const item = dataList.filter((item) => item.name == name)[0];
|
||||
return `{index|${_index}.} {name|${name}}`;
|
||||
}
|
||||
},
|
||||
},
|
||||
offset: 0,
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
// 内
|
||||
type: "bar",
|
||||
barWidth: 6,
|
||||
itemStyle: {
|
||||
color: (params) => {
|
||||
var color = {
|
||||
type: "linear",
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 1,
|
||||
y2: 0,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0,
|
||||
color: this.chartObj.color[0], // 0% 处的颜色
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: this.chartObj.color[1], // 100% 处的颜色
|
||||
},
|
||||
],
|
||||
};
|
||||
return color;
|
||||
},
|
||||
},
|
||||
label: {
|
||||
show: false,
|
||||
},
|
||||
data: dataList,
|
||||
z: 2,
|
||||
animationEasing: "elasticOut",
|
||||
},
|
||||
{
|
||||
// 外边框
|
||||
type: "pictorialBar",
|
||||
symbol: "rect",
|
||||
symbolBoundingData: maxValue,
|
||||
barWidth: 1,
|
||||
itemStyle: {
|
||||
barBorderRadius: 10,
|
||||
normal: {
|
||||
color: "none",
|
||||
},
|
||||
},
|
||||
label: {
|
||||
padding: [-20, 10, 0, -40],
|
||||
textStyle: {
|
||||
rich: {
|
||||
value: {
|
||||
width: 54,
|
||||
padding: [4, 10, 0, -60],
|
||||
color: "#9CE0FF",
|
||||
fontSize: 14,
|
||||
},
|
||||
rate: {
|
||||
fontSize: 14,
|
||||
color: "#9CE0FF",
|
||||
},
|
||||
},
|
||||
},
|
||||
formatter: (params) => {
|
||||
var text = `{rate|${params.data}次}`; // `{{f|(params.data / total) * 100 + %}`;
|
||||
return text;
|
||||
},
|
||||
|
||||
rich: {
|
||||
a: {
|
||||
color: "#9CE0FF",
|
||||
fontSize: 16,
|
||||
align: "right",
|
||||
},
|
||||
},
|
||||
position: "right",
|
||||
distance: 1, // 向右偏移位置
|
||||
show: true,
|
||||
},
|
||||
data: yData,
|
||||
z: 0,
|
||||
animationEasing: "elasticOut",
|
||||
},
|
||||
{
|
||||
name: "外框",
|
||||
type: "pictorialBar",
|
||||
symbol: "rect",
|
||||
symbolBoundingData: maxValue,
|
||||
barGap: "-100%", // 设置外框粗细
|
||||
data: maxArr,
|
||||
barWidth: 6,
|
||||
itemStyle: {
|
||||
color: "rgba(255,255,255,0.06)", // 填充色
|
||||
label: {
|
||||
// 标签显示位置
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
z: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chartObj: {
|
||||
handler(newval) {
|
||||
this.setOption();
|
||||
},
|
||||
deep: true,
|
||||
// immediate: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<div style="height: 100%; width: 100%" id="pieWrap">
|
||||
<g-chart :echartdata="option"></g-chart>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
chartObj: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
option: {},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.setOption();
|
||||
},
|
||||
methods: {
|
||||
setOption() {
|
||||
let point = this.chartObj.point; //环形图的具体 百分比
|
||||
let total = this.chartObj.total;
|
||||
|
||||
this.option = {
|
||||
tooltip: {
|
||||
show: false,
|
||||
},
|
||||
title: {
|
||||
// 圆环中央文字
|
||||
show: true, // 是否显示
|
||||
text: this.chartObj.name,
|
||||
textStyle: { fontSize: 10, color: "#D0DEEE" },
|
||||
/* subtextStyle: {
|
||||
fontSize: 18,
|
||||
fontWeight: 500,
|
||||
lineHeight: 10,
|
||||
color: "#E3FEFF",
|
||||
}, */
|
||||
textAlign: "center",
|
||||
left: "47%",
|
||||
top: 55,
|
||||
},
|
||||
color: this.chartObj.color,
|
||||
graphic: {
|
||||
elements: [
|
||||
{
|
||||
type: "image",
|
||||
style: {
|
||||
image: this.chartObj.icon,
|
||||
width: 80,
|
||||
height: 80,
|
||||
zIndex: 1,
|
||||
},
|
||||
left: "center",
|
||||
top: -10,
|
||||
},
|
||||
],
|
||||
},
|
||||
series: [
|
||||
{
|
||||
// name: '访问来源1',
|
||||
type: "pie",
|
||||
radius: [15, 20],
|
||||
center: ["center", 30],
|
||||
data: [
|
||||
{
|
||||
value: 100, //对应显示的部分数据即100%
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderRadius: 15,
|
||||
color: "#1B2221",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
label: {
|
||||
position: "center",
|
||||
formatter: ((100 * point) / total).toFixed(0) + "%",
|
||||
color: this.chartObj.color[0],
|
||||
fontSize: 12,
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
// name: '访问来源2',
|
||||
type: "pie",
|
||||
showEmptyCircle: true, //是否在无数据的时候显示一个占位圆。
|
||||
radius: [15, 20],
|
||||
center: ["center", 30],
|
||||
avoidLabelOverlap: true, // 标签重叠时进行调整
|
||||
data: [
|
||||
{
|
||||
value: (point / total) * 100,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderRadius: 15, //圆角
|
||||
color: {
|
||||
// 设置渐变色
|
||||
type: "linear",
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0,
|
||||
color: this.chartObj.color[1], // 0% 处的颜色
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: this.chartObj.color[2], // 100% 处的颜色
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
value: 120, //百分比
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "rgba(255,255,255,0)", //透明
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
label: {
|
||||
show: false,
|
||||
position: "center",
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
getHeight() {
|
||||
let div = document.getElementById("pieWrap");
|
||||
return div.clientHeight;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chartObj: {
|
||||
handler(newval) {
|
||||
this.setOption();
|
||||
},
|
||||
deep: true,
|
||||
// immediate: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="subColWrap">
|
||||
<div class="subColIcon"></div>
|
||||
<div class="subColName">{{ title }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return "";
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "@/loveflow/assets/index.scss";
|
||||
|
||||
.subColWrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: vw(30);
|
||||
background: url("~@/assets/images/topic/fsT.png") no-repeat center center;
|
||||
background-size: 100% 100%;
|
||||
.subColIcon {
|
||||
width: vw(34);
|
||||
height: vw(36);
|
||||
background: url("~@/assets/images/topic/fsIcon.png") no-repeat center center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.subColName {
|
||||
font-size: vw(14);
|
||||
color: #d9e7ff;
|
||||
}
|
||||
}
|
||||
</style>
|