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

Global config seems to be ignored #482

Open
MichalBryxi opened this issue Sep 4, 2024 · 2 comments
Open

Global config seems to be ignored #482

MichalBryxi opened this issue Sep 4, 2024 · 2 comments

Comments

@MichalBryxi
Copy link
Contributor

MichalBryxi commented Sep 4, 2024

This issue relates to my confusion in this issue, but the problem remains unresolved: No matter what I do I can't set global config for highcharts.

I created a file:

// app/highcharts-configs/application.js

export default function (defaultOptions) {
  defaultOptions.credits.href = null;
  defaultOptions.credits.text = null;
  defaultOptions.credits.enabled = false;

  return defaultOptions;
}

I can see that it's loaded:

Screenshot 2024-09-04 at 11 11 22

But the Highchart(stock) does not honour credits.enabled = false (see the highcharts link in bottom right):

Screenshot 2024-09-04 at 11 11 33

If I just pass

    credits: {
      enabled: false,
    },

To the option of given chart, it works ok. Just not globally.

Maybe this stems from the addon calling Highcharts.setOptions() which might work only for HighCharts, but does not for HighStock?

@RobbieTheWagner
Copy link
Collaborator

I think global config is tricky now that we are dynamically importing only the pieces you need. It means we don't have one giant global Highcharts to set options on and even when we do, it might point to a different type.

@MichalBryxi
Copy link
Contributor Author

MichalBryxi commented Oct 4, 2024

If we'd go in non-breaking way, I would guess that just taking the app/highcharts-configs/application.js and shoving it into any highcharts instance we want to make should do the trick? At least highcharts and highstocks pride themselves to be compatible, so should mostly work and it's what the people used till now?

  1. But yeah to honour the fact that we have now N possible global configs (per chart type) we should do something like:
// app/highcharts-configs/application.js

export default function (defaultOptions) {
  defaultOptions['StockChart'].credits.href = null;
  defaultOptions['StockChart'].credits.text = null;
  defaultOptions['StockChart'].credits.enabled = false;

  return defaultOptions;
}
  1. This could also have a global option defaultOptions['global'].foo as AFAIK many configuration options are globally available across all types of highcharts.

  2. Tangential, but when we're here: Could we / should we move the config from app/highcharts-configs/application.js to something like config/ember-highcharts.js?

    • Random folder and file in /app just feels weird
    • highcharts-configs does not say which addon consumes said config. There could be other addon that does highcharts and it would be hard to tell.
    • It streamlines the way other addons do it (ember-intl for example).

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

No branches or pull requests

2 participants