微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用图表小部件对象资源管理器绘制时间线/时间条解决方法

如何解决如何使用图表小部件对象资源管理器绘制时间线/时间条解决方法

OE 中的图表小部件可用于显示链接对象类型的属性随时间变化的计数。

由于您目前使用标准的点击配置可能会遇到错误,我在这里分享一个解决方法

解决方法

OE 中的图表小部件可用于显示链接对象类型的属性随时间变化的计数。

由于您目前使用标准的点击配置可能会遇到错误,我在这里分享一个解决方法。

在此示例中,我想显示每天(日期Flight 对象类型的属性)。

  1. 使用通常的图表点击配置,选择对象关系(这里从机场到航班)并在字符串属性上设置聚合,即不是在您真正感兴趣的日期或时间戳属性上在此示例中,我首先按承运人名称而不是按日期设置航班 ID 的计数(尽管我实际上对按日期计数感兴趣)。

  2. 将图表更改为“垂直”(默认为“水平”)。

  3. 进入小部件的 YML 表示并将图表更改为按“值”下的日期或时间戳属性分组。您需要在此处传入属性 ID,而不是属性的显示名称。

  4. 还要更改“dimensionsConfig”和“categoryAxis”下的参数,以对应日期/时间戳属性上的聚合预期的参数。请参阅我共享的示例代码。确保您进入 YML 编辑器未标记任何问题的状态。

  5. 图表在编辑和预览模式下仍会显示错误,但如果您发布更改,它会如您所愿显示时间线或条形图。

  6. 您可以在闲暇时进一步微调 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

outcome chart

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。