Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript resize事件处理程序上的Responsive heatmap.js_Javascript_Html_Reactjs_Heatmap - Fatal编程技术网

Javascript resize事件处理程序上的Responsive heatmap.js

Javascript resize事件处理程序上的Responsive heatmap.js,javascript,html,reactjs,heatmap,Javascript,Html,Reactjs,Heatmap,首先,我使用的是ReactJS和heatmap.js库 用作heatmap.js入口点的HtmlLevel应该是响应的。每次调整窗口大小时,它都会根据当前窗口大小进行调整 但是,由heatmap.js库对象创建的画布采用div的初始尺寸,因此其大小保持不变 我怎样才能让孩子们也有反应? heatmap.jsconfigJSON如下所示: this.heatmap = Heatmap.create({ container: this.image }); 变量this.image是对动态给定宽

首先,我使用的是ReactJS和heatmap.js库

用作heatmap.js入口点的HtmlLevel应该是响应的。每次调整窗口大小时,它都会根据当前窗口大小进行调整

但是,由heatmap.js库对象创建的画布采用div的初始尺寸,因此其大小保持不变

我怎样才能让孩子们也有反应?

heatmap.jsconfigJSON如下所示:

this.heatmap = Heatmap.create({
  container: this.image
});
变量
this.image
是对动态给定宽度和高度属性的htmldevelment的引用

<div  style={{ width: `${width}px`, height:`${height}px`}} />


*如果您不熟悉JSX语法,我可以将其转换为纯HTML/CSS/JS。

一个解决方案是将画布设置为100%的高度和宽度,但包含在一个响应的

中,通过CSS选择器,动态创建的画布可以成功地设置样式。