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: svg renderer not works in website demo #5000

Merged
merged 3 commits into from
May 12, 2023
Merged

Conversation

hustcc
Copy link
Member

@hustcc hustcc commented May 10, 2023

fixed #4990

因为 PR #4721 将用户传入的 renderer omit 了,所以使用了默认的 canvas 渲染。@lxfu1

options(options?: G2ViewTree): Chart | G2ViewTree {
  if (arguments.length === 0) {
    return this._options || optionsOf(this);
  }
  this._options = deepMix(
    this._options || optionsOf(this),
    omit(options, SPEC_EXTERNAL_KEYS),
  );
  return this;
}

@hustcc hustcc requested review from pearmini and lxfu1 May 10, 2023 20:13
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

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

加一个测试?

src/api/chart.ts Outdated Show resolved Hide resolved
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

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

还需要把 renderer 和 plugins 从 options 里面解构出来,不然 chart.options 里面有这个两个配置,spec tab 会出问题:包含了 renderer 和 plugins。

class Chart {
  constructor(options) {
    this._renderer = options.renderer;
    this._plugins = options.plugins;
  }
}

@hustcc
Copy link
Member Author

hustcc commented May 11, 2023

相当于说 option 和 spec 不是一个东西,option 内容更多?

@pearmini
Copy link
Member

pearmini commented May 11, 2023

相当于说 option 和 spec 不是一个东西,option 内容更多?

constructor.options = 渲染器的配置(container,renderer,plugs)+ 图表的配置(spec)

chart.options 返回和设置的是图表的配置

@hustcc hustcc merged commit dec8699 into v5 May 12, 2023
3 checks passed
@hustcc hustcc deleted the fix-svg-renderer-demo branch May 12, 2023 02:48
hustcc added a commit that referenced this pull request May 16, 2023
* fix: svg renderer not works in website demo

* test: add testcase for renderer

* refactor: move utils into another file
hustcc added a commit that referenced this pull request May 16, 2023
* fix: svg renderer not works in website demo

* test: add testcase for renderer

* refactor: move utils into another file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SVG 渲染器下,DEMO 依然是 Canvas 绘制的
2 participants