|
@@ -1523,47 +1523,94 @@ let app = new Vue({
|
|
var chartData = []
|
|
var chartData = []
|
|
var timer = null;
|
|
var timer = null;
|
|
var timer2 = null;
|
|
var timer2 = null;
|
|
|
|
+ var sumAngleData = 0;
|
|
var i = 0;
|
|
var i = 0;
|
|
industryList.forEach((item,index) => {
|
|
industryList.forEach((item,index) => {
|
|
let obj = {
|
|
let obj = {
|
|
name: item.name,
|
|
name: item.name,
|
|
y: item.value,
|
|
y: item.value,
|
|
|
|
+ h: 28,
|
|
sliced: false,
|
|
sliced: false,
|
|
selected: false,
|
|
selected: false,
|
|
color: index == 0 ? 'rgb(243,178,119)' : index == 1 ? 'rgb(110,222,191)' : 'rgb(82,161,229)'
|
|
color: index == 0 ? 'rgb(243,178,119)' : index == 1 ? 'rgb(110,222,191)' : 'rgb(82,161,229)'
|
|
}
|
|
}
|
|
chartData.push(obj)
|
|
chartData.push(obj)
|
|
|
|
+ sumAngleData = sumAngleData + item.value
|
|
|
|
+
|
|
})
|
|
})
|
|
- let that = this
|
|
|
|
|
|
+ // 这个方法用于计算当前块的最中间角度
|
|
|
|
+ var chartAngle = function(n){
|
|
|
|
+ return chartData[n].y / sumAngleData * 100 * 1.8
|
|
|
|
+ }
|
|
|
|
+ var angleData = 180 - chartAngle(0); //先计算出第一个位于最中间的角度
|
|
|
|
+
|
|
|
|
+ let each = Highcharts.each
|
|
|
|
+ let that = this
|
|
var chart = Highcharts.chart('echartR1', {
|
|
var chart = Highcharts.chart('echartR1', {
|
|
chart: {
|
|
chart: {
|
|
type: 'pie',
|
|
type: 'pie',
|
|
backgroundColor: 'rgba(0,0,0,0)',
|
|
backgroundColor: 'rgba(0,0,0,0)',
|
|
options3d: {
|
|
options3d: {
|
|
enabled: true,
|
|
enabled: true,
|
|
- alpha: 45,
|
|
|
|
- //beta: 0
|
|
|
|
|
|
+ alpha: 55,
|
|
|
|
+ //beta: 100
|
|
|
|
+ depth: 28,
|
|
},
|
|
},
|
|
events: {
|
|
events: {
|
|
// load,图表加载完成时触发
|
|
// load,图表加载完成时触发
|
|
load: function () {
|
|
load: function () {
|
|
var chart = this;
|
|
var chart = this;
|
|
-
|
|
|
|
|
|
+ var angle = 0;
|
|
var points = chart.series[0].points;
|
|
var points = chart.series[0].points;
|
|
var len = points.length;
|
|
var len = points.length;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // each(points, function (p, i) {
|
|
|
|
+ // p.graphic.attr({
|
|
|
|
+ // translateY: -p.shapeArgs.ran
|
|
|
|
+ // })
|
|
|
|
+ // p.graphic.side1.attr({
|
|
|
|
+ // translateY: -p.shapeArgs.ran
|
|
|
|
+ // })
|
|
|
|
+ // p.graphic.side2.attr({
|
|
|
|
+ // translateY: -p.shapeArgs.ran
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
|
|
+ each(points, function (p, i) {
|
|
|
|
+ var shapeArgs = p.shapeArgs
|
|
|
|
+ console.log(shapeArgs)
|
|
|
|
+ })
|
|
|
|
+
|
|
timer && clearInterval(timer);
|
|
timer && clearInterval(timer);
|
|
timer = setInterval(function () {
|
|
timer = setInterval(function () {
|
|
autoTooltip(points[i]);
|
|
autoTooltip(points[i]);
|
|
|
|
+
|
|
chartData.forEach((item,index) => {
|
|
chartData.forEach((item,index) => {
|
|
item.sliced = false
|
|
item.sliced = false
|
|
item.selected = false
|
|
item.selected = false
|
|
|
|
+ item.h = 28
|
|
if(index == i){
|
|
if(index == i){
|
|
item.sliced = true
|
|
item.sliced = true
|
|
item.selected = true
|
|
item.selected = true
|
|
|
|
+ item.h = 48
|
|
}
|
|
}
|
|
})
|
|
})
|
|
chart.update({
|
|
chart.update({
|
|
|
|
+ plotOptions: {
|
|
|
|
+ pie: {
|
|
|
|
+ allowPointSelect: true,
|
|
|
|
+ showInLegend: true, // 图例
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
+ size: 180,
|
|
|
|
+ innerSize : 110, //环形图中间空白,0为饼图
|
|
|
|
+ depth: 28, //立体高度
|
|
|
|
+ slicedOffset: 23, //动画距离
|
|
|
|
+ startAngle: angleData, // 旋转角度
|
|
|
|
+ dataLabels: {
|
|
|
|
+ enabled: false, // 是否展示指示线
|
|
|
|
+ format: '{point.name}: {point.percentage}'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
series:[{
|
|
series:[{
|
|
type: 'pie',
|
|
type: 'pie',
|
|
name: '占比',
|
|
name: '占比',
|
|
@@ -1581,10 +1628,15 @@ let app = new Vue({
|
|
}]
|
|
}]
|
|
})
|
|
})
|
|
i++;
|
|
i++;
|
|
|
|
+
|
|
if (i === len) {
|
|
if (i === len) {
|
|
i = 0;
|
|
i = 0;
|
|
}
|
|
}
|
|
|
|
+ // 开始计算上一个旋转块的角度
|
|
|
|
+ let previous = i-1 < 0 ? len-1 : i-1 //这里计算上一块是第几块
|
|
|
|
+ angleData =angleData- (chartAngle(i) + chartAngle(previous))
|
|
}, 2000);
|
|
}, 2000);
|
|
|
|
+
|
|
},
|
|
},
|
|
legendItemClick : function(event) {
|
|
legendItemClick : function(event) {
|
|
console.log(event);
|
|
console.log(event);
|
|
@@ -1631,6 +1683,7 @@ let app = new Vue({
|
|
innerSize : 110, //环形图中间空白,0为饼图
|
|
innerSize : 110, //环形图中间空白,0为饼图
|
|
depth: 28, //立体高度
|
|
depth: 28, //立体高度
|
|
slicedOffset: 23, //动画距离
|
|
slicedOffset: 23, //动画距离
|
|
|
|
+ startAngle: angleData, // 旋转角度
|
|
dataLabels: {
|
|
dataLabels: {
|
|
enabled: false, // 是否展示指示线
|
|
enabled: false, // 是否展示指示线
|
|
format: '{point.name}: {point.percentage}'
|
|
format: '{point.name}: {point.percentage}'
|
|
@@ -1652,6 +1705,7 @@ let app = new Vue({
|
|
},
|
|
},
|
|
mouseOver: function(e){ //鼠标移入停止轮播并且找到移入的当前数据设为选中
|
|
mouseOver: function(e){ //鼠标移入停止轮播并且找到移入的当前数据设为选中
|
|
//console.log(e)
|
|
//console.log(e)
|
|
|
|
+ var angle = 45
|
|
chartData.forEach((item,index) => {
|
|
chartData.forEach((item,index) => {
|
|
item.sliced = false
|
|
item.sliced = false
|
|
item.selected = false
|
|
item.selected = false
|
|
@@ -1680,7 +1734,6 @@ let app = new Vue({
|
|
mouseOut: function(){ // 鼠标移出后需要继续执行轮播
|
|
mouseOut: function(){ // 鼠标移出后需要继续执行轮播
|
|
var points = chart.series[0].points;
|
|
var points = chart.series[0].points;
|
|
var len = points.length;
|
|
var len = points.length;
|
|
-
|
|
|
|
timer && clearInterval(timer);
|
|
timer && clearInterval(timer);
|
|
timer = setInterval(function () {
|
|
timer = setInterval(function () {
|
|
autoTooltip(points[i]);
|
|
autoTooltip(points[i]);
|
|
@@ -1693,6 +1746,22 @@ let app = new Vue({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
chart.update({
|
|
chart.update({
|
|
|
|
+ plotOptions: {
|
|
|
|
+ pie: {
|
|
|
|
+ allowPointSelect: true,
|
|
|
|
+ showInLegend: true, // 图例
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
+ size: 180,
|
|
|
|
+ innerSize : 110, //环形图中间空白,0为饼图
|
|
|
|
+ depth: 28, //立体高度
|
|
|
|
+ slicedOffset: 23, //动画距离
|
|
|
|
+ startAngle: angleData, // 旋转角度
|
|
|
|
+ dataLabels: {
|
|
|
|
+ enabled: false, // 是否展示指示线
|
|
|
|
+ format: '{point.name}: {point.percentage}'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
series:[{
|
|
series:[{
|
|
type: 'pie',
|
|
type: 'pie',
|
|
name: '占比',
|
|
name: '占比',
|
|
@@ -1713,6 +1782,8 @@ let app = new Vue({
|
|
if (i === len) {
|
|
if (i === len) {
|
|
i = 0;
|
|
i = 0;
|
|
}
|
|
}
|
|
|
|
+ let previous = i-1 < 0 ? len-1 : i-1 //这里计算上一块是第几块
|
|
|
|
+ angleData =angleData- (chartAngle(i) + chartAngle(previous))
|
|
}, 2000);
|
|
}, 2000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2145,7 +2216,6 @@ let app = new Vue({
|
|
|
|
|
|
var points = chart.series[0].points;
|
|
var points = chart.series[0].points;
|
|
var len = points.length;
|
|
var len = points.length;
|
|
-
|
|
|
|
timer && clearInterval(timer);
|
|
timer && clearInterval(timer);
|
|
timer = setInterval(function () {
|
|
timer = setInterval(function () {
|
|
autoTooltip(points[i]);
|
|
autoTooltip(points[i]);
|