|
@@ -2,6 +2,12 @@
|
|
|
<div id="populationStructure">
|
|
|
<img src="../../assets/png/renkoutuli.png" id="renkou">
|
|
|
<div id="pop"></div>
|
|
|
+ <div id="num50">50</div>
|
|
|
+ <div id="num100">100</div>
|
|
|
+ <div id="num150">150</div>
|
|
|
+ <div id="num200">200</div>
|
|
|
+ <div id="num250">250</div>
|
|
|
+ <div id="form"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -18,7 +24,7 @@
|
|
|
},
|
|
|
mounted() {
|
|
|
let clear = setInterval(() => {
|
|
|
- // console.log("this.data", this.psdata)
|
|
|
+ // console.log("this.data", this.psdata)
|
|
|
if (this.psdata) {
|
|
|
this.init()
|
|
|
clearInterval(clear)
|
|
@@ -45,9 +51,27 @@
|
|
|
shadowYData.push(this.psdata.filter(d => d.name == "60-80岁")[0].total);
|
|
|
shadowYData.push(this.psdata.filter(d => d.name == "80岁以上")[0].total);
|
|
|
|
|
|
- // console.log("this.yData", this.yData)
|
|
|
+ // console.log("this.psdata", this.psdata)
|
|
|
// console.log(this.shadowYData)
|
|
|
|
|
|
+ myChart.on("mouseover", function (params) {
|
|
|
+ // console.log("params",params)
|
|
|
+ if(params.name=="18以下"){
|
|
|
+ document.getElementById("form").innerText="男:"+yData[0]+" \n女:"+(shadowYData[0]-yData[0]);
|
|
|
+ document.getElementById("form").setAttribute('style',"position: absolute;width: 60px;height: 40px;left: 15%;top:50%;font-size: 10px;color: aliceblue;");
|
|
|
+ }else if(params.name=="18-60"){
|
|
|
+ document.getElementById("form").innerText="男:"+yData[1]+" \n女:"+(shadowYData[1]-yData[1]);
|
|
|
+ document.getElementById("form").setAttribute('style',"position: absolute;width: 60px;height: 40px;left: 38%;top:50%;font-size: 10px;color: aliceblue;");
|
|
|
+ }else if(params.name=="60-80"){
|
|
|
+ document.getElementById("form").innerText="男:"+yData[2]+" \n女:"+(shadowYData[2]-yData[2]);
|
|
|
+ document.getElementById("form").setAttribute('style',"position: absolute;width: 60px;height: 40px;left: 63%;top:50%;font-size: 10px;color: aliceblue;");
|
|
|
+ }else if(params.name="80以上"){
|
|
|
+ document.getElementById("form").innerText="男:"+yData[3]+" \n女:"+(shadowYData[3]-yData[3]);
|
|
|
+ document.getElementById("form").setAttribute('style',"position: absolute;width: 60px;height: 40px;left: 85%;top:50%;font-size: 10px;color: aliceblue;");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
//#0D53CC
|
|
|
var color = "#19dfdd";
|
|
|
var shadowColor = "#0b5767";
|
|
@@ -87,19 +111,19 @@
|
|
|
"yAxis": [{
|
|
|
show: false,
|
|
|
"type": "value",
|
|
|
- "axisLabel": {
|
|
|
- "textStyle": {
|
|
|
- "color": "#fff"
|
|
|
- },
|
|
|
- },
|
|
|
- "splitLine": {
|
|
|
- "lineStyle": {
|
|
|
- "color": "#0c2c5a"
|
|
|
- }
|
|
|
- },
|
|
|
- "axisLine": {
|
|
|
- "show": false
|
|
|
- }
|
|
|
+ // "axisLabel": {
|
|
|
+ // "textStyle": {
|
|
|
+ // "color": "#fff"
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // "splitLine": {
|
|
|
+ // "lineStyle": {
|
|
|
+ // "color": "#0c2c5a"
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // "axisLine": {
|
|
|
+ // "show": false
|
|
|
+ // }
|
|
|
}],
|
|
|
"series": [{
|
|
|
"name": "数据上椭圆",
|
|
@@ -108,17 +132,17 @@
|
|
|
symbolOffset: [0, -6],
|
|
|
symbolPosition: 'end',
|
|
|
z: 12,
|
|
|
- // "label": {
|
|
|
- // "normal": {
|
|
|
- // "show": true,
|
|
|
- // "position": "top",
|
|
|
- // fontSize: 12,
|
|
|
- // color: color,
|
|
|
- // formatter:function(params,index){
|
|
|
- // return params.value;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ // "label": {
|
|
|
+ // "normal": {
|
|
|
+ // "show": true,
|
|
|
+ // "position": "top",
|
|
|
+ // fontSize: 12,
|
|
|
+ // color: color,
|
|
|
+ // formatter:function(params,index){
|
|
|
+ // return params.value;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
color: "#2DB1EF",
|
|
|
data: yData
|
|
|
},
|
|
@@ -206,18 +230,18 @@
|
|
|
itemStyle: {
|
|
|
color: shadowColor
|
|
|
},
|
|
|
- // "label": {
|
|
|
- // "normal": {
|
|
|
- // "show": true,
|
|
|
- // "position": "bottom",
|
|
|
- // fontSize: 12,
|
|
|
- // color: color,
|
|
|
- // formatter:function(params,index){
|
|
|
-
|
|
|
- // return params.value;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ // "label": {
|
|
|
+ // "normal": {
|
|
|
+ // "show": true,
|
|
|
+ // "position": "bottom",
|
|
|
+ // fontSize: 12,
|
|
|
+ // color: color,
|
|
|
+ // formatter:function(params,index){
|
|
|
+
|
|
|
+ // return params.value;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
data: shadowYData
|
|
|
},
|
|
|
]
|
|
@@ -233,6 +257,16 @@
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
+ /* #form{
|
|
|
+ position: absolute;
|
|
|
+ width: 80px;
|
|
|
+ height: 40px;
|
|
|
+ left: 15%;
|
|
|
+ top:50%;
|
|
|
+ font-size: 10px;
|
|
|
+ color: aliceblue;
|
|
|
+ ;
|
|
|
+ } */
|
|
|
#renkou {
|
|
|
position: absolute;
|
|
|
width: 25%;
|
|
@@ -255,4 +289,40 @@
|
|
|
/* background-color: rgb(0, 0, 255,0.4); */
|
|
|
}
|
|
|
|
|
|
+ #num50 {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 12px;
|
|
|
+ color: aliceblue;
|
|
|
+ top:63%;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
+ #num100 {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 12px;
|
|
|
+ color: aliceblue;
|
|
|
+ top:53%;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
+ #num150 {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 12px;
|
|
|
+ color: aliceblue;
|
|
|
+ top:43%;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
+ #num200 {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 12px;
|
|
|
+ color: aliceblue;
|
|
|
+ top:33%;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
+ #num250 {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 12px;
|
|
|
+ color: aliceblue;
|
|
|
+ top:23%;
|
|
|
+ left: 3%;
|
|
|
+ }
|
|
|
+
|
|
|
</style>
|