[英]Data view mapping in Power BI visuals
Good day再会
I am creating custom visualization on d3js and pbiviz for powerbi我正在为 powerbi 在 d3js 和 pbiviz 上创建自定义可视化
Here is the code in capabilities.js:这是capabilities.js中的代码:
{
"dataRoles":[
{
"displayName": "HoleDepth",
"name": "depth",
"kind": "Grouping"
},
{
"displayName": "Days",
"name": "days",
"kind": "Measure"
},
{
"displayName": "Diametrs",
"name": "diametrs",
"kind": "Measure"
},
{
"displayName": "Sensor1",
"name": "sensor_1",
"kind": "Measure"
},
{
"displayName": "Sensor2",
"name": "sensor_2",
"kind": "Measure"
},
{
"displayName": "Sensor3",
"name": "sensor_3",
"kind": "Measure"
},
{
"displayName": "Sensor4",
"name": "sensor_4",
"kind": "Measure"
}
],
"dataViewMappings": [
{
"categorical": {
"categories": {
"for": { "in": "depth" }
},
"values": {
"select":[
{ "bind": { "to": "days" } },
{ "bind": { "to": "diametrs" } },
{ "bind": { "to": "sensor_1" } },
{ "bind": { "to": "sensor_2" } },
{ "bind": { "to": "sensor_3" } },
{ "bind": { "to": "sensor_4" } }
]
}
}
}
]
} }
But in visualization it is inconvenient to use categorical -> values array但是在可视化中使用分类 -> 值数组是不方便的
Is it possible to categorical -> values was like an object with keys?是否可以分类-> 值就像带有键的 object?
I do not think that this is possible directly through data mapping.我认为这不可能直接通过数据映射实现。 What I usually do if I want to have data prepared in the specific format, convenient for visualization with d3.js, is the custom function that transforms the data from
VisualUpdateOptions
.如果我想以特定格式准备数据,以便使用 d3.js 进行可视化,我通常会做的是自定义 function 转换来自
VisualUpdateOptions
的数据。 Then I call this function inside public update(options: VisualUpdateOptions)
然后我在
public update(options: VisualUpdateOptions)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.