码迷,mamicode.com
首页 > 编程语言 > 详细

echarts 单选legend 并排序

时间:2017-05-27 19:13:55      阅读:464      评论:0      收藏:0      [点我收藏+]

标签:mst   ems   key   word   .so   return   cti   push   item   

 

一、legend 单选设置:

   legend : {
        data : [‘周末双休‘, ‘周末轮休‘, ‘周末补休‘],
        selected : {
            ‘周末轮休‘ : false,
            ‘周末补休‘ : false
        },
        selectedMode : "single"
    }
 
二、排序
    有 arry1, arry2, arry3
 
series : [{
            name : ‘周末双休‘,
            type : ‘bar‘,
            itemStyle : dataStyle,
            data : (function () {
                var data = [];
                arry1.sort(function(a,b){
                                  if(a>b)
                                    return -1;      //降序
                                  else
                                   return 1;
 
                                })
                arry1.forEach(function (item) {
                    data.push(parseInt(item))
                })
                return data;
            })()
        }, {
            name : ‘周末轮休‘,
            type : ‘bar‘,
            itemStyle : dataStyle,
            data : (function () {
                var data = [];
                arry2.sort(function(a,b){
                  if(a>b)
                    return -1;
                  else
                   return 1;
 
                })
                arry2.forEach(function (item) {
                    data.push(parseInt(item))
                })
                return data;
            })()
        }, {
            name : ‘周末不修‘,
            type : ‘bar‘,
            itemStyle : dataStyle,
            data : (function () {
                var data = [];
                arry3.sort(function(a,b){
                      if(a>b)
                        return -1;
                      else
                       return  1;
 
                    })
                arry3.forEach(function (item) {
                    data.push(parseInt(item))
                })
                return data;
            })()
        }
    ]

echarts 单选legend 并排序

标签:mst   ems   key   word   .so   return   cti   push   item   

原文地址:http://www.cnblogs.com/conserdao/p/6914008.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!