123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- function center3_d(data1,data){
- const myChartss = echarts.init(document.getElementById('center3_d'), 'vintage');
- // const data1 = [10, 20, 10, 30, 30];
- const data2 = [100, 100, 100, 100, 100];
- const path = 'path://M1390,595h79l-39,22Z';
- const myColor = ['#fff', '#fff', '#fff', '#fff', '#fff'];
- const option12 = {
- grid: {
- left: 100,
- bottom: 100
- },
- xAxis: {
- axisLabel: {
- padding:15,
- interval: 0,
- textStyle: {
- color: function (param, index) {
- return myColor[index]
- },
- fontSize: 16,
- fontWeight: 100,
- },
- margin: 20,
- },
- splitLine: {
- show: false
- },
- axisLine: {
- show: false,
- },
- splitArea: {
- show: false,
- },
- axisTick: {
- show: false
- },
- data: data
- },
- yAxis: {
- axisLine: {
- lineStyle: {
- color: '#6e6e6e',
- width: 1,
- }
- },
- axisLabel: {
- interval: 0,
- formatter: '{value}%',
- textStyle: {
- fontSize: 16,
- color: '#fff',
- },
- margin: 20,
- },
- splitLine: {
- show: true,
- },
- axisTick: {
- lineStyle: {
- color: '#fff',
- width: 1,
- height: 5,
- }
- },
- },
- series: [{
- type: 'bar',
- barWidth: 60,
- barGap: '-100%',
- stack: '广告',
- itemStyle: {
- color: function (params) {
- const colorList = [
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- ];
- return colorList[params.dataIndex]
- },
- },
- data: data1
- },
- {
- "name": "",
- "type": "pictorialBar",
- symbol: path,
- "symbolSize": [60, 20],
- "symbolOffset": [0, 0],
- "z": 12,
- "symbolPosition": "end",
- itemStyle: {
- color: '#e2e2e2',
- opacity: 0,
- },
- "data": data2
- },
- {
- "name": "",
- "type": "pictorialBar",
- symbol: path,
- "symbolSize": [60, 20],
- "symbolOffset": [0, 20],
- "z": 12,
- itemStyle: {
- opacity: 1,
- color: function (params) {
- const colorList = [
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
- offset: 0,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 0.5,
- color: '#39b3ff'
- }, {
- offset: 1,
- color: '#39b3ff'
- }]),
- ];
- return colorList[params.dataIndex]
- },
- },
- "data": [1, 1, 1, 1, 1]
- },
- {
- "name": "",
- "type": "pictorialBar",
- symbol: path,
- "symbolSize": [60, 20],
- "symbolOffset": [0, 0],
- "z": 12,
- label: {
- show: true,
- formatter: "{c}人",
- position: 'top',
- distance: 5,
- color: '#fff',
- fontWeight: 100,
- textShadowColor: 'rgba(255, 255, 255, .6)',
- fontSize: 16,
- textShadowBlur: '0',
- textShadowOffsetX: 1,
- textShadowOffsetY: 1,
- },
- itemStyle: {
- opacity: 1,
- color: function (params) {
- const colorList = ['#39b3ff', '#39b3ff', '#39b3ff', '#39b3ff', '#39b3ff'];
- return colorList[params.dataIndex]
- },
- },
- "symbolPosition": "end",
- "data": data1
- },
- {
- name: '',
- type: "effectScatter",
- rippleEffect: {
- period: 1,
- scale: 5,
- brushType: 'fill'
- },
- z: 20,
- symbolPosition: 'end',
- symbol: path,
- "symbolSize": [15, 5],
- "symbolOffset": [0, 9],
- itemStyle: {
- normal: {
- color: '#fff',
- }
- },
- data: data1
- },
- ]
- };
- const backImg = "/asset/get/s/data-1622796959507-HTopachtJ.png"
- myChartss._dom.style.backgroundImage = "url('" + backImg + "')";
- myChartss.setOption(option12);
- }
|