Skip to content
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): fix the bug of overriding title when click the stack button #13372

merged 2 commits into from Oct 10, 2020


Copy link

@pingf pingf commented Sep 29, 2020

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

fix bug of overriding the button title of the tool box

currently, if we change the title of the magic-type button in the toolbox, it works as expected
however, if we click the button for stack view, all magic type buttons' titles revert to the default

Fixed issues


Before: What was the problem?

to check this one, we need to do sth like this

toolbox: {
                magicType: {
                    show: true,
                    type: ['line', 'bar', 'stack'],
                    title: {
                        line: 'line view',
                        bar: 'bar view',
                        stack: 'stack view',
                        tiled: 'tiled view',

as stack and tiled are sth like a pair, we need to set the title for the tiled

but it only works if we never click the stack button,
once we click the button for stack, all titles revert to the the default chinese ones


After: How is it fixed in this PR?

the old code use title from ecModel as the base to override the new title
however, this disable the ability to override the title by users

In this PR, I change the logic to flip the title of stack and tiled when we click, and use model.option to get the title dynamically

newTitle = zrUtil.merge({
                stack: model.option.title.tiled,
                tiled: model.option.title.stack
            }, model.option.title)

and now it works as expected(tested on my local machine)



Are there any API changes?

  • The API has been changed.

Related test cases or examples to use the new APIs



Merging options

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

Other information

as I didn't find an existing test file for this, and I'm not familiar with the test structure of new echarts,
I didn't submit a independent test file for this,
but I do think the changes in this PR won't bother the main logic and will not decrease code coverage.
thx to @pissang & @Ovilia
just pushed the visual test action file in the latest commit

Copy link

echarts-bot bot commented Sep 29, 2020

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.

@pingf pingf changed the title [12979] fix the bug of overriding title when click the stack button fix(toolbox): fix the bug of overriding title when click the stack button Sep 30, 2020
@pissang pissang merged commit c5ab241 into apache:next Oct 10, 2020
Copy link

echarts-bot bot commented Oct 10, 2020

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@pingf pingf deleted the fix-12979 branch October 10, 2020 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants