You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/07/27 11:04:26 UTC

[GitHub] [echarts] Miever1 commented on issue #15608: 升级5.1版本后 点击还原按钮图像消失

Miever1 commented on issue #15608:
URL: https://github.com/apache/echarts/issues/15608#issuecomment-1196584995

   > > 请问这个问题解决了吗?我也遇到这个问题了。
   > 
   > 解决了。
   > 
   > 首先,这个问题出现的原因是5.x版本的toolbox.feature.restore会恢复到第一次chart.setOption(option1)后的状态,之后执行setOption是对之前的option1配置项的更新,大致意思是:option1 + option2 + ... , restore事件会直接恢复到option1状态。
   > 
   > 解决方式:官方文档配置项里有 [https://echarts.apache.org/zh/api.html#echartsInstance.setOption](https://echarts.apache.org/zh/api.html#echartsInstance.setOption?_blank) 更新图表时,加个参数: `setOption(option, { notMerge: true }) // 精简写法:setOption(option, true)`
   > 
   > 例如: import { merge } from 'lodash'
   > 
   >     * 恢复到option1:默认是恢复到setOption(option1)后的状态
   > 
   >     * 恢复到option2:setOption(merge(chart.getOption(), option2), true)
   > 
   >     * 恢复到option3:setOption(merge(chart.getOption(), option3), true)
   > 
   >     * 以此类推
   
   感觉这种修改就很多余,组件修复的难点是什么呢?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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