This commit is contained in:
duanxiaohai 2024-09-30 13:58:25 +08:00
commit c6bc2a86fa
11 changed files with 1239 additions and 545 deletions

BIN
dist.zip Normal file

Binary file not shown.

View File

@ -76,13 +76,15 @@
> >
集聚类型分布 集聚类型分布
</div> </div>
<Pie3dMt :list="minData.minPieData1"></Pie3dMt> <!-- <Pie3dMt :list="minData.minPieData1"></Pie3dMt> -->
<PieMt :list="minData.minPieData1"></PieMt>
</div> </div>
<div class="minPie"> <div class="minPie">
<div class="minPieImg" @click="showEchartTy('年龄分布')"> <div class="minPieImg" @click="showEchartTy('年龄分布')">
年龄分布 年龄分布
</div> </div>
<Pie3dMt2 :list="minData.minPieData2"></Pie3dMt2> <!-- <Pie3dMt2 :list="minData.minPieData2"></Pie3dMt2> -->
<PieMt2 :list="minData.minPieData2"></PieMt2>
</div> </div>
</div> </div>
@ -260,9 +262,9 @@ import right2 from "./echart_analyze/right2.vue";
import right1 from "./echart_analyze/right1.vue"; import right1 from "./echart_analyze/right1.vue";
import jypx from "./echart_analyze/jypx.vue"; import jypx from "./echart_analyze/jypx.vue";
import http from "@/utils/request.js"; import http from "@/utils/request.js";
import Pie3dMt from "./echart_analyze/pie3dMt.vue";
import Pie3dMt2 from "./echart_analyze/pie3dMt2.vue";
import pie3dMt1 from "./echart_analyze/pie3dMt1.vue"; import pie3dMt1 from "./echart_analyze/pie3dMt1.vue";
import PieMt from "./echart_analyze/pieMt.vue";
import PieMt2 from "./echart_analyze/pieMt2.vue";
import edxs from "./echart_analyze/edXS.vue"; import edxs from "./echart_analyze/edXS.vue";
import eP2 from "./echart_analyze/eP2.vue"; import eP2 from "./echart_analyze/eP2.vue";
import ylXZZC from "./echart_analyze/ylXZZC.vue"; import ylXZZC from "./echart_analyze/ylXZZC.vue";
@ -723,7 +725,9 @@ const tab_change = (index, name) => {
} }
}; };
const chooseXX = (name) => { const chooseXX = (name) => {
if (name == "交通") { console.log(name);
if (name == "公交出行信息推送") {
mapTitle.value = "交通"; mapTitle.value = "交通";
dialogShowMap.value = true; dialogShowMap.value = true;
} }

View File

@ -0,0 +1,230 @@
<template>
<div ref="chart" style="width: 100%; height: 240px"></div>
</template>
<script setup>
import {
onMounted,
onBeforeMount,
ref,
reactive,
defineProps,
nextTick,
} from "vue";
// echarts
import * as echarts from "echarts";
import "echarts-gl";
const props = defineProps({
list: {
type: Object,
},
});
const chart = ref(); // DOM
const data = reactive({
list: [
{
name: "0-18岁", //
num: 0, //
value: 9.67,
},
{
name: "19-60岁",
num: 0,
value: 63.37,
},
{
name: "60岁以上",
num: 0,
value: 26.97,
},
],
option: {},
});
let sum = 0;
let legendData = [];
data.list.forEach((item) => {
sum += item.value * 1; // *1sum
legendData.push(item.name);
});
data.list.push({
name: "总数",
value: sum,
tooltip: { formatter: () => "" },
itemStyle: { normal: { color: "rgba(0, 0, 0, 0)" } },
});
const colorList = [
"#FFE35F",
"#0081FF",
"#8ABEDB",
"#25B9C8",
"#30EB92",
"rgba(69, 244, 245)",
"rgba(7, 166, 255)",
"rgba(255, 208, 118)",
"rgba(109, 168, 198)",
"rgba(255, 255, 255)",
];
const getOption = () => {
data.option = {
//
color: [
"#FFE35F",
"#0081FF",
"#8ABEDB",
"#25B9C8",
"#30EB92",
"rgba(69, 244, 245)",
],
tooltip: {
backgroundColor: "rgba(18, 55, 85, 0.8);",
borderColor: "transparent",
trigger: "item",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
const num = data.list[params.seriesIndex].num;
return (
`<div style='color:#FFFFFF;'>` +
`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
`${params.name}` +
`<span >${num}人</span>` +
`</div>`
);
},
},
legend: {
// formatter: function (params) {
// let value = "";
// let num = "";
// for (let i = 0; i < data.list.length; i++) {
// if (data.list[i].name == params) {
// value = data.list[i].value;
// num=data.list[i].num;
// }
// }
// if (params == "") {
// return ''
// } else if(params == "0-18"){
// // return `${params} ${num} ${value}%`;
// return params+' '+num+''+' '+value+'%'+' ';
// }else if(params == "19-60"){
// return params+' '+num+''+' '+value+'%';
// }else{
// return params+' '+num+''+' '+value+'%';
// }
// },
height: "30%",
//
orient: "vertical",
left: "10%",
bottom: 2,
//
itemGap: 2,
show: true,
icon: "rect",
itemHeight: 12,
itemWidth: 25,
textStyle: {
//
fontSize: 14,
color: "#FFFFFF",
lineHeight: 20,
},
formatter: function (params) {
//
let value = "";
let num = "";
for (let i = 0; i < data.list.length; i++) {
if (data.list[i].name == params) {
value = data.list[i].value;
num=data.list[i].num;
}
}
var arr = [
"{a|" + params + "}",
"{b|" +num + "人}",
"{c|" + value + "% }",
];
if (params == "总数") {
return ''
}else{
return arr.join(" ");
}
},
textStyle: {
//
padding: [8, 15, 0, 10],
rich: {
a: {
color: "#ffffff",
fontSize: 15,
width: 60,
},
b: {
fontSize: 15,
color: "#FFBE53",
width:70,
},
c: {
fontSize: 15,
color: "#ffffff",
},
},
},
},
series: [
{
type: "pie",
radius: ["55%", "85%"],
center: ["50%", "50%"],
startAngle: 180,
itemStyle: {
borderRadius: 0,
borderColor: "#092958",
borderWidth: 2,
},
label: {
show: false,
},
emphasis: {
label: {
show: false,
},
},
data: data.list,
},
],
};
};
const setChart = () => {
var myChart = echarts.init(chart.value);
myChart.setOption(data.option);
// :
window.addEventListener("resize", () => {
myChart.resize();
});
};
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list[0].num = props.list.wfgz;
data.list[1].num = props.list.xstp;
data.list[2].num = props.list.skym;
// data.list[3].num = props.list.xxdc;
// data.list[4].num = props.list.dzzh;
// data.list[5].num = props.list.zq;
getOption();
setChart();
}, 600);
});
</script>
<style scoped></style>

View File

@ -16,9 +16,9 @@ var map = null;
const initMap = () => { const initMap = () => {
map = new BMapGL.Map("map", { minZoom: 11, maxZoom: 20 }); map = new BMapGL.Map("map", { minZoom: 11, maxZoom: 20 });
map.enableScrollWheelZoom(true); map.enableScrollWheelZoom(true);
map.setMapStyleV2({ // map.setMapStyleV2({
styleId: "d0acde891abd157741b71e12670ee2e6", // styleId: "d0acde891abd157741b71e12670ee2e6",
}); // });
goMapCenter([119.178783, 29.034583], 15); goMapCenter([119.178783, 29.034583], 15);
// //
// map.addTileLayer(new BMapGL.TrafficLayer()); // map.addTileLayer(new BMapGL.TrafficLayer());

View File

@ -22,13 +22,13 @@ const props = defineProps({
const chart = ref(); // DOM const chart = ref(); // DOM
// const data = reactive({ const data = reactive({
// list: [], list: [],
// month: [], month: [],
// option: {}, option: {},
// }); });
let data = [ let data1 = [
{ {
name: "高血压", name: "高血压",
value: 40, value: 40,
@ -38,7 +38,10 @@ let data = [
value: 30, value: 30,
}, },
]; ];
let value = data.map((item) => item.value);
// console.log(22, data1);
let value = data1.map((item) => item.value);
let sum = value.reduce((a, b) => { let sum = value.reduce((a, b) => {
return a + b; return a + b;
}); // }); //
@ -46,30 +49,30 @@ let color = ["#ECE09E ", "#78f6f8"];
let series = []; let series = [];
let yAxis = []; let yAxis = [];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data1.length; i++) {
series.push({ series.push({
name: "", name: "",
type: "pie", type: "pie",
clockWise: false, // clockWise: false, //
hoverAnimation: true, // hoverAnimation: true, //
radius: [45 - i * 10 + "%", 41 - i * 10 + "%"], radius: [50 - i * 14 + "%", 65 - i * 18 + "%"],
center: ["40%", "50%"], center: ["40%", "50%"],
label: { label: {
show: false, show: false,
}, },
itemStyle: { itemStyle: {
borderWidth: 60, // borderWidth: 30, //
borderRadius: 60, // borderRadius: 30, //
borderColor: "rgba(0, 0,0, 0)", borderColor: "rgba(0, 0,0, 0)",
borderDashOffset: 20, borderDashOffset: 20,
}, },
data: [ data: [
{ {
value: data[i].value, value: data1[i].value,
name: data[i].name, name: data1[i].name,
}, },
{ {
value: sum - data[i].value, value: sum - data1[i].value,
name: "", name: "",
itemStyle: { itemStyle: {
color: "transparent", color: "transparent",
@ -85,14 +88,14 @@ for (let i = 0; i < data.length; i++) {
z: 1, z: 1,
clockWise: false, // clockWise: false, //
hoverAnimation: true, // hoverAnimation: true, //
radius: [45 - i * 10 + "%", 41 - i * 10 + "%"], radius: [50 - i * 14 + "%", 65 - i * 18 + "%"],
center: ["40%", "50%"], center: ["40%", "50%"],
label: { label: {
show: false, show: false,
}, },
itemStyle: { itemStyle: {
borderWidth: 60, // borderWidth: 30, //
borderRadius: 60, // borderRadius: 30, //
borderColor: "rgba(0, 0,0, 0)", borderColor: "rgba(0, 0,0, 0)",
borderDashOffset: 20, borderDashOffset: 20,
}, },
@ -113,51 +116,15 @@ for (let i = 0; i < data.length; i++) {
}, },
], ],
}); });
yAxis.push("高血压" +((data[i].value / sum) * 100).toFixed(2) + "%");
// yAxis.push("" +((data[1].value / sum) * 100).toFixed(2) + "%");
} }
// yAxis.push("" + data1[0].value);
// yAxis.push("" + data1[1].value);
const getOption = () => { const getOption = () => {
data.option = { data.option = {
color: color, color: color,
// legend: {
// show: true,
// icon: "rect",
// top: "center",
// right: "0%",
// data: name,
// itemWidth: 20,
// itemHeight: 20,
// width: 100,
// itemGap: 40,
// orient: "horizontal",
// formatter: (name) => {
// return (
// "{title|" +
// name +
// "}{value|" +
// data.find((item) => {
// return item.name == name;
// }).value +
// "}{value|}"
// );
// },
// textStyle: {
// rich: {
// title: {
// fontSize: 14,
// padding: [0, 10, 0, 10], // label
// color: "rgb(0, 178, 246)",
// },
// value: {
// fontSize: 12,
// color: "#000",
// },
// },
// },
// },
grid: { grid: {
top: "26%", top: "14%",
left: "40%", left: "40%",
width: "40%", width: "40%",
height: "21%", height: "21%",
@ -191,6 +158,74 @@ const getOption = () => {
}, },
], ],
series: series, series: series,
// [
// {
// name: "",
// type: "pie",
// clockWise: false, //
// hoverAnimation: true, //
// radius: [50 - i * 14 + "%", 65 - i * 18 + "%"],
// center: ["40%", "50%"],
// label: {
// show: false,
// },
// itemStyle: {
// borderWidth: 30, //
// borderRadius: 30, //
// borderColor: "rgba(0, 0,0, 0)",
// borderDashOffset: 20,
// },
// data: [
// {
// value: data1[i].value,
// name: data1[i].name,
// },
// {
// value: sum - data1[i].value,
// name: "",
// itemStyle: {
// color: "transparent",
// },
// hoverAnimation: false,
// },
// ],
// },
// {
// name: "",
// type: "pie",
// silent: true,
// z: 1,
// clockWise: false, //
// hoverAnimation: true, //
// radius: [50 - i * 14 + "%", 65 - i * 18 + "%"],
// center: ["40%", "50%"],
// label: {
// show: false,
// },
// itemStyle: {
// borderWidth: 30, //
// borderRadius: 30, //
// borderColor: "rgba(0, 0,0, 0)",
// borderDashOffset: 20,
// },
// data: [
// {
// value: 7.5,
// itemStyle: {
// color: "#eee",
// },
// hoverAnimation: false,
// },
// {
// value: 2.5,
// itemStyle: {
// color: "rgba(0,0,0,0)",
// },
// hoverAnimation: false,
// },
// ],
// },
// ],
}; };
}; };
const setChart = () => { const setChart = () => {
@ -203,7 +238,10 @@ onBeforeMount(() => {
setTimeout(() => { setTimeout(() => {
data.list = props.list; data.list = props.list;
data.month = props.month; data.month = props.month;
console.log(11,data); data1[0].value = Number(data.list.gxy.rs);
data1[1].value = Number(data.list.fgxy.rs);
yAxis.push("高血压" + data.list.gxy.rs);
yAxis.push("非高血压" + data.list.fgxy.rs);
getOption(); getOption();
setChart(); setChart();

View File

@ -0,0 +1,187 @@
<template>
<div ref="chart" style="width: 100%; height: 240px"></div>
</template>
<script setup>
import {
onMounted,
onBeforeMount,
ref,
reactive,
defineProps,
nextTick,
} from "vue";
// echarts
import * as echarts from "echarts";
import "echarts-gl";
const props = defineProps({
list: {
type: Object,
},
});
const chart = ref(); // DOM
const data = reactive({
list: [
{
value: 2,
name: "危房改造",
},
{
value: 8,
name: "下山脱贫",
},
{
value: 10,
name: "水库移民",
},
{
value: 43,
name: "小县大城",
},
{
value: 15,
name: "地质灾害",
},
{
value: 22,
name: "征迁",
},
],
option: {},
});
let sum = 0;
let legendData = [];
data.list.forEach((item) => {
sum += item.value * 1; // *1sum
legendData.push(item.name);
});
data.list.push({
name: "总数",
value: sum,
tooltip: { formatter: () => "" },
itemStyle: { normal: { color: "rgba(0, 0, 0, 0)" } },
});
const colorList = [
"#FFE35F",
"#0081FF",
"#8ABEDB",
"#25B9C8",
"#30EB92",
"rgba(69, 244, 245)",
"rgba(7, 166, 255)",
"rgba(255, 208, 118)",
"rgba(109, 168, 198)",
"rgba(255, 255, 255)",
];
const getOption = () => {
data.option = {
//
color: [
"#FFE35F",
"#0081FF",
"#8ABEDB",
"#25B9C8",
"#30EB92",
"rgba(69, 244, 245)",
],
tooltip: {
backgroundColor: "rgba(18, 55, 85, 0.8);",
borderColor: "transparent",
trigger: "item",
axisPointer: {
type: "shadow",
},
formatter: function (params) {
return (
`<div style='color:#FFFFFF;'>` +
`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
`${params.name}` +
`<span >${params.value}%</span>` +
`</div>`
);
},
},
legend: {
formatter: function (params) {
var value = "";
for (let i = 0; i < data.list.length; i++) {
if (data.list[i].name == params) {
value = data.list[i].value;
}
}
if (params == "总数") {
} else {
return `${params}${value}%`;
}
},
height: "30%",
//
orient: "vertical",
left: "5%",
bottom: 2,
//
itemGap: 2,
show: true,
icon: "rect",
itemHeight: 12,
itemWidth: 25,
textStyle: {
//
fontSize: 14,
color: "#FFFFFF",
lineHeight: 20,
},
},
series: [
{
type: "pie",
radius: ["55%", "85%"],
center: ["50%", "50%"],
startAngle: 180,
itemStyle: {
borderRadius: 0,
borderColor: "#092958",
borderWidth: 2,
},
label: {
show: false,
},
emphasis: {
label: {
show: false,
},
},
data: data.list,
},
],
};
};
const setChart = () => {
var myChart = echarts.init(chart.value);
myChart.setOption(data.option);
// :
window.addEventListener("resize", () => {
myChart.resize();
});
};
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list[0].num = props.list.wfgz;
data.list[1].num = props.list.xstp;
data.list[2].num = props.list.skym;
data.list[3].num = props.list.xxdc;
data.list[4].num = props.list.dzzh;
data.list[5].num = props.list.zq;
getOption();
setChart();
}, 600);
});
</script>
<style scoped></style>

View File

@ -28,28 +28,29 @@ const chart = ref(); // 创建DOM引用
const data = reactive({ const data = reactive({
list: [], list: [],
// pieData: [ legendData: [],
// { pieData: [
// name: "61-70", // {
// value: "", // name: "61-70岁", //
// }, value: "", //
// { },
// name: "71-80", {
// value: "", name: "71-80岁",
// }, value: "",
// { },
// name: "81-90", {
// value: "", name: "81-90岁",
// }, value: "",
// { },
// name: "91-100", {
// value: "", name: "91-100岁",
// }, value: "",
// { },
// name: "100", {
// value: "", name: "100岁以上",
// }, value: "",
// ], },
],
option: {}, option: {},
}); });
@ -89,466 +90,120 @@ const pieData = reactive([
}, },
]); ]);
// const serData = pieData.map((dItem, index) => {
// return {
// ...dItem,
// value: Number(dItem.value),
// itemStyle: {
// color: colorList[index],
// },
// };
// });
//
// const option = getPie3D(serData, 0.8);
const getOption = () => { const getOption = () => {
const serData = pieData.map((dItem, index) => { data.option = {
return { color: colorList,
...dItem, tooltip: {
value: Number(dItem.value), show: true,
itemStyle: { trigger: "item",
color: colorList[index], textStyle: {
color: "#fff",
}, },
}; backgroundColor: "rgba(16, 32, 40, 0.88)",
}); borderRadius: 4,
data.option = getPie3D(serData, 0.8); borderColor: "#20749e",
}; formatter: (params) => {
// return params.marker + params.name + ': ' + params.value
// 3D return `${params.name}:${params.percent}%`;
function getPie3D(pieData, internalDiameterRatio) { },
let series = []; },
let sumValue = 0; toolbox: {
let startValue = 0;
let endValue = 0;
let legendData = [];
let k =
typeof internalDiameterRatio !== "undefined"
? (1 - internalDiameterRatio) / (1 + internalDiameterRatio)
: 1 / 3;
// series-surface
for (let i = 0; i < pieData.length; i++) {
sumValue += pieData[i].value;
let seriesItem = {
name:
typeof pieData[i].name === "undefined" ? `series${i}` : pieData[i].name,
type: "surface",
parametric: true,
wireframe: {
show: false, show: false,
}, },
pieData: pieData[i], series: [
pieStatus: { {
selected: false, name: "",
hovered: false, type: "pie",
k: 1 / 10, radius: ["50%", "65%"],
// radius: '70%',
center: ["50%", "50%"],
emphasis: {
scale: true, //
}, },
}; label: {
show: false,
if (typeof pieData[i].itemStyle != "undefined") { // formatter: ['{c|{d}%}', '{b|{b}}'].join('\n'),
let itemStyle = {}; formatter: (params) => {
if (params.name !== "") {
typeof pieData[i].itemStyle.color != "undefined" return [`{c|${params.percent}%}`, `{b|${params.name}}`].join(
? (itemStyle.color = pieData[i].itemStyle.color) "\n"
: null;
typeof pieData[i].itemStyle.opacity != "undefined"
? (itemStyle.opacity = pieData[i].itemStyle.opacity)
: null;
seriesItem.itemStyle = itemStyle;
}
series.push(seriesItem);
}
// 使 sumValue getParametricEquation
// series-surface series-surface.parametricEquation
for (let i = 0; i < series.length; i++) {
endValue = startValue + series[i].pieData.value;
series[i].pieData.startRatio = startValue / sumValue;
series[i].pieData.endRatio = endValue / sumValue;
series[i].parametricEquation = getParametricEquation(
series[i].pieData.startRatio,
series[i].pieData.endRatio,
false,
false,
k,
series[i].pieData.value
); );
startValue = endValue;
legendData.push(series[i].name);
} }
},
},
// // data: data1,
// series.push({ },
// name: 'mouseoutSeries', // {
// type: 'surface', // name: "",
// parametric: true, // type: "pie",
// wireframe: { // clockwise: false, //
// emphasis: {
// scale: false, //
// },
// center: ["50%", "50%"],
// radius: ["88%", "88%"],
// label: {
// show: false, // show: false,
// }, // },
// width: '30px', // data: [
// {
// value: 0,
// name: "",
// itemStyle: { // itemStyle: {
// opacity: 0.7, // borderWidth: 1,
// color: '#fff', // borderColor: "rgba(181,221,216,.38)",
// },
// parametricEquation: {
// u: {
// min: 0,
// max: Math.PI * 2,
// step: Math.PI / 20,
// },
// v: {
// min: 0,
// max: Math.PI ,
// step: Math.PI / 20,
// },
// x: function (u, v) {
// return ((Math.sin(v) * Math.sin(u) + Math.sin(u)) / Math.PI);
// },
// y: function (u, v) {
// return ((Math.sin(v) * Math.cos(u) + Math.cos(u)) / Math.PI) ;
// },
// z: function (u, v) {
// return Math.cos(v) > 0 ? -6 : -7;
// }, // },
// }, // },
// });
// legendDataseries
let option = {
//animation: false,
//
// legend: {
// data: legendData,
// color: [
// "#8FD7FC",
// "#466BE7",
// "#F4BB29",
// "#49C384",
// "#8FD7FC",
// "#466BE7",
// "#F4BB29",
// "#49C384",
// ], // ],
// width: "40%",
// //
// orient: "vertical",
// right: 20,
// top: "center",
// //
// itemGap: 10,
// show: true,
// icon: "rect",
// itemHeight: 10,
// itemWidth: 25,
// textStyle: {
// //
// fontSize: 16,
// color: "#FFFFFF",
// lineHeight: 20,
// }, // },
],
};
};
let data1 = [];
const setChart1 = () => {
pieData.forEach((item) => {
item.value = Number(item.value);
});
// pieData value
const totalValue = pieData.reduce((acc, item) => acc + item.value, 0);
// //
// formatter: function (name) { // 10%
// var target; const tenPercentOfTotal = totalValue * 0.05;
// for (var i = 0, l = pieData.length; i < l; i++) { // 使 pieData legend
// if (pieData[i].name == name) { data.legendData = pieData.map((item) => item.name);
// target = pieData[i].value;
// } pieData.forEach((item, index) => {
// } data1.push(
// if (name == "91-100") { {
// return ` ${name} ${target} ${target} ${target} `; value: item.value,
// } else if (name == "100") { name: item.name,
// return ` ${name} ${target} ${target} ${target} `; itemStyle: {
// } else { borderWidth: 1, //
// return ` ${name} ${target} ${target} ${target} `; shadowBlur: 2, //
// } borderColor: colorList[index],
// }, shadowColor: colorList[index],
// },
//
tooltip: {
backgroundColor: "rgba(18, 55, 85, 0.8);",
borderColor: "transparent",
formatter: (params) => {
if (
params.seriesName !== "mouseoutSeries" &&
params.seriesName !== "pie2d"
) {
let bfb = (
(option.series[params.seriesIndex].pieData.endRatio -
option.series[params.seriesIndex].pieData.startRatio) *
100
).toFixed(2);
const value = option.series[params.seriesIndex].pieData.value;
return (
`<div style='color:#FFFFFF;'>` +
`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
`${params.seriesName}<br/>` +
`<span style='margin-right:20px'>${value}人</span>` +
`<span >${bfb}%</span>` +
`</div>`
);
}
}, },
}, },
xAxis3D: {}, {
yAxis3D: {}, //
zAxis3D: {}, silent: true,
grid3D: { name: "gap",
viewControl: { value: tenPercentOfTotal, // 10%
autoRotate: true, itemStyle: {
rotateSensitivity: 0, //0 label: {
zoomSensitivity: 0, //0
panSensitivity: 0, //0
alpha: 25, //( )
distance: 120, //zoom()
},
top: "-30",
left: "0",
width: "100%",
show: false, show: false,
boxHeight: 20,
}, },
series: series, labelLine: {
show: false,
},
color: "transparent",
},
}
);
});
}; };
return option;
}
// series-surface.parametricEquation
function getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
h
) {
//
let midRatio = (startRatio + endRatio) / 2;
let startRadian = startRatio * Math.PI * 2;
let endRadian = endRatio * Math.PI * 2;
let midRadian = midRatio * Math.PI * 2;
//
if (startRatio === 0 && endRatio === 1) {
isSelected = false;
}
// / k 1/3
k = typeof k !== "undefined" ? k : 1 / 3;
// x y 0
let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0;
let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0;
// 1
let hoverRate = isHovered ? 1.05 : 1;
//
return {
u: {
min: -Math.PI,
max: Math.PI * 3,
step: Math.PI / 32,
},
v: {
min: 0,
max: Math.PI * 2,
step: Math.PI / 20,
},
x: function (u, v) {
if (u < startRadian) {
return (
offsetX + Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetX + Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate;
},
y: function (u, v) {
if (u < startRadian) {
return (
offsetY + Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetY + Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate;
},
z: function (u, v) {
if (u < -Math.PI * 0.5) {
return Math.sin(u);
}
if (u > Math.PI * 2.5) {
return Math.sin(u) * h * 0.1;
}
return Math.sin(v) > 0 ? 1 * h * 0.1 : -1;
},
};
}
//
function bindListen(myChart) {
let selectedIndex = "";
let hoveredIndex = "";
//
myChart.on("click", function (params) {
// option.series
let isSelected = !option.series[params.seriesIndex].pieStatus.selected;
let isHovered = option.series[params.seriesIndex].pieStatus.hovered;
let k = option.series[params.seriesIndex].pieStatus.k;
let startRatio = option.series[params.seriesIndex].pieData.startRatio;
let endRatio = option.series[params.seriesIndex].pieData.endRatio;
// option
if (selectedIndex !== "" && selectedIndex !== params.seriesIndex) {
option.series[selectedIndex].parametricEquation = getParametricEquation(
option.series[selectedIndex].pieData.startRatio,
option.series[selectedIndex].pieData.endRatio,
false,
false,
k,
option.series[selectedIndex].pieData.value
);
option.series[selectedIndex].pieStatus.selected = false;
}
// / option
option.series[params.seriesIndex].parametricEquation =
getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[params.seriesIndex].pieData.value
);
option.series[params.seriesIndex].pieStatus.selected = isSelected;
// seriesIndex
isSelected ? (selectedIndex = params.seriesIndex) : null;
// 使 option
myChart.setOption(option);
});
// mouseover
myChart.on("mouseover", function (params) {
//
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
// mouseover
if (hoveredIndex === params.seriesIndex) {
return;
//
} else {
// option
if (hoveredIndex !== "") {
// option.series false
isSelected = option.series[hoveredIndex].pieStatus.selected;
isHovered = false;
startRatio = option.series[hoveredIndex].pieData.startRatio;
endRatio = option.series[hoveredIndex].pieData.endRatio;
k = option.series[hoveredIndex].pieStatus.k;
// option
option.series[hoveredIndex].parametricEquation = getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[hoveredIndex].pieData.value
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = "";
}
// mouseover option
if (
params.seriesName !== "mouseoutSeries" &&
params.seriesName !== "pie2d"
) {
// option.series true
isSelected = option.series[params.seriesIndex].pieStatus.selected;
isHovered = true;
startRatio = option.series[params.seriesIndex].pieData.startRatio;
endRatio = option.series[params.seriesIndex].pieData.endRatio;
k = option.series[params.seriesIndex].pieStatus.k;
// option
option.series[params.seriesIndex].parametricEquation =
getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[params.seriesIndex].pieData.value + 5
);
option.series[params.seriesIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = params.seriesIndex;
}
// 使 option
myChart.setOption(option);
}
});
// bug
myChart.on("globalout", function () {
//
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
if (hoveredIndex !== "") {
// option.series true
isSelected = option.series[hoveredIndex].pieStatus.selected;
isHovered = false;
k = option.series[hoveredIndex].pieStatus.k;
startRatio = option.series[hoveredIndex].pieData.startRatio;
endRatio = option.series[hoveredIndex].pieData.endRatio;
// option
option.series[hoveredIndex].parametricEquation = getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[hoveredIndex].pieData.value
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = "";
}
// 使 option
myChart.setOption(option);
});
}
// 使
// onMounted(() => {
// // domecharts
// // var myChart = echarts.init(document.getElementById('main'));
// // Vue3
// var myChart = echarts.init(chart.value);
// //
// // bindListen(myChart)
// // init(); // vue3.2this
// // 使
// myChart.setOption(option);
// // :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
// });
const setChart = () => { const setChart = () => {
var myChart = echarts.init(chart.value); var myChart = echarts.init(chart.value);
myChart.setOption(data.option); myChart.setOption(data.option);
@ -567,6 +222,7 @@ onBeforeMount(() => {
pieData[3].value = data.list.nl9099; pieData[3].value = data.list.nl9099;
pieData[4].value = data.list.nl100; pieData[4].value = data.list.nl100;
setChart1();
getOption(); getOption();
setChart(); setChart();
}, 600); }, 600);

View File

@ -0,0 +1,576 @@
<template>
<div ref="chart" style="width: 40%; height: 200px"></div>
</template>
<script setup>
import {
onMounted,
onBeforeMount,
ref,
reactive,
defineProps,
nextTick,
} from "vue";
// echarts
import * as echarts from "echarts";
import "echarts-gl";
const props = defineProps({
list: {
type: Object,
default: () => {
return [];
},
},
});
const chart = ref(); // DOM
const data = reactive({
list: [],
// pieData: [
// {
// name: "61-70", //
// value: "", //
// },
// {
// name: "71-80",
// value: "",
// },
// {
// name: "81-90",
// value: "",
// },
// {
// name: "91-100",
// value: "",
// },
// {
// name: "100",
// value: "",
// },
// ],
option: {},
});
const colorList = [
"#FFE35F",
"#0081FF",
"#8ABEDB",
"#25B9C8",
"#30EB92",
"rgba(69, 244, 245)",
"rgba(7, 166, 255)",
"rgba(255, 208, 118)",
"rgba(109, 168, 198)",
"rgba(255, 255, 255)",
];
const pieData = reactive([
{
name: "60-69岁", //
value: 0, //
},
{
name: "70-79岁",
value: 0,
},
{
name: "80-89岁",
value: 0,
},
{
name: "90-99岁",
value: 0,
},
{
name: "100岁以上",
value: 0,
},
]);
// const serData = pieData.map((dItem, index) => {
// return {
// ...dItem,
// value: Number(dItem.value),
// itemStyle: {
// color: colorList[index],
// },
// };
// });
//
// const option = getPie3D(serData, 0.8);
const getOption = () => {
const serData = pieData.map((dItem, index) => {
return {
...dItem,
value: Number(dItem.value),
itemStyle: {
color: colorList[index],
},
};
});
data.option = getPie3D(serData, 0.8);
};
// 3D
function getPie3D(pieData, internalDiameterRatio) {
let series = [];
let sumValue = 0;
let startValue = 0;
let endValue = 0;
let legendData = [];
let k =
typeof internalDiameterRatio !== "undefined"
? (1 - internalDiameterRatio) / (1 + internalDiameterRatio)
: 1 / 3;
// series-surface
for (let i = 0; i < pieData.length; i++) {
sumValue += pieData[i].value;
let seriesItem = {
name:
typeof pieData[i].name === "undefined" ? `series${i}` : pieData[i].name,
type: "surface",
parametric: true,
wireframe: {
show: false,
},
pieData: pieData[i],
pieStatus: {
selected: false,
hovered: false,
k: 1 / 10,
},
};
if (typeof pieData[i].itemStyle != "undefined") {
let itemStyle = {};
typeof pieData[i].itemStyle.color != "undefined"
? (itemStyle.color = pieData[i].itemStyle.color)
: null;
typeof pieData[i].itemStyle.opacity != "undefined"
? (itemStyle.opacity = pieData[i].itemStyle.opacity)
: null;
seriesItem.itemStyle = itemStyle;
}
series.push(seriesItem);
}
// 使 sumValue getParametricEquation
// series-surface series-surface.parametricEquation
for (let i = 0; i < series.length; i++) {
endValue = startValue + series[i].pieData.value;
series[i].pieData.startRatio = startValue / sumValue;
series[i].pieData.endRatio = endValue / sumValue;
series[i].parametricEquation = getParametricEquation(
series[i].pieData.startRatio,
series[i].pieData.endRatio,
false,
false,
k,
series[i].pieData.value
);
startValue = endValue;
legendData.push(series[i].name);
}
// //
// series.push({
// name: 'mouseoutSeries',
// type: 'surface',
// parametric: true,
// wireframe: {
// show: false,
// },
// width: '30px',
// itemStyle: {
// opacity: 0.7,
// color: '#fff',
// },
// parametricEquation: {
// u: {
// min: 0,
// max: Math.PI * 2,
// step: Math.PI / 20,
// },
// v: {
// min: 0,
// max: Math.PI ,
// step: Math.PI / 20,
// },
// x: function (u, v) {
// return ((Math.sin(v) * Math.sin(u) + Math.sin(u)) / Math.PI);
// },
// y: function (u, v) {
// return ((Math.sin(v) * Math.cos(u) + Math.cos(u)) / Math.PI) ;
// },
// z: function (u, v) {
// return Math.cos(v) > 0 ? -6 : -7;
// },
// },
// });
// legendDataseries
let option = {
//animation: false,
//
// legend: {
// data: legendData,
// color: [
// "#8FD7FC",
// "#466BE7",
// "#F4BB29",
// "#49C384",
// "#8FD7FC",
// "#466BE7",
// "#F4BB29",
// "#49C384",
// ],
// width: "40%",
// //
// orient: "vertical",
// right: 20,
// top: "center",
// //
// itemGap: 10,
// show: true,
// icon: "rect",
// itemHeight: 10,
// itemWidth: 25,
// textStyle: {
// //
// fontSize: 16,
// color: "#FFFFFF",
// lineHeight: 20,
// },
// //
// formatter: function (name) {
// var target;
// for (var i = 0, l = pieData.length; i < l; i++) {
// if (pieData[i].name == name) {
// target = pieData[i].value;
// }
// }
// if (name == "91-100") {
// return ` ${name} ${target} ${target} ${target} `;
// } else if (name == "100") {
// return ` ${name} ${target} ${target} ${target} `;
// } else {
// return ` ${name} ${target} ${target} ${target} `;
// }
// },
// },
//
tooltip: {
backgroundColor: "rgba(18, 55, 85, 0.8);",
borderColor: "transparent",
formatter: (params) => {
if (
params.seriesName !== "mouseoutSeries" &&
params.seriesName !== "pie2d"
) {
let bfb = (
(option.series[params.seriesIndex].pieData.endRatio -
option.series[params.seriesIndex].pieData.startRatio) *
100
).toFixed(2);
const value = option.series[params.seriesIndex].pieData.value;
return (
`<div style='color:#FFFFFF;'>` +
`<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${params.color};"></span>` +
`${params.seriesName}<br/>` +
`<span style='margin-right:20px'>${value}人</span>` +
`<span >${bfb}%</span>` +
`</div>`
);
}
},
},
xAxis3D: {},
yAxis3D: {},
zAxis3D: {},
grid3D: {
viewControl: {
autoRotate: true,
rotateSensitivity: 0, //0
zoomSensitivity: 0, //0
panSensitivity: 0, //0
alpha: 25, //( )
distance: 120, //zoom()
},
top: "-30",
left: "0",
width: "100%",
show: false,
boxHeight: 20,
},
series: series,
};
return option;
}
// series-surface.parametricEquation
function getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
h
) {
//
let midRatio = (startRatio + endRatio) / 2;
let startRadian = startRatio * Math.PI * 2;
let endRadian = endRatio * Math.PI * 2;
let midRadian = midRatio * Math.PI * 2;
//
if (startRatio === 0 && endRatio === 1) {
isSelected = false;
}
// / k 1/3
k = typeof k !== "undefined" ? k : 1 / 3;
// x y 0
let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0;
let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0;
// 1
let hoverRate = isHovered ? 1.05 : 1;
//
return {
u: {
min: -Math.PI,
max: Math.PI * 3,
step: Math.PI / 32,
},
v: {
min: 0,
max: Math.PI * 2,
step: Math.PI / 20,
},
x: function (u, v) {
if (u < startRadian) {
return (
offsetX + Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetX + Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate;
},
y: function (u, v) {
if (u < startRadian) {
return (
offsetY + Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetY + Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate;
},
z: function (u, v) {
if (u < -Math.PI * 0.5) {
return Math.sin(u);
}
if (u > Math.PI * 2.5) {
return Math.sin(u) * h * 0.1;
}
return Math.sin(v) > 0 ? 1 * h * 0.1 : -1;
},
};
}
//
function bindListen(myChart) {
let selectedIndex = "";
let hoveredIndex = "";
//
myChart.on("click", function (params) {
// option.series
let isSelected = !option.series[params.seriesIndex].pieStatus.selected;
let isHovered = option.series[params.seriesIndex].pieStatus.hovered;
let k = option.series[params.seriesIndex].pieStatus.k;
let startRatio = option.series[params.seriesIndex].pieData.startRatio;
let endRatio = option.series[params.seriesIndex].pieData.endRatio;
// option
if (selectedIndex !== "" && selectedIndex !== params.seriesIndex) {
option.series[selectedIndex].parametricEquation = getParametricEquation(
option.series[selectedIndex].pieData.startRatio,
option.series[selectedIndex].pieData.endRatio,
false,
false,
k,
option.series[selectedIndex].pieData.value
);
option.series[selectedIndex].pieStatus.selected = false;
}
// / option
option.series[params.seriesIndex].parametricEquation =
getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[params.seriesIndex].pieData.value
);
option.series[params.seriesIndex].pieStatus.selected = isSelected;
// seriesIndex
isSelected ? (selectedIndex = params.seriesIndex) : null;
// 使 option
myChart.setOption(option);
});
// mouseover
myChart.on("mouseover", function (params) {
//
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
// mouseover
if (hoveredIndex === params.seriesIndex) {
return;
//
} else {
// option
if (hoveredIndex !== "") {
// option.series false
isSelected = option.series[hoveredIndex].pieStatus.selected;
isHovered = false;
startRatio = option.series[hoveredIndex].pieData.startRatio;
endRatio = option.series[hoveredIndex].pieData.endRatio;
k = option.series[hoveredIndex].pieStatus.k;
// option
option.series[hoveredIndex].parametricEquation = getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[hoveredIndex].pieData.value
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = "";
}
// mouseover option
if (
params.seriesName !== "mouseoutSeries" &&
params.seriesName !== "pie2d"
) {
// option.series true
isSelected = option.series[params.seriesIndex].pieStatus.selected;
isHovered = true;
startRatio = option.series[params.seriesIndex].pieData.startRatio;
endRatio = option.series[params.seriesIndex].pieData.endRatio;
k = option.series[params.seriesIndex].pieStatus.k;
// option
option.series[params.seriesIndex].parametricEquation =
getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[params.seriesIndex].pieData.value + 5
);
option.series[params.seriesIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = params.seriesIndex;
}
// 使 option
myChart.setOption(option);
}
});
// bug
myChart.on("globalout", function () {
//
let isSelected;
let isHovered;
let startRatio;
let endRatio;
let k;
if (hoveredIndex !== "") {
// option.series true
isSelected = option.series[hoveredIndex].pieStatus.selected;
isHovered = false;
k = option.series[hoveredIndex].pieStatus.k;
startRatio = option.series[hoveredIndex].pieData.startRatio;
endRatio = option.series[hoveredIndex].pieData.endRatio;
// option
option.series[hoveredIndex].parametricEquation = getParametricEquation(
startRatio,
endRatio,
isSelected,
isHovered,
k,
option.series[hoveredIndex].pieData.value
);
option.series[hoveredIndex].pieStatus.hovered = isHovered;
// seriesIndex
hoveredIndex = "";
}
// 使 option
myChart.setOption(option);
});
}
// 使
// onMounted(() => {
// // domecharts
// // var myChart = echarts.init(document.getElementById('main'));
// // Vue3
// var myChart = echarts.init(chart.value);
// //
// // bindListen(myChart)
// // init(); // vue3.2this
// // 使
// myChart.setOption(option);
// // :
// window.addEventListener("resize", () => {
// myChart.resize();
// });
// });
const setChart = () => {
var myChart = echarts.init(chart.value);
myChart.setOption(data.option);
// :
window.addEventListener("resize", () => {
myChart.resize();
});
};
// 使
onBeforeMount(() => {
setTimeout(() => {
data.list = props.list;
pieData[0].value = data.list.nl6069;
pieData[1].value = data.list.nl7079;
pieData[2].value = data.list.nl8089;
pieData[3].value = data.list.nl9099;
pieData[4].value = data.list.nl100;
getOption();
setChart();
}, 600);
});
</script>
<style scoped></style>

View File

@ -140,7 +140,6 @@ const login = () => {
.then((res) => { .then((res) => {
// let auth__code = env == "pc" ? res.auth_code : res.code; // let auth__code = env == "pc" ? res.auth_code : res.code;
// console.log( 555,res, auth__code); // console.log( 555,res, auth__code);
a1.value = res.auth_code
if (res.auth_code) { if (res.auth_code) {
http http
.post(`/api/ggfwyth/ding/one_click_login?authCode=${res.auth_code}`) .post(`/api/ggfwyth/ding/one_click_login?authCode=${res.auth_code}`)

View File

@ -432,7 +432,6 @@ import Dialog from "./dialog/dialogMapDp.vue";
import DialogCamera from "./dialog/dialogCameras.vue"; import DialogCamera from "./dialog/dialogCameras.vue";
import personDetail from "./person/index.vue"; import personDetail from "./person/index.vue";
// import gcj02towgs84 from "@/utils/gcj02towgs84.js"; // import gcj02towgs84 from "@/utils/gcj02towgs84.js";
// import { DrawScene, AreaMeasure, MarkerDraw } from "bmap-draw";
import { import {
DrawScene, DrawScene,
PolygonDraw, PolygonDraw,
@ -3659,7 +3658,9 @@ const addPolygonCounty = () => {
} }
if (title_jd.value == item.name) { if (title_jd.value == item.name) {
} else { } else {
setTimeout(() => {
title_jd.value = item.name; title_jd.value = item.name;
}, 1000);
} }
} }
}); });
@ -3874,6 +3875,9 @@ const addPolygonCountyCs = () => {
if (drawing.value) { if (drawing.value) {
return; return;
} }
if (!title_jd.value) {
return;
}
loadingss.value = true; loadingss.value = true;
cs_dd_arr.value = []; cs_dd_arr.value = [];
xuanzhongCs.value = []; xuanzhongCs.value = [];
@ -4344,9 +4348,9 @@ onMounted(async () => {
} }
if (!isWebGLAvailable()) { if (!isWebGLAvailable()) {
alert("您的浏览器不支持WebGL。"); console.log("您的浏览器不支持WebGL。");
} else { } else {
alert("您的浏览器支持WebGL。"); console.log("您的浏览器支持WebGL。");
} }
loadingss.value = true; loadingss.value = true;

View File

@ -83,7 +83,7 @@
<div class="moveImg"></div> <div class="moveImg"></div>
<div class="mtpImg1"></div> <div class="mtpImg1"></div>
<div class="mtpImg2"></div> <div class="mtpImg2"></div>
<div class="mtpImg3"></div> <!-- <div class="mtpImg3"></div> -->
<div class="mtpText1">{{ data.oldAgeTotal }}</div> <div class="mtpText1">{{ data.oldAgeTotal }}</div>
<div class="mtpText2">{{ data.oldAgePercent }}%</div> <div class="mtpText2">{{ data.oldAgePercent }}%</div>
</div> </div>