中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Echarts 示例代碼

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

基于Canvas,純Javascript圖表庫,提供直觀,生動,可交互,可個性化定制的數(shù)據(jù)可視化圖表。創(chuàng)新的拖拽重計算、數(shù)據(jù)視圖、值域漫游等特性大大增強(qiáng)了用戶體驗,賦予了用戶對數(shù)據(jù)進(jìn)行挖掘、整合的能力。開源來自百度商業(yè)前端數(shù)據(jù)可視化團(tuán)隊。

ECharts (Enterprise Charts 商業(yè)產(chǎn)品圖表庫)

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>  
    <%  
    String path = request.getContextPath();  
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
    %>  
      
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
    <html>  
      <head>  
        <meta charset="utf-8">  
        <title>Echarts</title>  
        
      <script type="text/javascript" src="js/esl.js"></script>  
        
      <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>  
      </head>  
      <body>  
        <div id="main" style="height:500px"></div>  
          
         <div>  
             <span id='wrong-message' style="color:red"></span>  
             <span id='hover-console' style="color:#1e90ff"></span>  
             <span id='console' style="color:#1e90ff">Event Console</span>  
         </div>  
            
          <!--echarts 包 -->  
        <script type="text/javascript" src="js/echarts.js"></script>  
      
        <script type="text/javascript">  
              
            //路徑配置  
            require.config({  
                paths:{  
                    //zrender:'./zrender/src',  
                     echarts: './js',  
                     //"jquery":"./js/jquery-2.1.0.min"  
                    }  
            });  
              
            var data_array=[12,47,39,45,30,20];  
            var str_array=["江西","福建","北京","黑龍江","海南","安徽"];  
              
              
            //設(shè)置主要樣式  
            require(  
                [  
                    'echarts',  
                    'echarts/chart/bar',  
                    'echarts/chart/line',  
                    //'jquery'  
                ],  
                function(ec){   
                     //初始化echart對象  
                       var myChart = ec.init(document.getElementById('main'));//ec.init( $("#main")));//   
                      
                    var option={  
                      
                    //標(biāo)題  
                    title:{  
                        show:true,  
                        //主標(biāo)題  
                        text:"省份基地數(shù)量 ",  
                        link:"http://www.baidu.com",  
                        target:"blank",  
                        textStyle:{  
                            color:"#9932CC"  
                        },   
                        //副標(biāo)題  
                        subtext:"**機(jī)密**",  
                         sublink:'www.google.com',  
                        subtarget:'self',  
                        subtextStyle:{  
                            color:"#8F8F8F",  
                            fontSize:16,  
                            align:'center'  
                        },  
                        //位置  
                        x:'left',  
                        y:'top',  
                        textAlign:'left',  
                        //顏色  
                        backgroundColor:"#FFD39B",  
                        padding:2,  
                        //主副標(biāo)題縱向間隔  
                        itemGap:3,  
                        borderWidth:1  
                    },  
                      
                    //提示欄  
                    tooltip:{  
                        show:true,  
                        //zlevel:1,  
                        //  z:3,  
                        //觸發(fā)類型  
                        trigger:'axis',//默認(rèn)為'item'  
                        //延時  
                        //showDelay:1000,                     
                        enterable:true,                   
                        //顏色  
                        backgroundColor:"#AB82FF",  
                          
                        testStyle:{  
                          color: 'yellow',  
                            decoration: 'none',  
                            fontFamily: 'Verdana, sans-serif',  
                            fontSize: 15,  
                            fontStyle: 'italic',  
                            fontWeight: 'bold'  
                        },  
                        //坐標(biāo)軸指示器  
                        axisPointer:{  
                             type: 'line',  
                                lineStyle: {  
                                    color: '#48b',  
                                    width: 2,  
                                    type: 'solid'  
                                },  
                                crossStyle: {  
                                    color: '#1e90ff',  
                                    width: 1,  
                                    type: 'dashed'  
                                },  
                                shadowStyle: {  
                                    color: 'rgba(150,150,150,0.3)',  
                                    width: 'auto',  
                                    type: 'default'  
                                }  
                            },  
                          
                          
                        //內(nèi)容格式化    
                        formatter:function(params,ticket,callback)  
                        {                     
                        //處理提示框顯示的信息  
                            console.log(params);  
                                var res=params[0].name+'<br/>';  
                                for(var i=0;i<params.length;i++)  
                                {  
                                    res+=params[i].seriesName+':'+params[i].value;  
                                      
                                }  
                            //模擬異步回調(diào)  
                            setTimeout(function()  
                            {  
                                callback(ticket,res);  
                                  
                            },500)  
                            return "loading";  
                        }  
                          
                    //formatter: "<br/>{a}:{c}"  
                    },  
                      
                    //工具箱  
                    toolbox:{  
                        show:true,  
                        orient:'vertical',  
                        x:'right',  
                        y:'top',  
                        itemSize:20,  
                          
                        //特征  
                        feature:{  
                                 mark : {  
                                        show : true,  
                                        title : {  
                                            mark : '輔助線開關(guān)',  
                                            markUndo : '刪除輔助線',  
                                            markClear : '清空輔助線'  
                                        },  
                                        lineStyle : {  
                                            width : 2,  
                                            color : '#1e90ff',  
                                            type : 'dashed'  
                                        }  
                                    },  
                                    dataZoom : {  
                                        show : true,  
                                        title : {  
                                            dataZoom : '區(qū)域縮放',  
                                            dataZoomReset : '區(qū)域縮放后退'  
                                        }  
                                    },  
                                    dataView : {  
                                        show : true,  
                                        title : '數(shù)據(jù)視圖',  
                                        readOnly: false,  
                                        lang: ['數(shù)據(jù)視圖', '關(guān)閉', '刷新']  
                                    },  
                                    magicType: {  
                                        show : true,  
                                        title : {  
                                            line : '折線圖切換',  
                                            bar : '柱形圖切換',  
                                            stack : '堆積',  
                                            tiled : '平鋪',  
                                            force: '力導(dǎo)向布局圖切換',  
                                            chord: '和弦圖切換',  
                                            pie: '餅圖切換',  
                                            funnel: '漏斗圖切換'  
                                        },  
                                        //為各個切換試圖單獨設(shè)置option  
                                      /*   option: { 
                                            // line: {...}, 
                                            // bar: {...}, 
                                            // stack: {...}, 
                                            // tiled: {...}, 
                                            // force: {...}, 
                                            // chord: {...}, 
                                            // pie: {...}, 
                                            // funnel: {...} 
                                        },*/  
                                        type : ['line', 'bar' ,'stack', 'tiled']   
                                    },  
                                    restore : {  
                                        show : true,  
                                        title : '還原'  
                                    },  
                                    saveAsImage : {  
                                        show : true,  
                                        title : '保存為圖片',  
                                        type : 'png',  
                                        lang : ['點擊保存']  
                                    }  
                                }                                 
                                  
                          
                                 /*    feature : { 
                                        mark : {show: true}, 
                                        dataView : {show: true, readOnly: false}, 
                                        magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']}, 
                                        restore : {show: true}, 
                                        saveAsImage : {show: true} 
                                    }       */           
                    },  
                      
                //圖例          
                      legend: {  
                            data:str_array,//['銷量']  
                            //selectMode:'multiple',  
                            //selected:{  
                            //  '江西':false  
                           // }  
                        },  
                    xAxis:[  
                        {                     
                            type:'category',                      
                            data:str_array  
                        }  
                    ],  
                    yAxis:[  
                        {  
                            type:'value'  
                        }  
                    ],  
                    /*  timeline:{  //時間軸 
                         data:[ 
                                '2002-01-01','2003-01-01','2004-01-01', 
                                '2005-01-01','2006-01-01','2007-01-01', 
                            ], 
                            checkpointStyle:{ 
                                        symbol : 'auto', 
                                        symbolSize : 'auto', 
                                        color : 'auto', 
                                        borderColor : 'auto', 
                                        borderWidth : 'auto', 
                                        label: { 
                                            show: false, 
                                            textStyle: { 
                                                color: 'red' 
                                            } 
                                        } 
                                    }               
                             
                             label : { 
                                formatter : function(s) { 
                                    return s.slice(0, 4); 
                                } 
                            }, 
                            autoPlay : true,  
                            playInterval : 1000 
                     
                    }, */  
                       
                    //數(shù)據(jù)系列,一個圖表可能包含多個系列,每一個系列可能包含多個數(shù)據(jù)  
                     series:[  
                            {  
                                name:"數(shù)量",  
                                type:"bar",  
                                data:data_array,  
                                itemStyle: {normal: {areaStyle: {type: 'default'}}}  
                                  
                            },  
                            {  
                            name:"數(shù)量",  
                            type:"line",  
                            data:data_array  
                              
                            }  
                              
                        ]  
      
                    };//end of option  
                  
                    myChart.setOption(option);      
                      
                      
                      
                      
                    //事件命名統(tǒng)一掛載到require('echarts/config').EVENT  
                    var ecConfig = require('echarts/config');  
                    //綁定事件  
                    myChart.on(ecConfig.EVENT.CLICK, eConsole1);   
                      
                    //事件響應(yīng)函數(shù)處理  
                        function eConsole1(param) {  
                            var mes = '【' + param.type + '】';  
                            if (typeof param.seriesIndex != 'undefined') {  
                                mes += '  seriesIndex : ' + param.seriesIndex;  
                                mes += '  dataIndex : ' + param.dataIndex;  
                            }  
                            if (param.type == 'hover') {  
                                document.getElementById('hover-console').innerHTML = 'Event Console : ' + mes;  
                                alert(mes);  
                            }  
                            else {  
                                document.getElementById('console').innerHTML = mes;  
                                alert(mes);  
                            }  
                            console.log(param);  
                        };  
                                              
                }//end of function  
       
        );//end of require  
                      
                      
        </script>     
      </body>  
    </html>  

標(biāo)簽: Google isp

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Python讀寫 ini文件的代碼

下一篇: js模仿java的Map集合,實現(xiàn)功能