-
Notifications
You must be signed in to change notification settings - Fork 108
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
Adding button functionality in title #236
Comments
Hi @GeorgeCodeHub, Thank you for contacting us! In the below script the
Please check the possible solution with portals: https://github.com/highcharts/highcharts-react#how-to-add-react-component-to-a-charts-element Best regards! |
Hello there, That solution is very close to what I am trying to do. However, I'm not sure which value should I replace for the title. When I try to console.log(chart.title) I get the following.
I tried replacing the element value but I saw no changes. Should I try and replace more than one item to see the preferable result? For instance the cTT and the textStr? Thank you for your time. |
Hi @GeorgeCodeHub, You need to enable the
Live demo: https://codesandbox.io/s/highcharts-react-demo-v22pd?file=/demo.jsx |
That did the trick. Thank you so much and thank you for creating an example!!! |
@GeorgeCodeHub , can we put component into the title? |
Hi @devdreamsolution, Yes, it is possible by using portals. Please check this thread: #23 and docs: https://github.com/highcharts/highcharts-react#how-to-add-react-component-to-a-charts-element |
@ppotaczek , the title doesn't have formatter. |
@devdreamsolution, It doesn't matter, the general concept is the same - you just need to use portals to place some React component in a HTML element created by Highcharts chart. Live demo: https://codesandbox.io/s/highcharts-react-demo-dndwnu?file=/label.jsx |
@ppotaczek , great works, |
I'm trying to use Highcharts in a React project were I have the need to have buttons inside my chart in very specific locations. One is in the title and the other will be in the pop-ups. For some reason, however, I am unable to call the function outside. Should I put it in a parent component or is there any other method to pass it in Highcharts?
Below is the code of an example I have created and a Stackblitz link:
Link for example: https://stackblitz.com/edit/text-in-object
The text was updated successfully, but these errors were encountered: