Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Breaking Change (5.0.0-beta.10) #4657

Closed
pearmini opened this issue Feb 15, 2023 · 5 comments
Closed

Breaking Change (5.0.0-beta.10) #4657

pearmini opened this issue Feb 15, 2023 · 5 comments

Comments

@pearmini
Copy link
Member

Breaking Change (5.0.0-beta.10)

There are some breaking changes for 5.0.0-beta.10.

node.interaction

Change Interaction from array prop to object prop.(#4628)

// Before
chart.interaction({ type: 'tooltip', series: true });

// After
chart.interaction('tooltip', { series: true });

node.coordinate

Change coordinate from array prop to object prop. (#4637)

// Before
chart.coordinate({ type: 'polar' }).coordinate({ type: 'transpose' });

// After
chart.coordinate({ type: 'polar', transform: [{ type: 'transpose' }] });

node.state

Specify the state of elements by mark.state API rather than in the chart.interaction.(#4649)

// Before
chart.interaction({ type: 'elementHighlight', highlightedFill: 'red' });

// After
chart.interval().state('active', { fill: 'red' }).interaction('elementHighlight', true);

mark.label.style

Specify style props supported by G element through label.style.(#4639)

// Before
chart.interval().data(data).label({
  text: 'hello',
  formatter: '~s',
  fill: 'red',
  stroke: 'blue',
});

// After
chart
  .interval()
  .data(data)
  .label({
    text: 'hello',
    formatter: '~s',
    style: {
      // Style props supported by G.
      fill: 'red',
      stroke: 'blue',
    },
  });
@pearmini pearmini pinned this issue Feb 15, 2023
@hustcc
Copy link
Member

hustcc commented Feb 15, 2023

放到 release 的描述中吧。

@pearmini
Copy link
Member Author

放到 release 的描述中吧。

嗯嗯,我在 release 里面引用了这个 issue 的。

@clmz
Copy link

clmz commented Mar 2, 2023

what happened to functions like getEngine, registerInteraction etc?
I wanna upgrade from v4.1.32 to v5 beta12, but all these functions are gone and I can't find any info to this.

@pearmini
Copy link
Member Author

pearmini commented Mar 3, 2023

  • getEngine currently changes to chart.getContext().canvas, and the returned canvas is an instance of G Canvas.
  • register* APIs are in the experimental stage and are not recommended to use. The related abilities for customizing will be ready in 5.1.0, released at the end of April. If you want to customize interaction, you can add event listeners as follows for a temporal solution.
const chart = new Chart();

// ....

const { canvas } = chart.getContext().canvas;
const elements = canvas.document.getElementsByClassName('element');
elements[0].addEventListener('click', () => {});

So for 4.0 users, the best time to upgrade is after releasing 5.1.0. Sorry for the inconvenience caused to you, we'll provide detailed upgrade docs and optimize API docs as soon as possible.

@clmz
Copy link

clmz commented Mar 9, 2023

@pearmini
Thank you! Is there already a forecast when this will happen?

@hustcc hustcc unpinned this issue May 5, 2023
@antvis antvis locked and limited conversation to collaborators May 10, 2023
@hustcc hustcc converted this issue into discussion #4972 May 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants