You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/09/07 17:07:05 UTC

[GitHub] 100pah commented on issue #9022: dataset提供渲染数据,怎么定制legend样式?

100pah commented on issue #9022: dataset提供渲染数据,怎么定制legend样式?
URL: https://github.com/apache/incubator-echarts/issues/9022#issuecomment-419504849
 
 
   配置项有时候不容易做到理想的简化。
   
   通过代码逻辑来简化,可以么?比如:
   
   ```js
   var source = {
       'week': ['周一','周二','周三','周四','周五','周六','周日'],
       '邮件营销': [120, 132, 101, 134, 90, 230, 210],
       '联盟广告': [220, 182, 191, 234, 290, 330, 310],
       '视频广告': [150, 232, 201, 154, 190, 330, 410],
       '直接访问': [320, 332, 301, 334, 390, 330, 320],
       '搜索引擎': [820, 932, 901, 934, 1290, 1330, 1320]
   };
   
   option = {
       title: {
           text: '多折线图'
       },
       tooltip: {
           trigger: 'axis'
       },
       legend: {
           data: Object.keys(source).slice(1).map(
               name => ({icon:'circle', name: name})
           )
       },
       dataset:{
           source: source
       },
       grid: {
           left: '3%',
           right: '4%',
           bottom: '3%',
           containLabel: true
       },
       toolbox: {
           feature: {
               saveAsImage: {}
           }
       },
       xAxis: {
           type: 'category',
           boundaryGap: false
       },
       yAxis: {
           type: 'value'
       },
       series: Object.keys(source).slice(1).map(
           () => ({type: 'line'})
       ),
       color: [
           '#FF9C6E', '#FFC069', '#95DE64', '#5CDBD3', '#69C0FF', '#85A5FF', '#B37FEB', '#FF85C0'
       ]
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org