miniboxhaha opened a new issue #8854: 改变visualMap颜色不起作用
URL: https://github.com/apache/incubator-echarts/issues/8854
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   使用myChart.setOption(options, {notMerge:true})
   改变visualMap->inRange->color时不起作用
   
   
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:4.0.2
   + Browser version [浏览器类型和版本]:Chrome 67.0.3396.62
   + OS Version [操作系统类型和版本]:WIN7
   
   
   
   
   
   ### Expected behaviour [期望结果]
   
   
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 
option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   let options = this.myChart.getOption()
   let keyName = 'keyName'
   /////////////////////////可以正常更改Y轴颜色、标签
   let newYAxis = options.yAxis.map((item, index) =>{
        if(item.name === keyName){
                return item
        }else{
                if(index > posInArr){
                        item.nameTextStyle.color = [options.color[index - 1]]
                        item.axisLabel.color = [options.color[index - 1]]
                        item.axisLine.lineStyle.color = [options.color[index - 
1]]
                        item.offset = (index - 1)*(-15)
                        item.position = (index -1) % 2 > 0 ? 'right' : 'left'
                }
                return item
        }
   })
   
   newYAxis.forEach((item, index) =>{
        if(item.name === keyName){
                newYAxis.splice(index,1)
        }
   })
   
   /////////////////////////不能正常更改线条及visualMap颜色
   let newVisualMap = options.visualMap.map((item, index) =>{
        if(item.name === keyName){
                return item
        }else{
                if(index > posInArr){
                        item.seriesIndex = item.seriesIndex -1
                        item.inRange.color = [options.color[index - 1]]
                }
                return item
        }
   })
   
   newVisualMap.forEach((item, index) =>{
        if(item.id === keyName){
                newVisualMap.splice(index,1)
        }
   })
   
   
   options.visualMap = newVisualMap
   myChart.setOption(options, {notMerge:true})
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   ### 截图
   
https://img-blog.csdn.net/20180810174024843?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2pveW1vZA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to