Commit d11be1e7 by jml0128

fix:数字问卷增加双环图表

1 parent 1ae7c536
{
"name": "xrk-bi",
"version": "0.3.0-beta.12",
"version": "0.3.0-beta.13",
"description": "xrk-bi",
"author": "xrk",
"main": "dist/bundler.js",
......
......@@ -167,3 +167,96 @@ export const createPie = (
]
};
};
export const createDoubleRing = (
Vue,
chartData,
axisData,
yAxisUnit,
colors = []
) => {
const { fontSize, isMobile, isPrint } = getInfo(Vue);
chartData = chartData[0] || [];
const isSingle = chartData.length == 1;
return {
animation: false,
grid: {
containLabel: true,
left: 20,
right: 0,
bottom: '5%'
},
title: isMobile
? {
borderColor: '#fff',
text: 10000 + '人',
textStyle: {
color: '#2A3558',
fontSize: isPrint ? 45 : 15
},
subtext: '答题人数',
subtextStyle: {
color: '#6F7A91',
fontSize: isPrint ? 30 : 10
},
itemGap: isPrint ? 12 : 4,
left: 'center',
top: isPrint ? '45%' : '42%'
}
: {
borderColor: '#fff'
},
series: chartData.map((item, index) => {
const maxWidth = 75;
const getRadius = index => {
if (isSingle) {
return isMobile ? ['35%', '55%'] : ['70%', '55%'];
}
const width = 15;
const gap = width * 1.5;
return [
`${maxWidth - gap * index - width}%`,
`${maxWidth - gap * index}%`
];
};
const _item = [item].map(cItem => {
return {
name: `${axisData[index]}`,
value: cItem
};
});
return {
type: 'pie',
z: index,
zlevel: index,
center: ['50%', '50%'],
radius: getRadius(index),
clockwise: true,
hoverOffset: 15,
itemStyle: {
color: function() {
return colors[index % colors.length];
}
},
label: {
show: true,
position: 'outside',
fontSize: fontSize,
color: '#2A3558',
formatter: '{b}:{c}'
},
labelLine: {
show: true,
lineStyle: {
color: '#6E6E6E',
width: 1
}
},
labelLayout: {
hideOverlap: false
},
data: _item
};
})
};
};
......@@ -9,7 +9,7 @@ import {
createBarMultipleTransverse
} from './bar/createBar';
import { createLine, createLineSmooth } from './line/createLine';
import { createPie, createRing } from './pie/createPie';
import { createPie, createRing, createDoubleRing } from './pie/createPie';
import { createMap, createMapScatter } from './map/createMap';
export default {
// 柱状
......@@ -90,6 +90,14 @@ export default {
icon: 'http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/bingtu1.svg',
create: createPie
},
// 双层圆环
16: {
name: 'double-ring',
cnName: '饼图',
sort: 2,
icon: 'http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/bingtu3.svg',
create: createDoubleRing
},
// 表格
11: {
name: 'table',
......
......@@ -55,7 +55,8 @@ export default {
if (this.extendTypes.includes(+item[0])) {
return true;
} else {
return item[0] != 12;
// 双环、男女性别类型
return ![12, 16, '12', '16'].includes(item[0]);
}
})
.reduce((pre, [key, value]) => {
......
......@@ -40,7 +40,7 @@
:textData="textDataHistory"
:singleChoice="showSingleChoiceHistory"
:pageWrap="true"
@sort="sort(arguments, 'singleChoice', hideSingleChoiceHistory)"
@sort="sort(arguments, 'singleChoiceHistory', hideSingleChoiceHistory)"
@page="setPage(arguments, 'page2', 'page2Info')"
>
<BiSingleChoiceInfo
......@@ -470,7 +470,13 @@ export default {
hideDesc: true
},
7: { hideThisChart: true },
23: { hideThisChart: true }
23: item => ({
chartType: item.chartType || randomType([1, 2, 16]),
blockTitle: '专区推广文章浏览量与有效反馈数量对比图',
hideDesc: true,
extendTypes: [16],
disableTypes: [3, 4, 5, 6, 9, 10, 11]
})
};
this[singleChoiceName] = Object.entries(obj)
.filter(item => item[1])
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!