You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "sz-p (via GitHub)" <gi...@apache.org> on 2023/08/03 08:32:47 UTC

[GitHub] [echarts] sz-p commented on issue #18951: [Bug] Init echart with theme and no theme the color in chart is different

sz-p commented on issue #18951:
URL: https://github.com/apache/echarts/issues/18951#issuecomment-1663527598

   > I made a [minimal Reproduction](https://echarts.apache.org/examples/en/editor.html?c=line-simple&version=5.4.3&theme=dark&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMgL4A0asAnjvkUmRQDYCmA5s9ACZ0Pp7MAnCM0KwA2hXSp0M2GEohmRAOR4AxgEMwYQcvKz00DQFslsZVj2SZnLRqJixARlIAmALqkxr0gFZPYgDspE4BAMykAJwBAGykABzu7ta8MtIG8ooq6lo6AlYGsEamKgBCBQa2YPbiYgAsbuF-AcGBAQ0xAT5tybKpUtbomWaqmtq6-gbFIwDCFbJVNY4N_l7BoV6-pGEB8VGxjb0y_ciDcgojOeP5k7LTKgAi8zZ2DvUJLc1ecZ1eER5rbZJFIUTwUChqYCMYACBzKADETnikQADAAzNHKTzoAD0ONgAB4ALREgAqAAt8LAqWBycxqXg8ABXZgoYgAbiAA) from your example.
   > 
   > As you can see in there the part `{..., color: ['#1890ff']}` is the issue. A `color` property is not documented on `setOption` but it seems to set the color for all items in the plot. When using a theme this value is most likely overridden by the theme default values after it was initially set. Thats why its working with the "dark" theme.
   > 
   > If you remove the mentioned line the colors are equal for both themes:
   > 
   > ```js
   > option = {
   >   xAxis: {},
   >   yAxis: {},
   >   legend: {},
   >   series: [
   >     {
   >       type: 'scatter',
   >       name: 'A',
   >       data: [[1,2],[2,5],[7,1],[3,9],[6,8]]
   >     },
   >     {
   >       type: 'scatter',
   >       name: 'B',
   >       data: [[4,2],[3,5],[7,7],[4,6],[2,7]]
   >     },
   >     {
   >       type: 'scatter',
   >       name: 'C',
   >       data: [[4,5],[7,1],[5,3],[8,9],[6,2]]
   >     },
   >     {
   >       type: 'scatter',
   >       name: 'D',
   >       data: [[4,8],[7,5],[6,6],[3,2],[7,3]]
   >     }
   >   ],
   >   
   >   color: ['#1890ff'],  // <-- Remove this
   > };
   > ```
   
   Yes, this is a reasonable explanation.
   
   But I think the expected behavior should be `the chart color when using theme, the same as not using theme`.
   
   `option.color` priority higher than `theme`
   
   
   
   


-- 
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