|
@@ -6,34 +6,35 @@ layui.use(['element', 'form', 'tree', 'util', 'laydate'], function() {
|
|
|
layer = layui.layer,
|
|
|
util = layui.util,
|
|
|
element = layui.element,
|
|
|
- data1 = [{
|
|
|
- title: '地区生产总值',
|
|
|
- id: 1,
|
|
|
- children: [{
|
|
|
- title: '第一产业',
|
|
|
- id: 1000,
|
|
|
- type: 101,
|
|
|
- clickType: 1,
|
|
|
- color1: '#9BCE4A',
|
|
|
- color2: '#ffb43e'
|
|
|
- }, {
|
|
|
- title: '第二产业',
|
|
|
- id: 1001,
|
|
|
- type: 102,
|
|
|
- clickType: 1,
|
|
|
- color1: '#29B6F6',
|
|
|
- color2: '#5efff5'
|
|
|
- }, {
|
|
|
- title: '第三产业',
|
|
|
- id: 1002,
|
|
|
- type: 103,
|
|
|
- clickType: 1,
|
|
|
- color1: '#34D3EB',
|
|
|
- color2: '#9cdc7e'
|
|
|
- }]
|
|
|
- },
|
|
|
+ data1 = [
|
|
|
+ // {
|
|
|
+ // title: '地区生产总值',
|
|
|
+ // id: 1,
|
|
|
+ // children: [{
|
|
|
+ // title: '第一产业',
|
|
|
+ // id: 1000,
|
|
|
+ // type: 101,
|
|
|
+ // clickType: 1,
|
|
|
+ // color1: '#9BCE4A',
|
|
|
+ // color2: '#ffb43e'
|
|
|
+ // }, {
|
|
|
+ // title: '第二产业',
|
|
|
+ // id: 1001,
|
|
|
+ // type: 102,
|
|
|
+ // clickType: 1,
|
|
|
+ // color1: '#29B6F6',
|
|
|
+ // color2: '#5efff5'
|
|
|
+ // }, {
|
|
|
+ // title: '第三产业',
|
|
|
+ // id: 1002,
|
|
|
+ // type: 103,
|
|
|
+ // clickType: 1,
|
|
|
+ // color1: '#34D3EB',
|
|
|
+ // color2: '#9cdc7e'
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
{
|
|
|
- title: '规模以上工业总产值',
|
|
|
+ title: '规模以上工业增加值增速',
|
|
|
id: 2,
|
|
|
color1: '#9BCE4A',
|
|
|
|
|
@@ -139,7 +140,7 @@ layui.use(['element', 'form', 'tree', 'util', 'laydate'], function() {
|
|
|
|
|
|
document.getElementById("mainCenter").removeAttribute("_echarts_instance_");
|
|
|
var myChart = echarts.init(document.getElementById('mainCenter'));
|
|
|
- getAllIndustry(data1, myChart);
|
|
|
+ getAllScale(data1[0], myChart);
|
|
|
tree.render({
|
|
|
elem: '#test13',
|
|
|
data: data1,
|
|
@@ -151,11 +152,11 @@ layui.use(['element', 'form', 'tree', 'util', 'laydate'], function() {
|
|
|
|
|
|
$('.tableTit').empty();
|
|
|
|
|
|
- if (obj.data.title == '地区生产总值') {
|
|
|
- getAllIndustry(data1, myChart)
|
|
|
- }
|
|
|
- if (obj.data.title == '规模以上工业总产值') {
|
|
|
- getAllScale(obj, myChart)
|
|
|
+ // if (obj.data.title == '地区生产总值') {
|
|
|
+ // getAllIndustry(data1, myChart)
|
|
|
+ // }
|
|
|
+ if (obj.data.title == '规模以上工业增加值增速') {
|
|
|
+ getAllScale(data1[0], myChart)
|
|
|
|
|
|
}
|
|
|
if (obj.data.title == '建筑业总产值') {
|
|
@@ -217,16 +218,14 @@ function getAllMarket(obj, myChart) {
|
|
|
|
|
|
var subData = list[i].totalNum;
|
|
|
// console.log(subData);
|
|
|
- if (subData.length == 4) {
|
|
|
+ if (subData.length == 1) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
- xdata.push(list[i].date + '年1-3季度');
|
|
|
- xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
+ xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
}
|
|
|
|
|
@@ -274,16 +273,14 @@ function getAllConstruction(obj, myChart) {
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
|
|
|
var subData = list[i].totalNum;
|
|
|
- if (subData.length == 4) {
|
|
|
+ if (subData.length == 1) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
- xdata.push(list[i].date + '年1-3季度');
|
|
|
- xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
+ xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
}
|
|
|
}
|
|
@@ -327,41 +324,39 @@ function getAllScale(obj, myChart) {
|
|
|
var array = [];
|
|
|
var xdata = [];
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
- var subData = list[i].totalNum;
|
|
|
- if (subData.length == 4) {
|
|
|
+ var subData = list[i].growth;
|
|
|
+ if (subData.length == 1) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
- xdata.push(list[i].date + '年1-3季度');
|
|
|
- xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
+ xdata.push(list[i].date + '年1-4季度');
|
|
|
array.push(...subData);
|
|
|
}
|
|
|
}
|
|
|
var chat = [{
|
|
|
- 'name': obj.data.title,
|
|
|
+ 'name': obj.title,
|
|
|
'data': array,
|
|
|
- 'color1': obj.data.color1,
|
|
|
- 'color2': obj.data.color2,
|
|
|
+ 'color1': obj.color1,
|
|
|
+ 'color2': obj.color2,
|
|
|
'xdata': xdata
|
|
|
}]
|
|
|
- option = getLine(chat, '万元');
|
|
|
+ option = getLinel(chat, '%');
|
|
|
|
|
|
myChart.setOption(option, true);
|
|
|
|
|
|
var tabletit = list[0].name;
|
|
|
str = '<th>' + tabletit + '</th>';
|
|
|
listdataa += '<tr>'
|
|
|
- listdataa += '<td>值</td>'
|
|
|
+ listdataa += '<td>增速</td>'
|
|
|
for (var j = 0; j < array.length; j++) {
|
|
|
- listdataa += '<td>' + array[j] + '万元' + '</td>';
|
|
|
+ listdataa += '<td>' + array[j] + '%' + '</td>';
|
|
|
}
|
|
|
listdataa += '</tr>'
|
|
|
for (var j = 0; j < list.length; j++) {
|
|
|
- for (var k = 0; k < list[j].totalNum.length; k++) {
|
|
|
+ for (var k = 0; k < list[j].growth.length; k++) {
|
|
|
let a = NoToChinese(Number(k) + 1)
|
|
|
str += '<th>' + list[j].date + '第一至' + a + '季度</th>'
|
|
|
}
|
|
@@ -380,11 +375,12 @@ function getAllIndustry(data1, myChart) {
|
|
|
getData('./json/jdp.json').then(data => {
|
|
|
var children = data1[0].children;
|
|
|
var array = [];
|
|
|
-
|
|
|
-
|
|
|
- for (var i = 0; i < children.length; i++) {
|
|
|
- array.push(getIndustryByTypeAll(data.GDP, children[i]));
|
|
|
+ if (children) {
|
|
|
+ for (var i = 0; i < children.length; i++) {
|
|
|
+ array.push(getIndustryByTypeAll(data.GDP, children[i]));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
option = getLine(array, '万元');
|
|
|
myChart.setOption(option, true);
|
|
|
var tabletit = data.GDP[0].name;
|
|
@@ -527,14 +523,13 @@ function getinlandTrade(obj, myChart) {
|
|
|
var xname = '';
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[2].data.firstThridQuarter) {
|
|
|
+ if (subData[2].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
|
if (obj.data.type == subData[j].type) {
|
|
@@ -600,14 +595,13 @@ function getFinancial(obj, myChart) {
|
|
|
var xname = '';
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[2].data.firstThridQuarter) {
|
|
|
+ if (subData[2].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
@@ -675,14 +669,13 @@ function getBank(obj, myChart) {
|
|
|
var xname = '';
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[1].data.firstThridQuarter) {
|
|
|
+ if (subData[1].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
|
if (obj.data.type == subData[j].type) {
|
|
@@ -745,14 +738,13 @@ function getIndustryByType(obj, myChart) {
|
|
|
var xname = ''
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[2].data.firstThridQuarter) {
|
|
|
+ if (subData[2].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
@@ -810,14 +802,13 @@ function getIndustryByTypeAll(list, obj) {
|
|
|
var xdata = [];
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[2].data.firstThridQuarter) {
|
|
|
+ if (subData[2].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
|
if (obj.type == subData[j].type) {
|
|
@@ -854,14 +845,13 @@ function getScaleByTypeAll(list, obj) {
|
|
|
var xdata = [];
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var subData = list[i].subData;
|
|
|
- if (subData[1].data.firstThridQuarter) {
|
|
|
+ if (subData[1].data.firstSecondQuarter) {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
xdata.push(list[i].date + '年1-2季度');
|
|
|
xdata.push(list[i].date + '年1-3季度');
|
|
|
xdata.push(list[i].date + '年1-4季度');
|
|
|
} else {
|
|
|
xdata.push(list[i].date + '年1季度');
|
|
|
- xdata.push(list[i].date + '年1-2季度');
|
|
|
}
|
|
|
for (var j = 0; j < subData.length; j++) {
|
|
|
if (obj.type == subData[j].type) {
|
|
@@ -1503,7 +1493,11 @@ function getLine(list, unit) {
|
|
|
xAxis: {
|
|
|
type: 'category',
|
|
|
boundaryGap: 1,
|
|
|
- data: list[0].xdata
|
|
|
+ data: list[0].xdata,
|
|
|
+ axisLabel: {
|
|
|
+ interval: 0,
|
|
|
+ rotate: 40
|
|
|
+ }
|
|
|
},
|
|
|
yAxis: {
|
|
|
type: 'value',
|
|
@@ -1548,6 +1542,90 @@ function getLine(list, unit) {
|
|
|
return chart;
|
|
|
}
|
|
|
|
|
|
+function getLinel(list, unit) {
|
|
|
+
|
|
|
+ var chart = {
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ toolbox: {
|
|
|
+ show: true,
|
|
|
+ x: 'right',
|
|
|
+ y: 'top',
|
|
|
+ feature: {
|
|
|
+ saveAsImage: {
|
|
|
+ pixelRatio: 1,
|
|
|
+ name: '导出的文件名',
|
|
|
+ title: '保存图片',
|
|
|
+ emphasis: {
|
|
|
+ iconStyle: {
|
|
|
+ textAlign: 'right', //文字在图标在右边
|
|
|
+ textPosition: 'left', //文字与图标在一行
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ data: list[0].xdata,
|
|
|
+ axisLabel: {
|
|
|
+ interval: 0,
|
|
|
+ rotate: 40
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value}' + unit
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var series = [];
|
|
|
+ var tolstr = [];
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
+ series.push({
|
|
|
+ name: list[i].name,
|
|
|
+ type: 'line',
|
|
|
+ // type: 'bar',
|
|
|
+ // stack: '增速',
|
|
|
+ // symbol: 'none',
|
|
|
+ data: list[i].data,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: list[i].color1
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ })
|
|
|
+ tolstr.push(list[i].color1);
|
|
|
+ }
|
|
|
+ chart.series = series;
|
|
|
+ chart.tooltip.formatter = function(v) {
|
|
|
+ var str = '';
|
|
|
+ var res = "<div>" + v[0].axisValue + "</div>";
|
|
|
+ var result = ''
|
|
|
+ v.forEach(function(item, index) {
|
|
|
+ result +=
|
|
|
+ `<span style="display:inline-block;margin-right:5px;margin-bottom:2px;border-radius:10px;width:9px;height:9px;background:` +
|
|
|
+ tolstr[index] + `;"></span>`
|
|
|
+ result += item.seriesName + ":" + item.data + unit + "<br>";
|
|
|
+ })
|
|
|
+ str = res + result
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+ return chart;
|
|
|
+}
|
|
|
+
|
|
|
function getAllLine(list) {
|
|
|
var dateList = [];
|
|
|
var listThri = [];
|