echarts itemStyle symbol 折線圖原點樣式調整


symbol 適用類型 :折線圖、散點圖 。默認:null

 

標志圖形類型,默認自動選擇(8種類型循環使用,不顯示標志圖形可設為'none'),默認循環選擇類型有:
'circle' | 'rectangle' | 'triangle' | 'diamond' |
'emptyCircle' | 'emptyRectangle' | 'emptyTriangle' | 'emptyDiamond' 
另外,還支持五種更特別的標志圖形'heart'(心形)、'droplet'(水滴)、'pin'(標注)、'arrow'(箭頭)和'star'(五角星),這並不出現在常規的8類圖形中,但無論是在系列級還是數據級上你都可以指定使用,同時,'star' + n(n>=3)可變化出N角星,如指定為'star6'則可以顯示6角星 
自1.3.5起支持symbol為自定義圖片,格式為'image://' + '圖片路徑', 如'image://../asset/ico/favicon.png' 
 
復制代碼
option = {
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['郵件營銷','聯盟廣告','直接訪問','搜索引擎']
    },
    toolbox: {
        show : true
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : ['周一','周二','周三','周四','周五','周六','周日']
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'郵件營銷',
            type:'line',
            stack: '總量',
            symbol: 'none',
            itemStyle: {
                normal: {
                    areaStyle: {
                        // 區域圖,縱向漸變填充
                        color : (function (){
                            var zrColor = require('zrender/tool/color');
                            return zrColor.getLinearGradient(
                                0, 200, 0, 400,
                                [[0, 'rgba(255,0,0,0.8)'],[0.8, 'rgba(255,255,255,0.1)']]
                            )
                        })()
                    }
                }
            },
            data:[
                120, 132, 301, 134, 
                {value:90, symbol:'droplet',symbolSize:5},
                230, 210
            ]
        },
        {
            name:'聯盟廣告',
            type:'line',
            stack: '總量',
            smooth: true,
            symbol: 'image://../asset/ico/favicon.png',     // 系列級個性化拐點圖形
            symbolSize: 8,
            data:[
                120, 82,
                {
                    value:201,
                    symbol: 'star',  // 數據級個性化拐點圖形
                    symbolSize : 15,
                    itemStyle : { normal: {label : {
                        show: true,
                        textStyle : {
                            fontSize : '20',
                            fontFamily : '微軟雅黑',
                            fontWeight : 'bold'
                        }
                    }}}
                },
                {
                    value:134,
                    symbol: 'none'
                },
                190, 
                {
                    value : 230,
                    symbol: 'emptypin',
                    symbolSize: 8
                },
                110
            ]
        },
        {
            name:'直接訪問',
            type:'line',
            stack: '總量',
            symbol: 'arrow',
            symbolSize: 6,
            symbolRotate: -45,
            itemStyle: {
                normal: {
                    color: 'red',
                    lineStyle: {        // 系列級個性化折線樣式
                        width: 2,
                        type: 'dashed'
                    }
                },
                emphasis: {
                    color: 'blue'
                }
            },
            data:[
                320, 332, '-', 334,
                {
                    value: 390,
                    symbol: 'star6',
                    symbolSize : 20,
                    symbolRotate : 10,
                    itemStyle: {        // 數據級個性化折線樣式
                        normal: {
                            color: 'yellowgreen'
                        },
                        emphasis: {
                            color: 'orange',
                            label : {
                                show: true,
                                position: 'inside',
                                textStyle : {
                                    fontSize : '20'
                                }
                            }
                        }
                    }
                },
                330, 320
            ]
        },
        {
            name:'搜索引擎',
            type:'line',
            symbol:'emptyCircle',
            itemStyle: {
                normal: {
                    lineStyle: {            // 系列級個性化折線樣式,橫向漸變描邊
                        width: 2,
                        color: (function (){
                            var zrColor = require('zrender/tool/color');
                            return zrColor.getLinearGradient(
                                0, 0, 1000, 0,
                                [[0, 'rgba(255,0,0,0.8)'],[0.8, 'rgba(255,255,0,0.8)']]
                            )
                        })(),
                        shadowColor : 'rgba(0,0,0,0.5)',
                        shadowBlur: 10,
                        shadowOffsetX: 8,
                        shadowOffsetY: 8
                    }
                },
                emphasis : {
                    label : {show: true}
                }
            },
            data:[
                620, 732, 791, 
                {value:734, symbol:'emptyHeart',symbolSize:10},
                890, 930, 820
            ]
        }
    ]
};
                    
復制代碼

 

 
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM