123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944 |
- $(function () {
- /*ceshis();*/
- ceshis1();
- ceshis2();
- ceshis3();
- ceshis4();
- ceshis5();
- function ceshis1() {
- var myChart = echarts.init(document.getElementById('chart2'));
- var ydata = [{
- name: '天猫',
- value: 18
- },
- {
- name: '京东',
- value: 16
- },
- {
- name: '苏宁易购',
- value: 15
- },
- {
- name: '拼多多',
- value: 14
- },
- {
- name: '国美',
- value: 10
- },
- {
- name: '亚马逊',
- value: 7.9
- },
- {
- name: '唯品会',
- value: 6.7
- },
- {
- name: '其他',
- value: 6
- }
- ];
- var color = ["#8d7fec", "#5085f2", "#e75fc3", "#f87be2", "#f2719a", "#fca4bb", "#f59a8f", "#fdb301", "#57e7ec", "#cf9ef1"]
- var xdata = ['天猫', "京东", "苏宁易购", "拼多多", '国美', '亚马逊', '唯品会', '唯品会'];
- option = {
- /*backgroundColor: "rgba(255,255,255,1)",*/
- color: color,
- legend: {
- orient: "vartical",
- x: "left",
- top: "center",
- left: "53%",
- bottom: "0%",
- data: xdata,
- itemWidth: 8,
- itemHeight: 8,
- textStyle: {
- color: '#fff'
- },
- /*itemGap: 16,*/
- /*formatter:function(name){
- var oa = option.series[0].data;
- var num = oa[0].value + oa[1].value + oa[2].value + oa[3].value+oa[4].value + oa[5].value + oa[6].value + oa[7].value+oa[8].value + oa[9].value ;
- for(var i = 0; i < option.series[0].data.length; i++){
- if(name==oa[i].name){
- return ' '+name + ' | ' + oa[i].value + ' | ' + (oa[i].value/num * 100).toFixed(2) + '%';
- }
- }
- }*/
- formatter: function(name) {
- return '' + name
- }
- },
- series: [{
- type: 'pie',
- clockwise: false, //饼图的扇区是否是顺时针排布
- minAngle: 2, //最小的扇区角度(0 ~ 360)
- radius: ["20%", "60%"],
- center: ["30%", "45%"],
- avoidLabelOverlap: false,
- itemStyle: { //图形样式
- normal: {
- borderColor: '#ffffff',
- borderWidth: 1,
- },
- },
- label: {
- normal: {
- show: false,
- position: 'center',
- formatter: '{text|{b}}\n{c} ({d}%)',
- rich: {
- text: {
- color: "#fff",
- fontSize: 14,
- align: 'center',
- verticalAlign: 'middle',
- padding: 8
- },
- value: {
- color: "#8693F3",
- fontSize: 24,
- align: 'center',
- verticalAlign: 'middle',
- },
- }
- },
- emphasis: {
- show: true,
- textStyle: {
- fontSize: 24,
- }
- }
- },
- data: ydata
- }]
- };
- myChart.setOption(option);
- setTimeout(function() {
- myChart.on('mouseover', function(params) {
- if (params.name == ydata[0].name) {
- myChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: 0
- });
- } else {
- myChart.dispatchAction({
- type: 'downplay',
- seriesIndex: 0,
- dataIndex: 0
- });
- }
- });
- myChart.on('mouseout', function(params) {
- myChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: 0
- });
- });
- myChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: 0
- });
- }, 1000);
- myChart.currentIndex = -1;
- setInterval(function () {
- var dataLen = option.series[0].data.length;
- // 取消之前高亮的图形
- myChart.dispatchAction({
- type: 'downplay',
- seriesIndex: 0,
- dataIndex: myChart.currentIndex
- });
- myChart.currentIndex = (myChart.currentIndex + 1) % dataLen;
- // 高亮当前图形
- myChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: myChart.currentIndex
- });
- }, 1000);
- // 使用刚指定的配置项和数据显示图表。
- /*myChart.setOption(option);*/
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function ceshis2() {
- var myChart = echarts.init(document.getElementById('chart3'));
- option = {
- /*backgroundColor: '#000',*/
- "animation": true,
- "title": {
- /*"text": 24,*/
- /* "subtext": "沥青工",*/
- "x": "center",
- "y": "center",
- "textStyle": {
- "color": "#fff",
- "fontSize": 10,
- "fontWeight": "normal",
- "align": "center",
- "width": "200px"
- },
- "subtextStyle": {
- "color": "#fff",
- "fontSize": 12,
- "fontWeight": "normal",
- "align": "center"
- }
- },
- "legend": {
- "width": "100%",
- "left": "center",
- "textStyle": {
- "color": "#fff",
- "fontSize": 12
- },
- "icon": "circle",
- "right": "0",
- "bottom": "0",
- "padding": [15, 20],
- "itemGap": 5,
- "data": ["化妆品", "手机", "电脑", "羽绒服", "扫地机", "电视", "洗发露", "其它"]
- },
- "series": [{
- "type": "pie",
- "center": ["50%", "40%"],
- "radius": ["20%", "43%"],
- "color": ["#FEE449", "#00FFFF", "#00FFA8", "#9F17FF", "#FFE400", "#F76F01", "#01A4F7", "#FE2C8A"],
- "startAngle": 135,
- "labelLine": {
- "normal": {
- "length": 15
- }
- },
- "label": {
- "normal": {
- "formatter": "{b|{b}:} {per|{d}%} ",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "transparent",
- "borderRadius": 4,
- "rich": {
- "a": {
- "color": "#999",
- "lineHeight": 12,
- "align": "center"
- },
- "hr": {
- "borderColor": "#aaa",
- "width": "100%",
- "borderWidth": 1,
- "height": 0
- },
- "b": {
- "color": "#b3e5ff",
- "fontSize": 16,
- "lineHeight": 33
- },
- "c": {
- "fontSize": 14,
- "color": "#eee"
- },
- "per": {
- "color": "#FDF44E",
- "fontSize": 14,
- "padding": [5, 8],
- "borderRadius": 2
- }
- },
- "textStyle": {
- "color": "#fff",
- "fontSize": 16
- }
- }
- },
- "emphasis": {
- "label": {
- "show": true,
- "formatter": "{b|{b}:} {per|{d}%} ",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "transparent",
- "borderRadius": 4,
- "rich": {
- "a": {
- "color": "#999",
- "lineHeight": 22,
- "align": "center"
- },
- "hr": {
- "borderColor": "#aaa",
- "width": "100%",
- "borderWidth": 1,
- "height": 0
- },
- "b": {
- "color": "#fff",
- "fontSize": 14,
- "lineHeight": 33
- },
- "c": {
- "fontSize": 14,
- "color": "#eee"
- },
- "per": {
- "color": "#FDF44E",
- "fontSize": 14,
- "padding": [5, 6],
- "borderRadius": 2
- }
- }
- }
- },
- "data": [{
- "name": "化妆品",
- "value": 3
- }, {
- "name": "手机",
- "value": 2
- }, {
- "name": "电脑",
- "value": 26
- }, {
- "name": "羽绒服",
- "value": 24
- }, {
- "name": "扫地机",
- "value": 12
- }, {
- "name": "电视",
- "value": 11
- }, {
- "name": "洗发露",
- "value": 3
- }, {
- "name": "其它",
- "value": 2
- }]
- }, {
- "type": "pie",
- "center": ["50%", "40%"],
- "radius": ["15%", "14%"],
- "label": {
- "show": false
- },
- "data": [{
- "value": 78,
- "name": "实例1",
- "itemStyle": {
- "normal": {
- "color": {
- "x": 0,
- "y": 0,
- "x2": 1,
- "y2": 0,
- "type": "linear",
- "global": false,
- "colorStops": [{
- "offset": 0,
- "color": "#9F17FF"
- }, {
- "offset": 0.2,
- "color": "#01A4F7"
- }, {
- "offset": 0.5,
- "color": "#FE2C8A"
- }, {
- "offset": 0.8,
- "color": "#FEE449"
- }, {
- "offset": 1,
- "color": "#00FFA8"
- }]
- }
- }
- }
- }]
- }]
- }
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- myChart.currentIndex = -1;
- //myChart.setOption(option);
- //console.log(option.series[0].data[0]);
- setInterval(function () {
- var dataLen = option.series[0].data.length;
- // 取消之前高亮的图形
- myChart.dispatchAction({
- type: 'downplay',
- seriesIndex: 0,
- dataIndex: myChart.currentIndex
- });
- myChart.currentIndex = (myChart.currentIndex + 1) % dataLen;
- // 高亮当前图形
- myChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: myChart.currentIndex
- });
- }, 1000);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function ceshis3() {
- var myChart = echarts.init(document.getElementById('chart4'));
- var colors = ['rgb(46, 199, 201)', 'rgb(90, 177, 239)', 'rgb(255, 185, 128)'];
- option = {
- color: colors,
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross'
- },
- formatter: function(params) {
- // 系列
- let html = params[0].name + "<br>";
- for (var i = 0; i < params.length; i++) {
- // 获取每个系列对应的颜色值
- html += '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + params[i].color + ';"></span>';
- // 通过判断指定系列增加 % 符号
- if (option.series[params[i].seriesIndex].type == "line") {
- html += params[i].seriesName + ": " + params[i].value + "%<br>";
- } else {
- html += params[i].seriesName + ": " + params[i].value + "<br>";
- }
- }
- return html;
- }
- },
- grid: {
- right: '20%'
- },
- toolbox: {
- feature: {
- dataView: {
- show: true,
- readOnly: false
- },
- restore: {
- show: true
- },
- saveAsImage: {
- show: true
- }
- }
- },
- legend: {
- textStyle: {
- color: '#fff'
- },
- data: ['下单量', '付款量', '平均值']
- },
- // 缩放组件
- /*dataZoom: {
- type: 'slider'
- },*/
- xAxis: [{
- type: 'category',
- axisTick: {
- alignWithLabel: true
- },
- axisLabel: {
- formatter: '{value} 万',
- textStyle: {
- color: "#ffffff" //X轴文字颜色
- }
- },
- data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
- }],
- yAxis: [{
- type: 'value',
- name: '下单量',
- min: 0,
- max: 250,
- position: 'right',
- axisLine: {
- lineStyle: {
- color: colors[0]
- }
- },
- axisLabel: {
- formatter: '{value} 万'
- }
- },
- {
- type: 'value',
- name: '付款量',
- min: 0,
- max: 250,
- position: 'right',
- offset: 80,
- axisLine: {
- lineStyle: {
- color: colors[1]
- }
- },
- axisLabel: {
- formatter: '{value} 万'
- }
- },
- {
- type: 'value',
- name: '平均值',
- min: 0,
- max: 25,
- position: 'left',
- axisLine: {
- lineStyle: {
- color: colors[2]
- }
- },
- axisLabel: {
- formatter: '{value} 万'
- }
- }
- ],
- series: [{
- name: '下单量',
- type: 'bar',
- data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
- itemStyle: {
- normal: {
- barBorderRadius: 2
- }
- }
- },
- {
- barGap: '-50%', // 增加偏移量使重叠显示
- name: '付款量',
- type: 'bar',
- yAxisIndex: 1,
- data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],
- itemStyle: {
- normal: {
- barBorderRadius: 2
- }
- }
- },
- {
- name: '平均值',
- type: 'line',
- yAxisIndex: 2,
- data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2],
- }
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function ceshis4() {
- var myChart = echarts.init(document.getElementById('chart5'));
- var labelimg = "";
- option = {
- /*backgroundColor: "#0E233E",*/
- "grid": {
- "left": "6%",
- "top": "10%",
- "right": "3%",
- "bottom": "15%"
- },
- "legend": {
- "data": [
- "日本",
- "韩国",
- "美国",
- "澳大利亚",
- "俄罗斯",
- "法国",
- "英国"
- ],
- "top": "92%",
- "icon": "circle",
- "textStyle": {
- "color": "#0DCAD2"
- }
- },
- "color": [
- "#534EE1",
- "#ECD64F",
- "#00E4F0",
- "#44D16D",
- "#124E91",
- "#BDC414",
- "#C8CCA5"
- ],
- "tooltip": {
- "position": "top",
- },
- "xAxis": {
- "type": "category",
- "data": [
- "日本",
- "韩国",
- "美国",
- "澳大利亚",
- "俄罗斯",
- "法国",
- "英国"
- ],
- "axisLabel": {
- "show": false,
- "color": "#999999",
- "fontSize": 16
- },
- "axisTick": {
- "show": false
- },
- "axisLine": {
- "show": false
- },
- "splitLine": {
- "show": false
- }
- },
- "yAxis": {
- "type": "value",
- "axisLabel": {
- "show": false,
- "color": "#999999",
- "fontSize": 16
- },
- "axisTick": {
- "show": false
- },
- "axisLine": {
- "show": false
- },
- "splitLine": {
- "show": false
- }
- },
- "series": [{
- "name": "日本",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "韩国",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "美国",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "澳大利亚",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "俄罗斯",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "法国",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "name": "英国",
- "data": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "stack": "a",
- "type": "bar"
- },
- {
- "type": "pictorialBar",
- "name": "提示框值",
- "data": [{
- "name": "",
- "value": 868,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#534EE1",
- "align": "center",
- "height": 40
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -2,
- 0,
- 2,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 50,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(83,78,225,1)"
- },
- {
- "offset": 1,
- "color": "rgba(83,78,225,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 306,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#ECD64F",
- "align": "center",
- "height": 40
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(236,214,79,1)"
- },
- {
- "offset": 1,
- "color": "rgba(236,214,79,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 162,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#00E4F0",
- "align": "center",
- "height": 40
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(0,228,240,1)"
- },
- {
- "offset": 1,
- "color": "rgba(0,228,240,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 362,
- "label": {
- "show": true,
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "position": "top",
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#44D16D",
- "align": "center",
- "height": 40
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(68,209,109,1)"
- },
- {
- "offset": 1,
- "color": "rgba(68,209,109,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 460,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#124E91",
- "align": "center",
- "height": 30
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(18,78,145,1)"
- },
- {
- "offset": 1,
- "color": "rgba(18,78,145,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 606,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#BDC414",
- "align": "center",
- "height": 30
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(189,196,20,1)"
- },
- {
- "offset": 1,
- "color": "rgba(189,196,20,0)"
- }
- ],
- "global": false
- }
- }
- }
- },
- {
- "name": "",
- "value": 506,
- "label": {
- "show": true,
- "position": "top",
- formatter: function(params) {
- var index = params.dataIndex;
- var str = "{a|" + params.value + "}\n{c|" + params.value + "个}";
- return str;
- },
- "rich": {
- "a": {
- "fontSize": 18,
- "color": "#C8CCA5",
- "align": "center",
- "height": 30
- },
- "c": {
- "fontSize": 18,
- "color": "#fff",
- "padding": [
- -4,
- 0,
- 8,
- 0
- ],
- "backgroundColor": {
- "image": labelimg
- },
- "align": "center",
- "verticalAlign": "bottom",
- "height": 45,
- "lineHeight": 40,
- "width": 100
- }
- }
- },
- "itemStyle": {
- "normal": {
- "color": {
- "type": "linear",
- "x": 0,
- "y": 0,
- "x2": 0,
- "y2": 1,
- "colorStops": [{
- "offset": 0,
- "color": "rgba(200,204,165,1)"
- },
- {
- "offset": 1,
- "color": "rgba(200,204,165,0)"
- }
- ],
- "global": false
- }
- }
- }
- }
- ],
- "stack": "a",
- "symbol": "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z"
- }
- ]
- }
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function ceshis5() {
- var myChart = echarts.init(document.getElementById('map'));
- var uploadedDataURL = "./js/data-1528971808162-BkOXf61WX.json";
- //console.log(uploadedDataURL);
- // echarts.extendsMap = function(id, opt) {
- // // 实例
- // var cityMap = {
- // "郑州市": zhengzhou,
- // "开封市": kaifeng,
- // "洛阳市": luoyang,
- // "平顶山市": pingdingshan,
- // "安阳市": anyang,
- // "鹤壁市": hebi,
- // "新乡市": xinxiang,
- // "焦作市": jiaozuo,
- // "濮阳市": puyang,
- // "漯河市": luohe,
- // "三门峡市": sanmenxia,
- // "南阳市": nanyang,
- // "商丘市": shangqiu,
- // "信阳市": xinyang,
- // "周口市": zhoukou,
- // "许昌市": xuchang,
- // "驻马店市": zhumadian
- // };
- // }
- var geoGpsMap = {
- '1': [116.4071, 39.9046],
- '2': [125.8154, 44.2584],
- '3': [121.4737, 31.2303],
- '4': [117.1582, 36.8701],
- '5': [103.9526, 30.7617],
- '6': [106.6302, 26.6470],
- };
- var geoCoordMap = {
- "江苏": [118.8062, 31.9208],
- '黑龙江': [127.9688, 45.368],
- '内蒙古': [110.3467, 41.4899],
- "吉林": [125.8154, 44.2584],
- '北京市': [116.4551, 40.2539],
- "辽宁": [123.1238, 42.1216],
- "河北": [114.4995, 38.1006],
- "天津": [117.4219, 39.4189],
- "山西": [112.3352, 37.9413],
- "陕西": [109.1162, 34.2004],
- "甘肃": [103.5901, 36.3043],
- "宁夏": [106.3586, 38.1775],
- "青海": [101.4038, 36.8207],
- "新疆": [87.9236, 43.5883],
- "四川": [103.9526, 30.7617],
- "重庆": [108.384366, 30.439702],
- "山东": [117.1582, 36.8701],
- "河南": [113.4668, 34.6234],
- "安徽": [117.29, 32.0581],
- "湖北": [114.3896, 30.6628],
- "浙江": [119.5313, 29.8773],
- "福建": [119.4543, 25.9222],
- "江西": [116.0046, 28.6633],
- "湖南": [113.0823, 28.2568],
- "贵州": [106.6992, 26.7682],
- "云南": [102.9199, 25.4663],
- "广东": [113.12244, 23.009505],
- "广西": [108.479, 23.1152],
- "海南": [110.3893, 19.8516],
- '上海': [121.4648, 31.2891],
- };
- var d1 = {
- '江苏': 10041,
- '黑龙江': 4093,
- '内蒙古': 1157,
- '吉林': 4903,
- '北京市': 2667,
- '辽宁': 8331,
- '河北': 23727,
- '天津': 681,
- '山西': 5352,
- '陕西': 38,
- '甘肃': 77,
- '宁夏': 65,
- '青海': 10,
- '新疆': 193,
- '四川': 309,
- '重庆': 77,
- '山东': 21666,
- '河南': 15717,
- '安徽': 15671,
- '湖北': 3714,
- '浙江': 3141,
- '福建': 955,
- '江西': 4978,
- '湖南': 778,
- '贵州': 33,
- '云南': 149,
- '广东': 1124,
- '广西': 125,
- '海南': 7,
- '上海': 2155,
- };
- var d2 = {
- "江苏": 0,
- '黑龙江': 0,
- '内蒙古': 0,
- "吉林": 0,
- '北京市': 0,
- "辽宁": 0,
- "河北": 0,
- "天津": 0,
- "山西": 0,
- "陕西": 0,
- "甘肃": 0,
- "宁夏": 0,
- "青海": 0,
- "新疆": 0,
- "四川": 0,
- "重庆": 0,
- "山东": 0,
- "河南": 0,
- "安徽": 0,
- "湖北": 0,
- "浙江": 0,
- "福建": 0,
- "江西": 0,
- "湖南": 0,
- "贵州": 0,
- "云南": 0,
- "广东": 0,
- "广西": 0,
- '海南': 0,
- '上海': 0,
- };
- var d3 = {
- '江苏': 11788,
- '黑龙江': 1944,
- '内蒙古': 2954,
- '吉林': 3482,
- '北京市': 1808,
- '辽宁': 5488,
- '河北': 27035,
- '天津': 2270,
- '山西': 13623,
- '陕西': 4221,
- '甘肃': 754,
- '宁夏': 1783,
- '青海': 91,
- '新疆': 1907,
- '四川': 4905,
- '重庆': 1420,
- '山东': 39781,
- '河南': 16154,
- '安徽': 7914,
- '湖北': 6802,
- '浙江': 5812,
- '福建': 3345,
- '江西': 4996,
- '湖南': 5627,
- '贵州': 1504,
- '云南': 2725,
- '广东': 6339,
- '广西': 1009,
- '海南': 0,
- '上海': 1988,
- };
- var d4 = {
- "江苏": 0,
- '黑龙江': 0,
- '内蒙古': 0,
- "吉林": 0,
- '北京市': 0,
- "辽宁": 0,
- "河北": 0,
- "天津": 0,
- "山西": 0,
- "陕西": 0,
- "甘肃": 0,
- "宁夏": 0,
- "青海": 0,
- "新疆": 0,
- "四川": 0,
- "重庆": 0,
- "山东": 0,
- "河南": 0,
- "安徽": 0,
- "湖北": 0,
- "浙江": 0,
- "福建": 0,
- "江西": 0,
- "湖南": 0,
- "贵州": 0,
- "云南": 0,
- "广东": 0,
- "广西": 0,
- '海南': 0,
- '上海': 0,
- };
- var d5 = {
- '江苏': 159,
- '黑龙江': 5,
- '内蒙古': 54,
- '吉林': 10,
- '北京市': 0,
- '辽宁': 0,
- '河北': 1679,
- '天津': 1,
- '山西': 2698,
- '陕西': 1744,
- '甘肃': 362,
- '宁夏': 429,
- '青海': 122,
- '新疆': 731,
- '四川': 3925,
- '重庆': 1480,
- '山东': 79,
- '河南': 1017,
- '安徽': 208,
- '湖北': 1209,
- '浙江': 1418,
- '福建': 1237,
- '江西': 1004,
- '湖南': 1511,
- '贵州': 345,
- '云南': 1429,
- '广东': 2242,
- '广西': 2271,
- '海南': 59,
- '上海': 8,
- };
- var d6 = {
- "江苏": 20,
- '黑龙江': 60,
- '内蒙古': 80,
- "吉林": 10,
- '北京市': 80,
- "辽宁": 40,
- "河北": 50,
- "天津": 60,
- "山西": 40,
- "陕西": 60,
- "甘肃": 40,
- "宁夏": 10,
- "青海": 0,
- "新疆": 0,
- "四川": 80,
- "重庆": 0,
- "山东": 60,
- "河南": 0,
- "安徽": 0,
- "湖北": 10,
- "浙江": 100,
- "福建": 60,
- "江西": 0,
- "湖南": 0,
- "贵州": 150,
- "云南": 0,
- "广东": 80,
- "广西": 0,
- '海南': 0,
- '上海': 50,
- };
- var colors = [
- ["#1DE9B6", "#1DE9B6", "#FFDB5C", "#FFDB5C", "#04B9FF", "#04B9FF"],
- ["#1DE9B6", "#F46E36", "#04B9FF", "#5DBD32", "#FFC809", "#FB95D5", "#BDA29A", "#6E7074", "#546570", "#C4CCD3"],
- ["#37A2DA", "#67E0E3", "#32C5E9", "#9FE6B8", "#FFDB5C", "#FF9F7F", "#FB7293", "#E062AE", "#E690D1", "#E7BCF3", "#9D96F5", "#8378EA", "#8378EA"],
- ["#DD6B66", "#759AA0", "#E69D87", "#8DC1A9", "#EA7E53", "#EEDD78", "#73A373", "#73B9BC", "#7289AB", "#91CA8C", "#F49F42"],
- ];
- var colorIndex = 0;
- $(function() {
- // var geoCoordMap = {
- // '郑州': [113.64964385, 34.7566100641],
- // '开封': [114.351642118, 34.8018541758],
- // '洛阳': [112.447524769, 34.6573678177],
- // '平顶山': [113.300848978, 33.7453014565],
- // '安阳': [114.351806508, 36.1102667222],
- // '鹤壁': [114.297769838, 35.7554258742],
- // '新乡': [113.912690161, 35.3072575577],
- // '焦作': [113.211835885, 35.234607555],
- // '濮阳': [115.026627441, 35.7532978882],
- // '漯河': [114.0460614, 33.5762786885],
- // '三门峡': [111.181262093, 34.7833199411],
- // '南阳': [112.542841901, 33.0114195691],
- // "商丘": [115.641885688, 34.4385886402],
- // '信阳': [114.085490993, 32.1285823075],
- // '周口': [114.654101942, 33.6237408181],
- // '许昌': [113.83531246, 34.0267395887],
- // '驻马店': [114.049153547, 32.9831581541]
- // };
- var year = ["北京", "长春", "上海", "青岛", "成都", "贵阳"];
- var mapData = [
- [],
- [],
- [],
- [],
- [],
- [],
- ];
- /*柱子Y名称*/
- var categoryData = [];
- var barData = [];
- for (var key in geoCoordMap) {
- mapData[0].push({
- "year": '长春',
- "name": key,
- "value": d1[key] / 100,
- "value1": d1[key] / 100,
- });
- mapData[1].push({
- "year": '长春',
- "name": key,
- "value": d1[key] / 100,
- "value1": d2[key] / 100,
- });
- mapData[2].push({
- "year": '青岛',
- "name": key,
- "value": d3[key] / 100,
- "value1": d3[key] / 100,
- });
- mapData[3].push({
- "year": '青岛',
- "name": key,
- "value": d3[key] / 100,
- "value1": d4[key] / 100,
- });
- mapData[4].push({
- "year": '成都',
- "name": key,
- "value": d5[key] / 100,
- "value1": d5[key] / 100,
- });
- mapData[5].push({
- "year": '成都',
- "name": key,
- "value": d5[key] / 100,
- "value1": d6[key] / 100,
- });
- }
- for (var i = 0; i < mapData.length; i++) {
- mapData[i].sort(function sortNumber(a, b) {
- return a.value - b.value
- });
- barData.push([]);
- categoryData.push([]);
- for (var j = 0; j < mapData[i].length; j++) {
- barData[i].push(mapData[i][j].value1);
- categoryData[i].push(mapData[i][j].name);
- }
- }
- /*$.getJSON(uploadedDataURL, function(geoJson) {*/
- /*echarts.registerMap('china', geoJson);*/
- /*echarts.registerMap('china', geoJson);*/
- var convertData = function(data) {
- var res = [];
- for (var i = 0; i < data.length; i++) {
- var geoCoord = geoCoordMap[data[i].name];
- if (geoCoord) {
- res.push({
- name: data[i].name,
- value: geoCoord.concat(data[i].value)
- });
- }
- }
- return res;
- };
- var convertToLineData = function(data, gps) {
- var res = [];
- for (var i = 0; i < data.length; i++) {
- var dataItem = data[i];
- var toCoord = geoCoordMap[dataItem.name];
- //debugger;
- var fromCoord = gps; //郑州
- // var toCoord = geoGps[Math.random()*3];
- if (fromCoord && toCoord) {
- res.push([{
- coord: fromCoord,
- value: dataItem.value
- }, {
- coord: toCoord,
- }]);
- }
- }
- return res;
- };
- optionXyMap01 = {
- timeline: {
- data: year,
- axisType: 'category',
- autoPlay: true,
- playInterval: 3000,
- left: '10%',
- right: '10%',
- bottom: '3%',
- width: '80%',
- // height: null,
- label: {
- normal: {
- textStyle: {
- color: '#ddd'
- }
- },
- emphasis: {
- textStyle: {
- color: '#fff'
- }
- }
- },
- symbolSize: 10,
- lineStyle: {
- color: '#555'
- },
- checkpointStyle: {
- borderColor: '#777',
- borderWidth: 2
- },
- controlStyle: {
- showNextBtn: true,
- showPrevBtn: true,
- normal: {
- color: '#666',
- borderColor: '#666'
- },
- emphasis: {
- color: '#aaa',
- borderColor: '#aaa'
- }
- },
- },
- baseOption: {
- animation: true,
- animationDuration: 1000,
- animationEasing: 'cubicInOut',
- animationDurationUpdate: 1000,
- animationEasingUpdate: 'cubicInOut',
- grid: {
- right: '1%',
- top: '15%',
- bottom: '10%',
- width: '20%'
- },
- tooltip: {
- trigger: 'axis', // hover触发器
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
- shadowStyle: {
- color: 'rgba(150,150,150,0.1)' //hover颜色
- }
- }
- },
- geo: {
- show: true,
- map: 'china',
- roam: true,
- zoom: 1,
- center: [113.83531246, 34.0267395887],
- label: {
- emphasis: {
- show: false
- }
- },
- itemStyle: {
- normal: {
- borderColor: 'rgba(147, 235, 248, 1)',
- borderWidth: 1,
- areaColor: {
- type: 'radial',
- x: 0.5,
- y: 0.5,
- r: 0.8,
- colorStops: [{
- offset: 0,
- color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
- }, {
- offset: 1,
- color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色
- }],
- globalCoord: false // 缺省为 false
- },
- shadowColor: 'rgba(128, 217, 248, 1)',
- // shadowColor: 'rgba(255, 255, 255, 1)',
- shadowOffsetX: -2,
- shadowOffsetY: 2,
- shadowBlur: 10
- },
- emphasis: {
- areaColor: '#389BB7',
- borderWidth: 0
- }
- }
- },
- },
- options: []
- };
- for (var n = 0; n < year.length; n++) {
- optionXyMap01.options.push({
- /*backgroundColor: '#013954',*/
- title:
- [{
- text: '物流平台',
- subtext: ' ',
- left: '35%',
- top: '15%',
- textStyle: {
- color: '#fff',
- fontSize: 25
- }
- },
- {
- id: 'statistic',
- text: year[n] + "数据统计情况",
- left: '75%',
- top: '8%',
- textStyle: {
- color: '#fff',
- fontSize: 25
- }
- }
- ],
- xAxis: {
- type: 'value',
- scale: true,
- position: 'top',
- min: 0,
- boundaryGap: false,
- splitLine: {
- show: false
- },
- axisLine: {
- show: false
- },
- axisTick: {
- show: false
- },
- axisLabel: {
- margin: 2,
- textStyle: {
- color: '#aaa'
- }
- },
- },
- yAxis: {
- type: 'category',
- // name: 'TOP 20',
- nameGap: 16,
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ddd'
- }
- },
- axisTick: {
- show: false,
- lineStyle: {
- color: '#ddd'
- }
- },
- axisLabel: {
- interval: 0,
- textStyle: {
- color: '#ddd'
- }
- },
- data: categoryData[n]
- },
- series: [
- //未知作用
- {
- //文字和标志
- name: 'light',
- type: 'scatter',
- coordinateSystem: 'geo',
- data: convertData(mapData[n]),
- symbolSize: function(val) {
- return val[2] / 10;
- },
- label: {
- normal: {
- formatter: '{b}',
- position: 'right',
- show: true
- },
- emphasis: {
- show: true
- }
- },
- itemStyle: {
- normal: {
- color: colors[colorIndex][n]
- }
- }
- },
- //地图?
- {
- type: 'map',
- map: 'china',
- geoIndex: 0,
- aspectScale: 0.75, //长宽比
- showLegendSymbol: false, // 存在legend时显示
- label: {
- normal: {
- show: false
- },
- emphasis: {
- show: false,
- textStyle: {
- color: '#fff'
- }
- }
- },
- roam: true,
- itemStyle: {
- normal: {
- areaColor: '#031525',
- borderColor: '#FFFFFF',
- },
- emphasis: {
- areaColor: '#2B91B7'
- }
- },
- animation: false,
- data: mapData
- },
- //地图点的动画效果
- {
- // name: 'Top 5',
- type: 'effectScatter',
- coordinateSystem: 'geo',
- data: convertData(mapData[n].sort(function(a, b) {
- return b.value - a.value;
- }).slice(0, 20)),
- symbolSize: function(val) {
- return val[2] / 10;
- },
- showEffectOn: 'render',
- rippleEffect: {
- brushType: 'stroke'
- },
- hoverAnimation: true,
- label: {
- normal: {
- formatter: '{b}',
- position: 'right',
- show: true
- }
- },
- itemStyle: {
- normal: {
- color: colors[colorIndex][n],
- shadowBlur: 10,
- shadowColor: colors[colorIndex][n]
- }
- },
- zlevel: 1
- },
- //地图线的动画效果
- {
- type: 'lines',
- zlevel: 2,
- effect: {
- show: true,
- period: 4, //箭头指向速度,值越小速度越快
- trailLength: 0.1, //特效尾迹长度[0,1]值越大,尾迹越长重
- symbol: 'arrow', //箭头图标
- symbolSize: 5, //图标大小
- },
- lineStyle: {
- normal: {
- color: colors[colorIndex][n],
- width: 0.3, //尾迹线条宽度
- opacity: 0.8, //尾迹线条透明度
- curveness: .3 //尾迹线条曲直度
- }
- },
- data: convertToLineData(mapData[n], geoGpsMap[n + 1])
- },
- //柱状图
- {
- zlevel: 1.5,
- type: 'bar',
- symbol: 'none',
- itemStyle: {
- normal: {
- color: colors[colorIndex][n]
- }
- },
- data: barData[n]
- }
- ]
- })
- }
- myChart.setOption(optionXyMap01);
- /*});*/
- });
- function randomNum(minNum, maxNum) {
- switch (arguments.length) {
- case 1:
- return parseInt(Math.random() * minNum + 1, 10);
- break;
- case 2:
- return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
- break;
- default:
- return 0;
- break;
- }
- }
- // 使用刚指定的配置项和数据显示图表。
- //myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- function ceshis7() {
- var myChart = echarts.init(document.getElementById('chart_1'));
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- window.addEventListener("resize",function(){
- myChart.resize();
- });
- }
- });
|