-
Notifications
You must be signed in to change notification settings - Fork 94
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
Version 4 feedback and issues #259
Comments
Hi great work with the rewrite! I was wondering with the new version 4 how one would go about having the ability to expose the export chart capabilities? The way I've previously done it is via declaring the HighchartsChartContext.Consumer and extracting the chart object from there. The reason I'm doing this is I don't want the out of the box export burger button and I want to trigger the export capabilities in my own custom button. Thanks! |
You can access the chart object with useChart hook: const ChartExporter = () => {
const chart = useChart();
// do things with chart
return null;
}
<HighchartsChart>
<ChartExporter />
</HighchartsChart> |
thanks @anajavi , that worked like a charm!
and then whenever i need or want to export the chart I can just do this
|
Might be nice to provide chartRef with ref too, like this (doesn't work currently): const chartRef = useRef();
<Chart ref={chartRef} /> Shouldn't be too hard to implement. https://reactjs.org/docs/forwarding-refs.html |
@Praveen8529 I have never done any kind of export, so I might be wrong person to make example :) |
hi @Praveen8529 .. im not too familiar with highstock, but i'm sure you can do something similar to the example provided above. |
Hi @filoromz , Thanks for the info. i had implemented alternative as you suggested :) |
Hi I am new to this world, and was wondering if this re-write means we dont have access to provideChart provideAxis or provideSeries? |
Those can be accessed with the hooks: useChart, useAxis and useSeries. If you still need the HOC's, they can be written with something like this: function provideChart(Component) {
const chart = useChart();
return <Component chart={chart} />
} |
This issue exists to feedback any issues discovered with version 4.
Please note, this rewrite is based on React Hooks, so requires React 16.8.6 and Highcharts 8 as minimum. Please see the release notes for more information on breaking changes.
The text was updated successfully, but these errors were encountered: