Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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
D3.js Meteor渲染-访问集合值_D3.js_Meteor - Fatal编程技术网

D3.js Meteor渲染-访问集合值

D3.js Meteor渲染-访问集合值,d3.js,meteor,D3.js,Meteor,我希望使用template.xxx.rendered插入带有svg的d3.js DOM元素 .attr(“高度”,此.mysize)。但是,this.mysize不起作用,因为template.xxx.rendered不是模板帮助程序,“this”不会返回当前文档。如何访问template.xxx.helper的“this” 我猜这是来自iron router数据的订阅,然后您必须在渲染中重做查询。根本不延迟,因为这是一个本地minimongo查询:)不要尝试在呈现中访问集合,而是使用一个返回该

我希望使用template.xxx.rendered插入带有svg的d3.js DOM元素
.attr(“高度”,此.mysize)。但是,this.mysize不起作用,因为template.xxx.rendered不是模板帮助程序,“this”不会返回当前文档。如何访问template.xxx.helper的“this”

我猜这是来自iron router数据的订阅,然后您必须在渲染中重做查询。根本不延迟,因为这是一个本地minimongo查询:)

不要尝试在呈现中访问集合,而是使用一个返回该集合的帮助函数(或者交替使用iron router数据上下文),然后在模板中,可以执行类似的操作

<template name="yourtemplate">
  {{#with this.mysize}}
      <svg style="height: {{this}}>
        <path ...../>
      </svg
  {{/with}}
</template>

{{{用这个.mysize}

请举例说明你迄今为止所做的尝试。