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
fix(toolbox): use default boundaryGap
when switching the line & bar series by the toolbox
component
#19509
base: master
Are you sure you want to change the base?
Conversation
…sing default boundaryGap configuration.
Thanks for your contribution! |
last pr #19428 is broken. this is new. |
boundaryGap
when switching the line & bar series by the toolbox
component
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19509@89007be |
@gooroodev review |
Summary of ChangesThe pull request makes the following changes to the
Issues, Bugs, or Typos
Proposed Improvements
General Review of Code Quality and Style
Here is the revised diff with the proposed comment improvement: diff --git a/src/component/toolbox/feature/MagicType.ts b/src/component/toolbox/feature/MagicType.ts
index e13d6db6cd..e9aec1fbfc 100644
--- a/src/component/toolbox/feature/MagicType.ts
+++ b/src/component/toolbox/feature/MagicType.ts
@@ -116,7 +116,7 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
zrUtil.defaults(newSeriesOpt, seriesModel.option);
(newOption.series as SeriesOption[]).push(newSeriesOpt);
}
- // Modify boundaryGap
+ // Modify series options and ensure default boundaryGap behavior
const coordSys = seriesModel.coordinateSystem;
if (coordSys && coordSys.type === 'cartesian2d' && (type === 'line' || type === 'bar')) {
const categoryAxis = coordSys.getAxesByScale('ordinal')[0];
@@ -130,7 +130,6 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
for (let i = 0; i <= axisIndex; i++) {
(newOption[axisType] as any)[axisIndex] = (newOption[axisType] as any)[axisIndex] || {};
}
- (newOption[axisType] as any)[axisIndex].boundaryGap = type === 'bar';
}
}
}; With these changes, the code should be clearer and maintain the intended functionality. Yours, Gooroo.dev. To receive reviews automatically, install Github App |
…ng default boundaryGap configuration.
Brief Information
This pull request is in the type of:
What does this PR do?
Fixed using the toolbox to change line or bar charts but without using default boundaryGap configuration.
Fixed issues
Details
Before: What was the problem?
using the toolbox to change line or bar charts but without using default boundaryGap configuration.
After: How does it behave after the fixing?
start
before
after
change
official website demo
official demo
modify xAxis->boundaryGap: fasle to boundaryGap: true, click run then click switch to line chart.
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