简体   繁体   English

是否可以在 Palantir-Foundry 的 Slate 中定义另一个车把内的车把?

[英]Is it possible to define a handlebars inside another handlebars in Slate within Palantir-Foundry?

I want to draw a chart in foundry slate.我想在铸造石板上画一张图表。 I want to define x axis and y axis as follows:我想定义x轴和y轴如下:

X = "{{fchart.{{w_widget.selectedValue}}}}"

Y = "{{fchart.summation}}" 

I need to dynamically get the value of w_widget.selectedValue by defining it within another handlebars.我需要通过在另一个把手中定义它来动态获取 w_widget.selectedValue 的值。

But this is throwing error?但这是抛出错误?

You cannot nest handlebars.您不能嵌套车把。 Given the limited information you are giving, I'm going to have to do some assumptions here.鉴于您提供的信息有限,我将不得不在这里做一些假设。 It seems to be trying to dynamically choose field that contains the X axis within an object containing data for your chart?似乎正在尝试动态选择包含图表数据的 object 中包含 X 轴的字段?

Try to place this inside a slate function and do:尝试将它放在一个石板 function 中并执行以下操作:

x = {{fchart}}["{{w_widget.selectedValue}}"]

What is happening here is that first you pull out the object, returned in your fchart function.这里发生的情况是,首先您拉出 object,在您的fchart function 中返回。 Then you use the string inside the widget to access the content.然后使用小部件内的字符串来访问内容。 Which should be the same as doing:这应该与这样做相同:

let chart_obj = {{fchart}};
let property_name = {{w_widget.selectedValue}};

let x = chart_obj[property_name]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM