swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.29k stars 1.15k forks source link

Unable to import roundedRect from shape helper with v13 #1403

Open kevinmanncito opened 4 years ago

kevinmanncito commented 4 years ago

Describe the bug

This is probably not a bug for everyone but it is a bug in our codebase. Previously with version 12.x you could import roundedRect like this:

import { roundedRect } from '@swimlane/ngx-charts/release/common/shape.helper';

Now with version 13.x it appears roundedRect has been removed from the public api. Would there be an issue with allowing roundedRect to be imported in version 13.x?

To Reproduce

Try to import and use roundedRect

Expected behavior

Being able to import roundedRect like this:

import { roundedRect } from '@swimlane/ngx-charts

Demo

Here is a stackblitz that shows that the import doesn't work anymore:

13.x https://stackblitz.com/edit/angular-6bpguq

If you switch versions back to 12.x in the stackblitz you can see that the import does work. Here is another stackblitz showing that:

12.x https://stackblitz.com/edit/angular-3auhr4

ngx-charts version

13.02

Additional context

We've upgraded our app to angular9/ivy so we are just going through third party libraries now trying to get everything else up to date as well. I can think of a few workarounds that we can do on our end to get this working but if you guys don't see an issue with allowing the shape helper functions to be part of the public api that would make our lives easier. I believe it would be as simple as adding this to the public api file:

export * from './lib/common/shape.helper';

I'm happy to test and make a PR if you think this change would be okay. Thanks!

thanhxtruong commented 4 years ago

@kevinmanncito: I'm having the same issue trying to create a custom horizontal bar chart. My workaround is to manipulate it using CSS outside of the custom component instead. Is that what you're doing as well?

kevinmanncito commented 4 years ago

I just copied the contents of the shape helper file into our project 🤷‍♂️

RazielH commented 3 years ago

Just for those that end up here and have the same issue.

Seems like the one helper file is missing from the commons/index.js export list as @kevinmanncito mentioned. You can also get at the file directly if you have the correct JS file path without needing to copy the content.

This worked for us: import { roundedRect } from '@swimlane/ngx-charts/esm5/lib/common/shape.helper';