highcharts / highcharts-vue

Other
686 stars 150 forks source link

SSR Friendly #224

Closed ObjectAssign closed 1 year ago

ObjectAssign commented 1 year ago

Hi this does not work well with Inertia/SSR as it uses the window object.

Would be nice with an overhaul to support SSR + Composition API

Denyllon commented 1 year ago

Hello @ObjectAssign

We're aware that package has some problems with SRR, but as I mentioned in your another issue, we are planning to improve this wrapper for getting better type definitions, composition API, as well as the SRR support. In a meanwhile, you can temporarily try to use the workarounds described here.

Kind regards!

jszuminski commented 1 year ago

The highcharts-vue package works with Nuxt. Similarly to highcharts-react with Next (https://github.com/highcharts/highcharts-react#highcharts-with-nextjs), you need to check whether the code is executed on the server or on the client side.

When it's being executed on the server, you will not be able to access Highcharts as it's a purely client-side library. highcharts-vue is enabling you to use Highcharts easily within Vue components, but it does not extend any Highcharts Core logic.

If you wish to "export your charts" you can check out our Export Server solution: https://github.com/highcharts/node-export-server which in response to an HTTP request will return an image of a chart created with your chart's config.