配置项有时候不容易做到理想的简化。

通过代码逻辑来简化,可以么?比如:

```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'
    ]
}
```

[ Full content available at: 
https://github.com/apache/incubator-echarts/issues/9022 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to