echarts-2.2.7标准面积图颜色渐变

来源:互联网 发布:淘宝主图背景 编辑:程序博客网 时间:2024/04/29 01:04
            var myChar11 = ec.init(document.getElementById('box-11'));            
myChar11.setOption(
{
   title : {
       text: '某楼盘销售情况',
       subtext: '纯属虚构'
   },
   tooltip : {
       trigger: 'axis'
   },
   legend: {
       data:['成交']
   },
   toolbox: {
       show : true,
       feature : {
           mark : {show: true},
           dataView : {show: true, readOnly: false},
           magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
           restore : {show: true},
           saveAsImage : {show: true}
       }
   },
   calculable : true,
   xAxis : [
       {
           type : 'category',
           boundaryGap : false,
           data : ['周一','周二','周三','周四','周五','周六','周日']
       }
   ],
   yAxis : [
       {
           type : 'value'
       }
   ],
   series : [
       {
           name:'成交',
           type:'line',
           smooth:true,
           itemStyle: {                          
             normal: {
                   borderRadius: 200,
                   // 添加渐变颜色
                   color : (function (){
                       var zrColor = require('zrender/tool/color');
                       return zrColor.getLinearGradient(
                           0, 0,1000, 0,
                           [[0, 'blue'],[1, 'yellow']]
                       )
                   })(),                
               areaStyle: {type: 'default'}}
           },
           data:[100, 200, 300, 400, 500, 830, 710]
       },

   ]
}
);



原创粉丝点击