问题描述
OE 中的图表小部件可用于显示链接对象类型的属性随时间变化的计数。
由于您目前使用标准的点击配置可能会遇到错误,我在这里分享一个解决方法。
解决方法
OE 中的图表小部件可用于显示链接对象类型的属性随时间变化的计数。
由于您目前使用标准的点击配置可能会遇到错误,我在这里分享一个解决方法。
在此示例中,我想显示每天(日期Flight 对象类型的属性)。
-
使用通常的图表点击配置,选择对象关系(这里从机场到航班)并在字符串属性上设置聚合,即不是在您真正感兴趣的日期或时间戳属性上在此示例中,我首先按承运人名称而不是按日期设置航班 ID 的计数(尽管我实际上对按日期计数感兴趣)。
-
将图表更改为“垂直”(默认为“水平”)。
-
进入小部件的 YML 表示并将图表更改为按“值”下的日期或时间戳属性分组。您需要在此处传入属性 ID,而不是属性的显示名称。
-
还要更改“dimensionsConfig”和“categoryAxis”下的参数,以对应日期/时间戳属性上的聚合预期的参数。请参阅我共享的示例代码。确保您进入 YML 编辑器未标记任何问题的状态。
-
图表在编辑和预览模式下仍会显示错误,但如果您发布更改,它会如您所愿显示时间线或条形图。
-
您可以在闲暇时进一步微调 YML 中的轴标签等内容。
初始 YML:(按步骤 1-2 按字符串属性分组后)
config:
title: Chart
icon: chart
chartConfig:
type: bar
chartObjectsConfig:
linkTypeId:
linkTypeId: flight-origin-airport-link
linkDirection: forward
shouldConsumeFilters: true
dimensionsConfig:
category:
type: __hubble_data_charts_group_by_dimension_v2
dimension:
type: forbid
settingValue:
aggregation:
type: exact
sort:
type: bucketName
order: asc
resultLimit: 15
explicitOrdering: []
propertyId: carrier_name
value:
type: __hubble_data_charts_multi_metric_dimension_v1
dimension:
type: forbid
settingValue:
- propertyId: flight_id
aggregationFunction: value_count
visualChartConfig:
orientation: vertical
grouping: stacked
legend:
visible: true
position: bottom
inset: false
colors:
- {}
drawLabels: false
categoryAxis:
crosshair: false
label: Category Axis
showGridlines: false
showToolbar: false
format:
type: string
valueAxis:
type: linear
crosshair: false
domainStart: auto
domainEnd: auto
label: Value Axis
showGridlines: false
showToolbar: false
tickFormat: .2f
relativeBars: false
renderAsPercents: []
layout: both
sizing:
minHeight: 300
maxHeight: 3000
最终的 YML(按步骤 2-4 按日期属性分组)
config:
title: Chart
icon: chart
chartConfig:
type: bar
chartObjectsConfig:
linkTypeId:
linkTypeId: flight-origin-airport-link
linkDirection: forward
shouldConsumeFilters: true
dimensionsConfig:
category:
type: __hubble_data_charts_group_by_dimension_v2
dimension:
type: forbid
settingValue:
aggregation:
type: date
dateInterval: day
propertyId: new-property3
value:
type: __hubble_data_charts_multi_metric_dimension_v1
dimension:
type: forbid
settingValue:
- propertyId: flight_id
aggregationFunction: value_count
visualChartConfig:
orientation: vertical
grouping: stacked
legend:
visible: true
position: bottom
inset: false
colors:
- {}
drawLabels: false
categoryAxis:
crosshair: false
label: Category Axis
showGridlines: false
showToolbar: false
format:
type: date
tiers: double
valueAxis:
type: linear
crosshair: false
domainStart: auto
domainEnd: auto
label: Value Axis
showGridlines: false
showToolbar: false
tickFormat: .2f
relativeBars: false
renderAsPercents: []
layout: both
sizing:
minHeight: 300
maxHeight: 3000