-
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
A question about Reflow() #43
Comments
Hi, thanks! Glad you're happy with the library. Interesting, I should add proper support for reflow. In the meantime I would suggest creating a custom component with the import React, { Component } from 'react';
import Highcharts from 'highcharts';
import { Hidden, provideChart } from 'react-jsx-highcharts';
class Reflow extends Component {
componentDidMount () {
const chart = this.props.getChart();
Highcharts.addEvent(chart, 'load', chart.reflow);
}
render () {
return (
<Hidden />
);
}
}
export default provideChart(Reflow); Then insert that Reflow component as a child of your I can't check for certain if my example above works, as I'm on holiday at the moment, so don't have my laptop (only have my phone). Let me know how you get on. |
Okey that is interesting. I will do a test and let you know what I find out! |
Just an update on the Reflow component. Just for fun and if someone else has this problem. handleSelect(key) {
this.setState({ key });
}
<Tabs activeKey={this.state.key} onSelect={this.handleSelect} id="counterInfo" >
...
<Tab eventKey={4} title="Spread">
{this.state.key===4 ? (
<LineChart
title={data.tank}
dataPoints={data.levelChart}
plotLines={data.multie}
reggressionLines={data.endPointRegression}
/>
) : ( <div>No data</div> ) }
</Tab> Everything is working fine now so I'm going to abandon the .reflow :) |
Hi @Roberthaf I've pushed some changes (not yet released) that allow for reflow by providing a function to a new The idea is that the function you pass to the callback prop, will be called with the Highcharts chart object when the chart is created. That way you can call reflow on demand. It's not very "Reacty" but it seems to be the simplest implementation. What are your thoughts? |
I had to publish in the end, to fix a different issue. Reflow support is included in 2.0.3. Still be interested in hearing your thoughts though. |
Hi, Very nice work! |
Great stuff! Thanks! |
@whawker reflow example is great. Will this library work with typescript. on parent div resize. Thank you. |
I have never used Typescript, so couldn't say if it works or not. I don't plan on adding any Typescript support at this time, would welcome a pull request though! |
Hello there @whawker! Sorry to wake this thread from its deepest sleep, but searching for reflow dropped me here =D May you update this example so it may work with functional components? I kind of managed a workaround, but I am not sure this is the proper way. Typescript:
|
Hey!
First of, awesome work I really enjoy using your library its been working like a charm!
I am a rather new react user and I wanted to ask how you would handle using highcharts .reflow().
I have a highchart that is hidden under a tab with Display: none.
And when its initially rendered it has no height and width properties, so the chart will get some default value w:777 h:400 f.x.
So I would need to trigger a reflow() after the chart has been renderd. resizing the
page also works to solve this.
I was wondering if you could give some advice how to do that or if there is a super easy way i'm missing?
Thanks in advance and good work!
Just for clarity here is what my container is doing. I'm just passing some props to my highchart component.
And my stateless component is just a basic setup
The text was updated successfully, but these errors were encountered: