-
Notifications
You must be signed in to change notification settings - Fork 19.8k
feat(gauge): progress.color supports 'auto' #21224
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
base: master
Are you sure you want to change the base?
feat(gauge): progress.color supports 'auto' #21224
Conversation
Thanks for your contribution! |
There was a problem hiding this 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!
src/chart/gauge/GaugeView.ts
Outdated
@@ -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( |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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.
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21224@d69383c |
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 |
Brief Information
This pull request is in the type of:
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.
After: How does it behave after the fixing?
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information