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

Remove use of global ApexCharts class #4884

Conversation

SmithKy3
Copy link
Contributor

@SmithKy3 SmithKy3 commented Dec 19, 2024

New Pull Request

The setupBrushHandler method of the Core class relies on the ApexCharts class' static getChartByID method. It calls this static method on the ApexCharts class directly without importing it currently.

This is fine if consuming apexcharts via
CDN / script tag as that places the exported ApexCharts class in the global scope, but it becomes an issue when users want to consume apexcharts via a package manager.

Update the setupBrushHandler method to call ApexCharts.getChartByID the Core class' ctx field instead.

Fixes apexcharts/react-apexcharts#666

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    • e2e tests passed locally
    • I haven't been able to verify that the unit test suite passes because they seem to be broken. I get the getBBox is not a function error when I run them, which I can see has been occurring in your Node.js CI action. I'm not sure if that's related to the browser API or one of your internal utils but let me know if you want me to rebase / merge changes in once that's fixed and run the unit tests.
  • My branch is up to date with any changes from the main branch

The `setupBrushHandler` method of the `Core` class relies on the
`ApexCharts` class' static `getChartByID` method. It calls this
static method on the `ApexCharts` class directly without
importing it currently.

This is fine if consuming `apexcharts` via
CDN / script tag as that places the exported `ApexCharts` class in
the global scope, but it becomes an issue when users want to
consume `apexcharts` via a package manager.

Update the `setupBrushHandler` method to call `ApexCharts.getChartByID`
the `Core` class' `ctx` field instead.
@junedchhipa junedchhipa merged commit 641fd9d into apexcharts:main Dec 19, 2024
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.

ReferenceError: ApexCharts is not defined
2 participants