123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999 |
- $(window).load(function(){$(".loading").fadeOut()})
- $(function () {
- echarts_6();
- echarts_5();
- echarts_4();
- echarts_1();
- echarts_2();
- echarts_3();
- echarts_7();
- function echarts_1() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('echart1'));
- option = {
- legend: {
- //orient: 'vertical',
- top:'20',
- left:'center',
- itemWidth: 10,
- itemHeight: 10,
- data:['服装','娱乐','食品','海鲜'],
- textStyle: {
- color: 'rgba(255,255,255,.5)',
- fontSize:'12',
- }
- },
- tooltip: {
- trigger: 'item',
- formatter: "{b} : {c} ({d}%)"
- },
- visualMap: {
- show: false,
- min: 500,
- max: 600,
- inRange: {
- //colorLightness: [0, 1]
- }
- },
- series: [{
- name: '分布',
- type: 'pie',
- radius: ['30%', '60%'],
- center: ['50%', '60%'],
- color: ['#0086e5', '#30c5ed', '#9fe7b8', '#fedb5b', '#ff9f7d', '#fb7293', '#e7bcf2'], //'#FBFE27','rgb(11,228,96)','#FE5050'
- data: [{
- value: 10,
- name: '服装'
- },
- {
- value: 40,
- name: '娱乐'
- },
- {
- value: 20,
- name: '食品'
- },
- {
- value: 30,
- name: '海鲜'
- }
- ].sort(function(a, b) {
- return a.value - b.value
- }),
- roseType: 'radius',
- label: {
- normal: {
- formatter: ['{d|{d}%}', '{b|{b}}'].join('\n'),
- rich: {
- d: {
- color: 'rgb(241,246,104)',
- fontSize: 14,
- fontWeight:'bold',
-
- },
- b: {
- color: 'rgb(98,137,169)',
- fontSize: 12,
-
- },
- },
- }
- },
- labelLine: {
- normal: {
- lineStyle: {
- color: 'rgb(98,137,169)',
- },
- smooth: 0.2,
- length: 5,
- length2: 9,
- }
- },
- itemStyle: {
- normal: {
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- shadowBlur: 50,
- }
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
-
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_2() {
- var myChart = echarts.init(document.getElementById('echart2'));
- data = [{
- name: "数据1",
- value: 1000
- }, {
- name: "数据2",
- value: 2000
- }, {
- name: "数据3",
- value: 200
- }, {
- name: "数据4",
- value: 500
- }
- ];
- arrName = getArrayValue(data, "name");
- arrValue = getArrayValue(data, "value");
- sumValue = eval(arrValue.join('+'));
- objData = array2obj(data, "name");
- optionData = getData(data);
- function getArrayValue(array, key) {
- var key = key || "value";
- var res = [];
- if (array) {
- array.forEach(function(t) {
- res.push(t[key])
- })
- }
- return res
- }
- function array2obj(array, key) {
- var resObj = {};
- for (var i = 0; i < array.length; i++) {
- resObj[array[i][key]] = array[i]
- }
- return resObj
- }
- function getData(data) {
- var res = {
- series: [],
- yAxis: []
- };
- for (let i = 0; i < data.length; i++) {
- res.series.push({
- name: '数据',
- type: 'pie',
- clockWise: false,
- hoverAnimation: false,
- radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
- center: ["50%", "65%"],
- label: {
- show: false
- },
- itemStyle: {
- label: {
- show: false,
- },
- labelLine: {
- show: false
- },
- borderWidth: 5,
- },
- data: [{
- value: data[i].value,
- name: data[i].name
- }, {
- value: sumValue - data[i].value,
- name: '',
- itemStyle: {
- color: "rgba(0,0,0,0)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }]
- });
- res.series.push({
- name: '',
- type: 'pie',
- silent: true,
- z: 1,
- clockWise: false,
- hoverAnimation: false,
- radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
- center: ["50%", "65%"],
- label: {
- show: false
- },
- itemStyle: {
- label: {
- show: false,
- },
- labelLine: {
- show: false
- },
- borderWidth: 5,
- },
- data: [{
- value: 7.5,
- itemStyle: {
- color: "rgba(255,255,255,.1)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }, {
- value: 2.5,
- name: '',
- itemStyle: {
- color: "rgba(0,0,0,0)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }]
- });
- res.yAxis.push((data[i].value / sumValue * 100).toFixed(2) + "%")
- }
- return res
- }
- option = {
- legend: {
- orient: 'vertical',
- show: true,
- top: "20",
- left: 'center',
- data: arrName,
- itemWidth: 12,
- itemHeight: 12,
- //itemGap: 15,
- formatter: function(name) {
- return "{title|" + name + "}:{value|" + (objData[name].value) + "例}"
- },
- textStyle: {
- color: "rgba(255,255,255,.45)",
- rich: {
- title: {
- fontSize: 12,
- color: "rgba(255,255,255,.45)"
- },
- value: {
- fontSize: 12,
- color: "rgba(255,255,255,.85)"
- }
- }
- },
- },
- tooltip: {
- show: true,
- trigger: "item",
- formatter: "{a}<br>{b}:{c}({d}%)"
- },
- color: ['#FF8700', '#ffc300', '#00e473', '#009DFF'],
- grid: {
- top: '44%',
- bottom: '39%',
- left: "52%",
- containLabel: false
- },
- yAxis: [{
- type: 'category',
- inverse: true,
- axisLine: {
- show: false
- },
- axisTick: {
- show: false
- },
- axisLabel: {
- interval: 0,
- inside: true,
- textStyle: {
- color: "#fff",
- fontSize: 10,
- },
- show: true
- },
- data: optionData.yAxis
- }],
- xAxis: [{
- show: false
- }],
- series: optionData.series
- };
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_3() {
- var myChart = echarts.init(document.getElementById('echart3'));
- data = [{
- name: "数据1",
- value: 13211
- }, {
- name: "数据2",
- value: 42111
- }, {
- name: "数据3",
- value: 81711
- }, {
- name: "数据4",
- value: 121711
- }
- ];
- arrName = getArrayValue(data, "name");
- arrValue = getArrayValue(data, "value");
- sumValue = eval(arrValue.join('+'));
- objData = array2obj(data, "name");
- optionData = getData(data);
- function getArrayValue(array, key) {
- var key = key || "value";
- var res = [];
- if (array) {
- array.forEach(function(t) {
- res.push(t[key])
- })
- }
- return res
- }
- function array2obj(array, key) {
- var resObj = {};
- for (var i = 0; i < array.length; i++) {
- resObj[array[i][key]] = array[i]
- }
- return resObj
- }
- function getData(data) {
- var res = {
- series: [],
- yAxis: []
- };
- for (let i = 0; i < data.length; i++) {
- res.series.push({
- name: '数据',
- type: 'pie',
- clockWise: false,
- hoverAnimation: false,
- radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
- center: ["50%", "65%"],
- label: {
- show: false
- },
- itemStyle: {
- label: {
- show: false,
- },
- labelLine: {
- show: false
- },
- borderWidth: 5,
- },
- data: [{
- value: data[i].value,
- name: data[i].name
- }, {
- value: sumValue - data[i].value,
- name: '',
- itemStyle: {
- color: "rgba(0,0,0,0)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }]
- });
- res.series.push({
- name: '',
- type: 'pie',
- silent: true,
- z: 1,
- clockWise: false,
- hoverAnimation: false,
- radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
- center: ["50%", "65%"],
- label: {
- show: false
- },
- itemStyle: {
- label: {
- show: false,
- },
- labelLine: {
- show: false
- },
- borderWidth: 5,
- },
- data: [{
- value: 7.5,
- itemStyle: {
- color: "rgba(255,255,255,.1)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }, {
- value: 2.5,
- name: '',
- itemStyle: {
- color: "rgba(0,0,0,0)",
- borderWidth: 0
- },
- tooltip: {
- show: false
- },
- hoverAnimation: false
- }]
- });
- res.yAxis.push((data[i].value / sumValue * 100).toFixed(2) + "%")
- }
- return res
- }
- option = {
- legend: {
- orient: 'vertical',
- show: true,
- top: "20",
- left: 'center',
- data: arrName,
- itemWidth: 12,
- itemHeight: 12,
- //itemGap: 15,
- formatter: function(name) {
- return "{title|" + name + "}:{value|" + (objData[name].value) + "例}"
- },
- textStyle: {
- color: "rgba(255,255,255,.45)",
- rich: {
- title: {
- fontSize: 12,
- color: "rgba(255,255,255,.45)"
- },
- value: {
- fontSize: 12,
- color: "rgba(255,255,255,.85)"
- }
- }
- },
- },
- tooltip: {
- show: true,
- trigger: "item",
- formatter: "{a}<br>{b}:{c}({d}%)"
- },
- color: ['#FF8700', '#ffc300', '#00e473', '#009DFF'],
- grid: {
- top: '44%',
- bottom: '39%',
- left: "52%",
- containLabel: false
- },
- yAxis: [{
- type: 'category',
- inverse: true,
- axisLine: {
- show: false
- },
- axisTick: {
- show: false
- },
- axisLabel: {
- interval: 0,
- inside: true,
- textStyle: {
- color: "#fff",
- fontSize: 10,
- },
- show: true
- },
- data: optionData.yAxis
- }],
- xAxis: [{
- show: false
- }],
- series: optionData.series
- };
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_5() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('echart5'));
- option = {
- color: ['#1aa1ff', '#31c17b', '#ff6535'],
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- grid: {
- left: '0%',
- top:'15px',
- right: '0%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: {
- data: ['数据1', '数据2', '数据3', '数据4', '数据4', '数据5', '数据6', '数据7', '数据8', '数据9'],
- axisLine: {show:false,},
- axisLabel: {
- color: 'rgba(255,255,255,.6)',
- fontSize: 12
- }
- },
- yAxis: {
- name: "(人)",
- splitNumber:4,
- nameTextStyle: {
- color: 'rgba(255,255,255,.6)',
- fontSize: 12
- },
- axisLine: { show:false, },
- axisLabel: {
- color: 'rgba(255,255,255,.6)',
- fontSize: 12
- },
- splitLine: {
- lineStyle: {
- color: "rgba(255,255,255,.1)",
- type: "dotted"
- }
- },
- //interval:100,
- //max:500
- },
- series: [{
- type: 'bar',
- barWidth: '25%',
- itemStyle: {
- normal: {
- barBorderRadius: 50,
- color: function(params) {
- var colorList = ['#4591e3', '#04b8e5', '#04dde5', '#04e5bd', '#04e57e', '#fedb5b', '#e59e04','#ff632d','#ff639e','#ff82e9', '#b562e4'];
- return colorList[params.dataIndex]
- },
- label: {
- show: true,
- position: 'top',
- formatter: '{c}',
- color: 'rgba(255,255,255,.4)',
- fontSize: 12
- }
- }
- },
- data: [825, 605, 364, 345, 325, 261, 231, 215, 121, 91]
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_6() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('echart6'));
- option = {
- legend: {
- icon:"circle",
- top: "0",
- width:'100%',
- right: 'center',
- itemWidth: 10,
- itemHeight: 10,
- data: ['注册人数', '使用人数'],
- textStyle: {
- color: "rgba(255,255,255,.5)" },
- },
-
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- lineStyle: {
- color: '#dddc6b'
- }
- }
- },
- grid: {
- left: '0',
- top: '30',
- right: '10',
- bottom: '-15',
- containLabel: true
- },
-
- xAxis: [{
- type: 'category',
- boundaryGap: false,
- axisLabel: {
- textStyle: {
- color: "rgba(255,255,255,.5)",
- // fontSize:10
- },
- },
- axisLine: {
- lineStyle: {
- color: 'rgba(255,255,255,.1)'
- }
- },
- data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
-
- }, {
-
- axisPointer: {show: false},
- axisLine: { show: false},
- position: 'bottom',
- offset: 20,
-
-
-
- }],
-
- yAxis: [{
- type: 'value',
- axisTick: {show: false},
- splitNumber: 4,
- axisLine: {
- lineStyle: {
- color: 'rgba(255,255,255,.1)'
- }
- },
- axisLabel: {
- textStyle: {
- color: "rgba(255,255,255,.5)",
- //fontSize:10
- },
- },
-
- splitLine: {
- lineStyle: {
- color: 'rgba(255,255,255,.1)',
- type: 'dotted',
- }
- }
- }],
- series: [
- {
- name: '注册人数',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
-
- normal: {
- color: 'rgba(31, 174, 234, 1)',
- width: 2
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: 'rgba(31, 174, 234, 0.4)'
- }, {
- offset: 0.8,
- color: 'rgba(31, 174, 234, 0.1)'
- }], false),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- }
- },
- itemStyle: {
- normal: {
- color: '#1f7eea',
- borderColor: 'rgba(31, 174, 234, .1)',
- borderWidth: 5
- }
- },
- data: [3, 6, 3, 6, 3, 9, 3]
-
- },
- {
- name: '使用人数',
- type: 'line',
- smooth: true,
- symbol: 'circle',
- symbolSize: 5,
- showSymbol: false,
- lineStyle: {
-
- normal: {
- color: '#6bdd9b',
- width: 2
- }
- },
- areaStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: 'rgba(107, 221, 155, 0.4)'
- }, {
- offset: 0.8,
- color: 'rgba(107, 221, 155, 0.1)'
- }], false),
- shadowColor: 'rgba(0, 0, 0, 0.1)',
- }
- },
- itemStyle: {
- normal: {
- color: '#6bdd9b',
- borderColor: 'rgba(107, 221, 155, .1)',
- borderWidth: 5
- }
- },
- data: [ 5, 3, 7, 1, 8, 3, 5]
-
- },
- ]
-
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_4() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('echart4'));
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- legend: {
- data: ['数据1', '数据2', '数据3'],
- top:'2%',
- textStyle: {
- color: "rgba(255,255,255,.5)",
- fontSize: '12',
- },
- itemWidth: 12,
- itemHeight: 12,
- //itemGap: 35
- },
- grid: {
- left: '0%',
- top:'40px',
- right: '0%',
- bottom: '0%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- data: ['5.10', '5.11', '5.12', '5.13', '5.14', '5.15', '5.16', '5.17', '5.18'],
- axisLine: {
- show: true,
- lineStyle: {
- color: "rgba(255,255,255,.1)",
- width: 1,
-
- },
- },
-
- axisTick: {
- show: false,
- },
- axisLabel: {
- interval: 0,
- // rotate:50,
- show: true,
- splitNumber: 15,
- textStyle: {
- color: "rgba(255,255,255,.6)",
- fontSize: '12',
-
- },
- },
- }],
- yAxis: [{
- type: 'value',
- axisLabel: {
- //formatter: '{value} %'
- show:true,
- textStyle: {
- color: "rgba(255,255,255,.6)",
- fontSize: '12',
- },
- },
- axisTick: {
- show: false,
- },
- axisLine: {
- show: false,
- },
- splitLine: {
- lineStyle: {
- color: "rgba(255,255,255,.1)",
- type: "dotted"
- }
- }
- }],
- series: [{
- name: '数据1',
- type: 'bar',
- data: [2, 3, 3, 5, 15, 7, 6, 2, 6],
- barWidth:'15%', //柱子宽度
- // barGap: 1, //柱子之间间距
- itemStyle: {
- normal: {
- color:'#2f89cf',
- opacity: 1,
- barBorderRadius: 5,
- }
- }
- }, {
- name: '数据2',
- type: 'bar',
- data: [1, 4, 5, 3, 12, 3, 5, 3, 5],
- barWidth:'15%',
- // barGap: 1,
- itemStyle: {
- normal: {
- color:'#62c98d',
- opacity: 1,
- barBorderRadius: 5,
- }
- }
- },
- {
- name: '数据3',
- type: 'bar',
- data: [1, 3, 2, 4, 5, 2, 3, 1, 2],
- barWidth:'15%',
- // barGap: 1,
- itemStyle: {
- normal: {
- color:'#ffc107',
- opacity: 1,
- barBorderRadius: 5,
- }
- }
- },
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function echarts_7() {
- // 基于准备好的dom,初始化echarts实例
- var myChart = echarts.init(document.getElementById('echart7'));
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {type: 'shadow'},
- },
- grid: {
- left: '0',
- right: '0',
- bottom: '0',
- top: '10%',
- containLabel: true
- },
- xAxis: [{
- type: 'category',
- data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
- axisLine: {
- show: true,
- lineStyle: {
- color: "#ffffff",
- width: 1,
- type: "solid",
- opacity: 0.3
- }
- },
- axisTick: {
- show: false
- },
- axisLine:{ show: false},
- axisLabel: {
- show: true,
- textStyle: {
- color: "rgba(255,255,255,.5)",
- }
- },
- }],
- yAxis: [{
- type: 'value',
- axisLabel: {
- formatter: '{value}'
- },
-
- axisLine: {
- show: false,
- },
- axisLabel: {
- show: true,
- textStyle: {
- color: "rgba(255,255,255,.5)",
- }
- },
- axisTick: {
- show: false
- },
- splitNumber:3,
- splitLine: {
- lineStyle: {
- color: "rgba(255,255,255,.05)",
- }
- }
- }],
- series: [{
- type: 'pictorialBar',
- symbol: 'path://M35,0L35,70L0,70z M35,0L35,70L70,70z',
- data: [20, 50, 80, 58, 183, 68, 57, 80, 142, 66, 42, 66],
- barWidth: '40%', //柱子宽度
- itemStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
- offset: 0,
- color: '#173f9a'
- }, {
- offset: 0.5,
- color: '#173f9a'
- }, {
- offset: 0.5,
- color: '#247ed1'
- }
- , {
- offset: 1,
- color: '#247ed1'
- }]),
- opacity: 1,
- }
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- })
-
-
-
-
|