New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

series[i]-parallel.data[i].lineStyle(.normal).color不起作用 #5363

Closed
billy-poon opened this Issue Mar 27, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@billy-poon

billy-poon commented Mar 27, 2017

One-line summary [问题简述]

series[i]-parallel.data[i].lineStyle(.normal).color不起作用

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.4.0
  • Browser version [浏览器类型和版本]: Google Chrome 56.0.2924.87 (64-bit)
  • OS Version [操作系统类型和版本]: Windows 10 Pro x64 1607

Expected behaviour [期望结果]

根据数据具体情况选择特定颜色渲染Parallel数据折线,按照配置项文档说明设置实际上没有起作用

ECharts option [ECharts配置项]

option = {
  ...,
  series: [{
    type: "parallel",
    data: [
      {
        "value": [
          "韶关",
          "63.37",
          "38.41",
          "72.15",
          "57.33",
          "84.56",
          "82.66"
        ],
        "lineStyle": {
          "normal": {
            "color": "#749f83",
          }
        }
      },
      {
        "value": [
          "湛江",
          "31.42",
          "99.18",
          "44.09",
          "3.62",
          "5.65",
          "63.37"
        ],
        "lineStyle": {
          "normal": {
            "color": "#ca8622",
          }
        }
      } 
    ]
  }]
}

Other comments [其他信息]

经查阅源码,发现chart/parallel/ParallelView.jsfunction updateElCommon第196~203行:

            line.useStyle(zrUtil.extend(
                lineStyle,
                {
                    fill: null,
                    stroke: data.getItemVisual(dataIndex, 'color'),
                    opacity: data.getItemVisual(dataIndex, 'opacity')
                }
            ));

data项设置的color/opacity属性会被全局默认值或series[i]-parallel.lineStyle覆盖,如果将lineStyle改成zrUtil.extend函数调用的第二个参数,则可得到期望的渲染效果。

不知此处是编写失误还是有意为之?

另外配置项文档中对series[i]-parallel.data[i].lineStyle的说明,其子项包括normal/emphasis,也包括color/width/type/opacity等,这些color/width/type/opacity应该放在lineStyle下还是该放在lineStyle.normal下还是两者都可以,没有任何说明,让人有点懵逼。。。

@100pah 100pah closed this in a7c9c58 Mar 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment