Skip to content

Conversation

StNimmerlein
Copy link

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Apply correct color to gauge chart progress when set to 'auto' in svg renderer.

Fixed issues

Details

Before: What was the problem?

See the issue for more details.

image

After: How does it behave after the fixing?

image

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

Copy link

echarts-bot bot commented Aug 25, 2025

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make this a new feature rather than bug fixing because 'auto' was not mentioned in the current doc. Please also make a pull request to the doc repo. Thanks!

@@ -564,6 +564,11 @@ class GaugeView extends ChartView {
const progress = progressList[idx];
progress.useStyle(data.getItemVisual(idx, 'style'));
progress.setStyle(itemModel.getModel(['progress', 'itemStyle']).getItemStyle());
if (progress.style.fill === 'auto') {
progress.setStyle('fill', getColor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the same as in the above pointer. Let's create a autoColor after the const emphasisDisabled = emphasisModel.get('disabled'); line like:

const autoColor = (showPointer || showProgress)
    ? getColor(...)
    : null;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted the variable, but without the ternary (so it could be used in other cases as well).
If you prefer the ternary to be there for performance purposes, I can add it.

@Ovilia Ovilia changed the title fix(gauge): apply correct color to progress when set to 'auto' feat(gauge): progress.color supports 'auto' Sep 2, 2025
@Ovilia Ovilia added PR: awaiting doc Document changes is required for this PR. and removed PR: awaiting review PR: doc unchanged labels Sep 2, 2025
Copy link
Contributor

github-actions bot commented Sep 2, 2025

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21224@d69383c

@StNimmerlein
Copy link
Author

I think we should make this a new feature rather than bug fixing because 'auto' was not mentioned in the current doc. Please also make a pull request to the doc repo. Thanks!

In this section "auto" is mentioned for the pointer's color: https://github.com/apache/echarts-doc/blob/master/en/option/series/gauge.md#colorcolor--auto
Would it suffice to extend this paragraph by changing it to "The color of pointer and progress [...]"?

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

Successfully merging this pull request may close these issues.

[Bug] Gauge progress 'auto' color not reflected when using SVG renderer
2 participants