Commit 81ecca6b by zhaochengxiang

热力图自适应

parent 13b81426
......@@ -267,7 +267,7 @@ const RelationContainer = (props) => {
(type==='relation') && <Relation data={relationData} expandId={nodeParams?.expandId} resize={resize} onCenterClick={onCenterClick} onExpandClick={onExpandClick} />
}
{
(type==='thermodynamic') && <Thermodynamic data={thermodynamicData} onClick={onThermodynamicClick} />
(type==='thermodynamic') && <Thermodynamic data={thermodynamicData} resize={resize} onClick={onThermodynamicClick} />
}
<Radio.Group value={type} onChange={onTypeChange} buttonStyle="solid" style={{ position: 'absolute', right: 15, top: 20 }}>
{
......
......@@ -7,19 +7,22 @@ class Thermodynamic extends React.Component {
componentDidMount() {
const { data, onClick } = this.props;
if (data) {
init(this)(this.elem, data, onClick);
this.graph = init(this)(this.elem, data, onClick);
}
}
componentDidUpdate(prevProps, prevState) {
const { data, onClick } = this.props;
const { data, onClick, resize } = this.props;
if (data) {
init(this)(this.elem, data, onClick);
if (data !== prevProps.data) {
this.graph = init(this)(this.elem, data, onClick);
} else if (resize !== prevProps.resize) {
this.graph?.resize();
}
}
elem = undefined;
graph = undefined;
render() {
return (
......@@ -126,4 +129,11 @@ const init = (ctx) => function (container, data, onClick) {
onClick && onClick(data.nodeId);
});
if (typeof window !== 'undefined') {
window.onresize = () => {
myChart?.resize();
};
}
return myChart;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment