LookML 資訊主頁的瀑布圖參數

本頁說明如何在 dashboard.lkml 檔案中,使用 LookML 資訊主頁參數新增及自訂 type: looker_waterfall 的 LookML 資訊主頁元素。

如要瞭解如何透過 Looker UI 建立瀑布圖,請參閱「瀑布圖選項」說明文件頁面。

應用實例

N 表示必須提供數值。單引號表示描述文字,不應包含在即時程式碼中。


## BASIC PARAMETERS
name: element_name
title: 'Element Title'
type: looker_waterfall
height: N
width: N
top: N
left: N
row: N
col: N
refresh: N (seconds | minutes | hours | days)
note_state: collapsed | expanded
note_display: above | below | hover
note_text: 'note text'

## QUERY PARAMETERS
model: model_name
explore: explore_name
fields: [view_name.field_name, view_name.field_name, …]
dimensions: [view_name.field_name, view_name.field_name, …]
measures: [view_name.field_name, view_name.field_name, …]
sorts: [view_name.field_name asc | desc, view_name.field_name, …]
fill_fields: [view_name.field_name, view_name.field_name, …]
limit: N
column_limit: N
filters:
  view_name.field_name: 'Looker filter expression' | 'filter value'
filter_expression:  'Looker custom filter expression'
listen:
  dashboard_filter_name: view_name.field_name
hidden_fields: [view_name.field_name, view_name.field_name, …]
query_timezone: 'specific timezone' | user_timezone
merged_queries:
- 'primary query definition'
- 'next source query definition'
  join_fields:
  - field_name: view_name.field_name
    source_field_name: view_name.field_name

## SERIES PARAMETERS
up_color: "hex string" | 'CSS named color string'
down_color: "hex string" | 'CSS named color string'
total_color: "hex string" | 'CSS named color string'
color_application:
  collection_id: 'collection ID'
  palette_id: 'palette ID'
  options:
    reverse: true | false

## VALUE PARAMETERS
show_value_labels: true | false
label_color: ['color value']

## X-AXIS PARAMETERS
x_axis_scale: auto | ordinal | time
show_x_axis_label: true | false
show_x_axis_ticks: true | false
x_axis_zoom: true | false

## Y-AXIS PARAMETERS
show_y_axis_labels: true | false
show_y_axis_ticks: true | false
y_axis_gridlines: true | false
y_axis_zoom: true | false

## ADVANCED VISUALIZATION CONFIGURATION PARAMETERS
advanced_vis_config: 'Highcharts JSON snippet'

參數定義

參數名稱 說明
基本參數
name (適用於元素) 建立元素
title (適用於元素) 變更元素名稱向使用者顯示的方式
type (適用於元素) 決定要在元素中使用的圖表類型
height (適用於元素) 定義 layout: tile 和 layout: static 資訊主頁中元素的高度 (以 tile_size 為單位)
width (適用於元素) 定義 tile_size 單位中 layout: tile 和 layout: static 資訊主頁的元素寬度
top 定義 layout: static 資訊主頁中,元素從上到下的位置 (以 tile_size 為單位)
left 定義元素在 layout: static 資訊主頁中的左右位置,單位為 tile_size
row 定義 layout: newspaper 資訊主頁中元素的上下位置 (以列為單位)
col 定義 layout: newspaper 資訊主頁中元素的左右位置 (以欄為單位)
refresh (適用於元素) 設定元素自動重新整理的間隔時間
note_state 定義附註是否會摺疊或展開 (如果附註過大,無法放入元素寬度內的單一資料列)
note_display 定義附註在元素上的顯示位置
note_text 指定記事中顯示的文字
查詢參數
model 定義用於元素查詢的模型
explore (適用於元素) 定義用於元素查詢的「探索」
fields 定義要用於元素查詢的欄位。這項功能可取代 dimensions 和 measures。
dimensions 定義要用於元素查詢的維度
measures 定義要用於元素查詢的指標
sorts 定義要用於元素查詢的排序
fill_fields 定義使用「維度填滿」選項的維度
limit 定義元素查詢使用的資料列上限
filters (適用於元素) 定義元素查詢無法變更的篩選器
filter_expression 定義自訂篩選器,該篩選器無法變更元素查詢
listen 定義元素查詢可變更的篩選器 (如果已建立 filters (適用於資訊主頁))
hidden_fields 指定要在查詢中使用但隱藏在圖表中的任何欄位
query_timezone 定義查詢執行時應使用的時區
merged_queries 定義合併結果查詢
系列參數
up_color 設定圖表中正值長條的顏色
down_color 設定圖表中負值的長條顏色
total_color 設定圖表中總計值長條的顏色
color_application 將顏色集合和調色盤套用至圖表
值參數
show_value_labels 顯示每個資料長條的標籤
label_color 指定標籤的顏色值
X 軸參數
x_axis_scale 指定如何計算 x 軸比例
show_x_axis_label 顯示或隱藏 X 軸標籤
show_x_axis_ticks 顯示 X 軸上的值
x_axis_zoom 指定是否允許沿著 x 軸縮放
Y 軸參數
show_y_axis_labels 顯示或隱藏 Y 軸標籤
show_y_axis_ticks 顯示 Y 軸上的值
y_axis_gridlines 從 Y 軸延伸格線
y_axis_zoom 指定是否允許沿著 Y 軸縮放。如果 x_axis_zoom: false,則會停用。
進階視覺化設定參數
advanced_viz_config 接受可覆寫多項視覺化設定的 HighCharts JSON 片段

基本參數

定義 LookML 資訊主頁元素時,至少須為 name 和 type 基本參數指定值。其他基本參數 (例如 title、height 和 width) 會影響資訊主頁中元素的顯示方式和位置。

name

本節是指屬於資訊主頁元素的 name 參數。

name 也可做為資訊主頁篩選器的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

每個 name 宣告都會建立新的資訊主頁元素,並指派名稱。元素名稱不得重複。使用 layout: grid 資訊主頁時,有時會參照 elements 參數中的名稱。

- name: orders_by_date

title

本節是指屬於資訊主頁元素的 title 參數。

title 也可做為資訊主頁的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

title 也可做為資訊主頁篩選器的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

title 參數可讓您變更元素名稱向使用者顯示的方式。如未指定,標題預設為元素 name。

請參閱以下範例:

- name: sales_overview
  title: '1) Sales Overview'

如果您使用這種格式,元素會顯示為「1) 銷售總覽」,而不是「銷售總覽」。

type

本節是指屬於資訊主頁元素的 type 參數。

type 也可做為資訊主頁篩選器的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

type 也可做為聯結的一部分,詳情請參閱 type (適用於聯結) 參數說明文件頁面。

type 也可以做為維度的一部分,詳情請參閱「維度、篩選器和參數類型」說明文件頁面。

type 也可以做為測量指標的一部分,詳情請參閱「測量指標類型」說明文件頁面。

type 參數會決定元素中使用的圖表類型。

- name: element_name
  type: text | looker_grid | table | single_value | looker_single_record |
        looker_column | looker_bar | looker_scatter | looker_line | looker_area |
        looker_pie | looker_donut_multiples | looker_funnel | looker_timeline |
        looker_map | looker_google_map | looker_geo_coordinates | looker_geo_choropleth | looker_waterfall | looker_wordcloud | looker_boxplot

如要瞭解不同類型的 LookML 資訊主頁元素,請參閱 type (適用於 LookML 資訊主頁) 說明文件頁面。

height

本節是指屬於資訊主頁元素的 height 參數。

height 也可做為資訊主頁列的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

適用於 tile 或 static 版面配置的資訊主頁

height 參數會以 tile_size 為單位 (以像素為單位),定義 layout: tile 和 layout: static 資訊主頁的元素高度。

舉例來說,下列程式碼會指定 tile_size: 100 和 height: 4,使 orders_by_date 元素的高度為 400 像素。

- dashboard: sales_overview
  tile_size: 100
  ...

  elements:
  - name: orders_by_date
    height: 4
    ...

適用於採用「newspaper」版面配置的資訊主頁

height 參數會以「列」為單位,定義layout: newspaper 資訊主頁的元素高度。

報紙版面配置資訊主頁的預設元素高度為 6 列,約 300 像素。如果將 preferred viewer 參數設為 dashboards-next,資訊主頁的最低高度為 1 個資料列。如果資訊主頁的 preferred viewer 參數設為 dashboards,則高度下限為 2 列。

舉例來說,以下程式碼會將元素設為 12 列高,或是設為預設值的其他元素高度的兩倍:

- dashboard: sales_overview
  layout: newspaper
  ...

  elements:
  - name: orders_by_date
    height: 12
    ...

width

本節是指屬於資訊主頁元素的 width 參數。

width 也可做為資訊主頁的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

width 參數會以 tile_size 為單位,定義 layout: tile 和 layout: static 資訊主頁中元素的寬度。

舉例來說,下列程式碼會指定 tile_size: 100 和 width: 4,使 orders_by_date 元素的寬度為 400 像素。

- dashboard: sales_overview
  tile_size: 100
  ...

  elements:
  - name: orders_by_date
    width: 4
    ...

width 參數會以欄為單位,定義 layout: newspaper 資訊主頁中元素的寬度。

採用報紙版面配置的資訊主頁預設寬度為 24 欄。

舉例來說,下列程式碼會將元素設為資訊主頁寬度的一半:

- dashboard: sales_overview
  layout: newspaper
  ...

  elements:
  - name: orders_by_date
    width: 12
    ...

top

top 參數會以 tile_size 為單位,定義 layout: static 資訊主頁中元素的上下位置。

舉例來說,下列程式碼會指定 tile_size: 100 和 top: 4,將 orders_by_date 元素的頂端邊緣置於距離資訊主頁頂端 400 像素的位置。

- dashboard: sales_overview
  tile_size: 100
  ...

  elements:
  - name: orders_by_date
    top: 4
    ...

left

left 參數會以 layout: static 資訊主頁的 tile_size 為單位,定義元素的左右位置。

舉例來說,下列程式碼會指定 tile_size: 100 和 left: 4,將 orders_by_date 元素的左側邊緣從資訊主頁左側算起,放置在 400 像素的位置。

- dashboard: sales_overview
  tile_size: 100
  ...

  elements:
  - name: orders_by_date
    left: 4
    ...

row

如果是 layout: newspaper 資訊主頁,row 參數會定義元素頂端邊緣所在的列。

資訊主頁的頂端是第 0 列。採用報紙版面配置的資訊主頁預設元素高度為 6 列,也就是說,資訊主頁頂端的資訊主頁元素 (row: 0) 預設會佔用第 0 到 5 列。

每列高度為 50 像素,因此 6 列的預設元素高度為 300 像素。

舉例來說,假設元素的高度設為預設值,以下程式碼會將元素設在資訊主頁的第二列元素上:

- dashboard: sales_overview
  layout: newspaper
  ...

  elements:
  - name: orders_by_date
    row: 6
    ...

col

如果是 layout: newspaper 資訊主頁,col 參數會定義元素左側邊緣所在的資料欄。

資訊主頁會分成 24 欄,資訊主頁會從資訊主頁左側的第 0 欄開始。報紙版面配置的資訊主頁預設元素寬度為 8 欄,也就是說,資訊主頁左側的資訊主頁元素 (col: 0) 預設會佔用第 0 到 7 欄。

舉例來說,下列程式碼會將元素設定在資訊主頁元素中的第三欄:

- dashboard: sales_overview
  layout: newspaper
  ...

  elements:
  - name: orders_by_date
    col: 16
    ...

refresh

本節是指屬於資訊主頁元素的 refresh 參數。

refresh 也可做為資訊主頁的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

refresh 參數可讓元素定期自動重新載入,進而擷取最新資料。如果資訊主頁會持續顯示在辦公室電視等裝置上,這項功能通常很有幫助。請注意,資訊主頁必須在瀏覽器視窗中開啟,這個參數才會生效。這項設定不會在背景執行,以「預先暖機」資訊主頁快取。

重新整理頻率可以是以秒、分、時或天為單位的任何數字 (不含小數)。例如:

- name: orders_by_date
  refresh: 2 hours

設定較短的重新整理間隔時,請務必謹慎。如果元素背後的查詢耗用大量資源,某些元素可能會對資料庫造成超出預期的負擔。

note_state

如果附註內容過長,無法在元素寬度內顯示於單行,note_state 參數會定義附註是否要摺疊或展開。如果選擇 collapsed,但附註過長,附註結尾會顯示可點選的刪節號 (...),點選後即可閱讀完整附註。如果選擇 expanded,且記事內容很長,記事就會換行。

note_display

note_display 參數會定義附註在元素上的顯示位置。above 會將附註放在元素頂端,below 則會放在元素底部,而 hover 則會要求使用者將滑鼠懸停在 ? 圖示上,才能查看附註。

note_text

note_text 參數會指定元素附註中顯示的文字。

查詢參數

定義 LookML 資訊主頁元素時,至少須為 model 和 explore 查詢參數指定值,且至少須使用 dimensions 參數、measures 參數或 fields 參數指定一個欄位。您也可以使用其他查詢參數,控管資料在資訊主頁元素中的顯示方式。

model

model 參數會定義要用於元素查詢的模型。如未指定,預設會使用資訊主頁所在的模型。

- name: orders_by_date
  model: ecommerce

model 參數接受 LookML 常數。您可以在專案的資訊清單檔案中定義常數,然後使用 "@{constant_name}" 語法將常數設為 model 的值。使用常數可在單一位置定義模型名稱,如果您要更新多個資訊主頁元素使用的模型名稱,這項功能就特別實用。

如要進一步瞭解如何搭配使用常數和 LookML 資訊主頁,請參閱 constant 參數說明文件頁面。

explore

本節是指屬於資訊主頁元素的 explore 參數。

explore 也可做為模型的一部分,詳情請參閱 explore 參數說明文件頁面。

explore 也可做為資訊主頁篩選器的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

explore 參數會定義要用於元素查詢的探索。

- name: orders_by_date
  explore: order

explore 參數接受 LookML 常數。您可以在專案的資訊清單檔案中定義常數,然後使用 "@{constant_name}" 語法將常數設為 explore 的值。使用常數可在一個位置定義探索的名稱,如果您要更新多個資訊主頁元素使用的探索名稱,這項功能就特別實用。

如要進一步瞭解如何搭配使用常數和 LookML 資訊主頁,請參閱 constant 參數說明文件頁面。

fields

fields 參數會定義要用於元素查詢的欄位。使用 view_name.dimension_name 語法指定欄位。

## single field example
- name: orders_by_date
  fields: order.order_date

## multiple fields example
- name: orders_by_date
  fields: [order.order_date, order.order_count]

如果您使用 fields 參數,就不需要使用 dimensions 和 measures 參數。

dimensions

dimensions 參數會定義要用於元素查詢的維度。使用 view_name.dimension_name 語法指定維度。如果查詢沒有任何屬性,請勿加入 dimensions。

## single dimension example
- name: orders_by_date
  dimensions: order.order_date

## multiple dimension example
- name: orders_by_date
  dimensions: [order.order_date, customer.name]

measures

measures 參數會定義要用於元素查詢的指標。使用 view_name.measure_name 語法指定指標。如果查詢沒有任何屬性,請勿加入 measures。

## single measure example
- name: orders_by_date
  measures: order.count

## multiple measure example
- name: orders_by_date
  measures: [order.count, order_item.count]

sorts

sorts 參數會定義元素查詢的排序行為。請先列出主要排序欄位,再列出次要排序欄位。使用 view_name.field_name 語法指定要排序的維度或指標。

如果省略 sorts 參數,元素會使用 Looker 的預設排序順序。遞增排序不需要後置字串,遞減排序則需要 desc 後置字串。

以下範例定義單一排序:

- name: orders_by_date
  sorts: order.order_date desc

以下範例定義了多個排序:

- name: orders_by_date
  sorts: [order.order_date desc, customer.name]

如果透視維度,您可以指定指標名稱、排序方向,以及資料表中目標資料欄的從零開始計算的索引編號,藉此排序查詢結果。舉例來說,下列元素會使用索引 0,依據第一個樞紐分析表欄排序:

- name: orders_by_category
  sorts: [orders.count desc 0]

如要依資料列總數排序,請指定總數資料欄的索引。舉例來說,下列元素會使用索引 2 依資料列總數排序,代表含有兩個樞紐分析資料欄的查詢總數資料欄:

- name: orders_by_cohort
  sorts: [users.count desc 2]

fill_fields

fill_fields 參數會定義使用「維度填入」選項的維度。使用 view_name.dimension_name 語法指定維度。

- name: orders_by_date
  fill_fields: [orders.created_date, orders.shipped_date]

limit

limit 參數會定義元素查詢應使用的資料列限制。這項限制適用於套用任何樞紐分析表前的列數。

- name: orders_by_date
  limit: 100

filters

本節是指屬於資訊主頁元素的 filters 參數。

filters 也可做為資訊主頁的一部分,詳情請參閱「資訊主頁參數」說明文件頁面。

filters 也可做為指標的一部分,詳情請參閱 filters 參數說明文件頁面。

filters 參數會定義元素查詢應使用的不可變更篩選條件。如要讓使用者可以在資訊主頁中變更篩選器,請使用 filters 為資訊主頁設定篩選器,然後使用 listen 將篩選器套用至元素。

filters 的語法如下:

- name: element_name
  filters:
    orders.created_date: 2020/01/10 for 3 days
    orders.status: Shipped
    # You can create multiple filter statements

每個篩選器可接受 Looker 篩選運算式或值常數。您也可以在篩選運算式中使用 _localization 或 _user_attributes Liquid 變數,取得彈性的篩選器值。

filter_expression

filter_expression 參數會為元素的查詢定義不可變更的自訂篩選器。如要讓使用者可以在資訊主頁中變更篩選器,請使用 filters 為資訊主頁設定篩選器,然後使用 listen 將篩選器套用至元素。

- name: element_name
  filter_expression:
  - diff_days(${users.created_date},${user_order_facts.first_order_date}) > 60

如需 Looker 篩選運算式,請參閱這個說明文件頁面。

listen

資訊主頁篩選器可讓檢視者互動式地篩選資訊主頁元素中顯示的資料。使用 filters 參數定義 LookML 資訊主頁的資訊主頁篩選條件。接著,使用 listen 參數將資訊主頁元素連結至資訊主頁篩選器。

listen 的語法如下:

- name: element_name
  listen:
    filter_name_goes_here: dimension or measure on which to apply
                           the filter using view_name.field_name syntax
    # You can add more than one listen statement

將 listen 參數新增至元素,然後使用 view_name.field_name 語法提供篩選器名稱,並在後方加上半形冒號,以及篩選器應套用的欄位參照。舉例來說,您可以建立名為「日期」的篩選器,要求使用者在 UI 的篩選器欄位中輸入日期。接著,您就可以將使用者輸入的值套用至 orders_by_date 元素,如下所示:

- dashboard: sales_overview
  ...

  filters:
  - name: date
    type: date_filter

  elements:
 - name: orders_by_date
    listen:
      date: order.order_date
    ...

如果正在監聽的篩選器已設定 vis_filter: true 參數,篩選器控制項會顯示在該視覺化圖塊頂端的篩選器列中,而不是資訊主頁頂端的篩選器列。

如需使用 filters 參數和 listen 參數,將資訊主頁篩選器套用至個別資訊主頁元素的其他範例,請參閱「建構 LookML 資訊主頁」。

hidden_fields

hidden_fields 參數會指出查詢中使用的欄位 (如有),但這些欄位會隱藏在圖表中。隱藏的欄位會顯示在「探索」的資料表專區中。

hidden_fields: [inventory_items.count, distribution_centers.id]

query_timezone

query_timezone 參數會指定查詢的執行時區。時區選項會顯示在 「timezone 的值」說明頁面。如要使用檢視者的時區執行查詢,可以將值指派為 user_timezone。

- name: orders_by_date
  query_timezone: America/Los Angeles
- name: orders_by_customer
  query_timezone: user_timezone

merged_queries

merged_queries 參數可讓您合併多個查詢的結果,並顯示在單一資訊主頁元素中。在元素的 merged_queries 參數中定義每個來源查詢,並使用 join_fields 子參數指定結果的合併方式。

下列 LookML 程式碼範例會建立合併結果的 type: looker_grid 元素。在本例中,merged_queries 參數用於建立資訊主頁元素,將兩個不同查詢的資料合併為單一表格圖表:

- name: merged_results_element
  title: Merged Results Tile
  type: looker_grid
  merged_queries:
  - model: ecommerce
    explore: users
    type: table
    fields: [users.state, users.count, users.city]
    sorts: [users.count desc 0]
    limit: 5000
    column_limit: 50
    query_timezone: UTC
    listen:
    - State: users.state
  - model: ecommerce
    explore: users
    type: table
    fields: [users.state, users.city]
    sorts: [users.state]
    limit: 500
    column_limit: 50
    query_timezone: UTC
    join_fields:
    - field_name: users.state
      source_field_name: users.state
    - field_name: users.city
      source_field_name: users.city
    listen:
    - State: users.state

在這個範例中,資訊主頁元素會合併兩個來源查詢的資料,這些查詢是以 ecommerce 模型中的 users 探索為基礎。主要查詢包含 users.state、users.count 和 users.city 欄位,並依 users.count 欄位排序結果。第二個來源查詢包含 users.state 和 users.city 欄位,並依 users.state 欄位排序結果。

join_field 參數會根據 users.state 和 users.city 欄位中的相符值合併來源查詢。

listen 參數會對這兩項查詢套用 State 篩選器,讓資訊主頁檢視者選取特定州別,藉此縮小資訊主頁圖塊中顯示的查詢結果範圍。

範例:合併公司資料

假設您想建立合併查詢,將來自兩個不同探索 (company_info 和 companies) 的公司資訊合併。您想從每個「探索」的 ipo.stock_symbol、companies.name 和 companies.contact_email 欄位中加入查詢,建立可傳回公司名稱、公司聯絡電子郵件、首次公開募股年份、股票代號、員工數和職位數的查詢。您可以在 LookML 中定義合併的查詢元素,如下所示:

- name: merged_results_element
  title: Merged Results Tile
  merged_queries:
  - model: market_research
    explore: company_info
    fields: [companies.name, companies.contact_email, ipo.public_year, ipo.stock_symbol]
    filters:
      companies.contact_email: "-NULL"
      ipo.valuation_amount: NOT NULL
    sorts: [ipo.public_year desc]
  - model: company_data
    explore: companies
    fields: [companies.name, ipo.stock_symbol, companies.contact_email,
      companies.number_of_employees, jobs.job_count]
    filters:
      companies.number_of_employees: NOT NULL
      ipo.stock_symbol: "-NULL"
      companies.contact_email: "-NULL"
    sorts: [jobs.job_count desc]
    join_fields:
    - field_name: ipo.stock_symbol
      source_field_name: ipo.stock_symbol
    - field_name: companies.name
      source_field_name: companies.name
    - field_name: companies.contact_email
      source_field_name: companies.contact_email

對合併的查詢元素套用篩選器

先前合併查詢元素的範例,說明如何使用 filters 參數,直接在每個來源查詢中套用硬式編碼的篩選條件。舉例來說,主要查詢中的 companies.contact_email: "-NULL" 和 ipo.valuation_amount: NOT NULL 篩選器會將結果限制為具有有效聯絡電子郵件和估值的公司。這些查詢層級的篩選條件會在合併查詢前預先篩選資料,使用者無法變更。

您也可以在每個來源查詢的定義中,使用 listen 參數,將資訊主頁篩選器套用至合併的查詢元素。舉例來說,假設您有名為 Industry 的資訊主頁篩選器,您已使用 filters 參數為 LookML 資訊主頁定義該篩選器:

filters:
- name: Industry
  title: Industry
  type: field_filter
  ui_config:
    type: dropdown_menu
    display: inline
  model: market_research
  explore: company_info
  field: companies.industry

如要將 Industry 篩選器套用至兩個來源查詢中的 companies.industry 欄位,請在每個合併查詢的來源查詢定義中新增 listen 參數,如下所示:

listen:
  Industry: companies.industry

舉例來說,下列程式碼範例會將 Industry 篩選器新增至先前範例中合併結果元素內的兩個來源查詢。

- name: merged_results_element
  title: Merged Results Tile
  merged_queries:
  - model: market_research
    explore: company_info
    fields: [companies.name, companies.contact_email, ipo.public_year, ipo.stock_symbol]
    filters:
      companies.contact_email: "-NULL"
      ipo.valuation_amount: NOT NULL
    sorts: [ipo.public_year desc]
    listen:
      Industry: companies.industry
  - model: company_data
    explore: companies
    fields: [companies.name, ipo.stock_symbol, companies.contact_email,
      companies.number_of_employees, jobs.job_count]
    filters:
      companies.number_of_employees: NOT NULL
      ipo.stock_symbol: "-NULL"
      companies.contact_email: "-NULL"
    sorts: [jobs.job_count desc]
    join_fields:
    - field_name: ipo.stock_symbol
      source_field_name: ipo.stock_symbol
    - field_name: companies.name
      source_field_name: companies.name
    - field_name: companies.contact_email
      source_field_name: companies.contact_email
    listen:
      Industry: companies.industry

新增這項功能後,使用者與 Industry 資訊主頁篩選器互動時,系統會相應篩選合併查詢元素中的來源查詢。

系列參數

本節所述參數對應於瀑布圖的圖表設定編輯器中「序列」選單的選項。

up_color

設定圖表中正值長條的顏色。顏色值可以是引號括住的十六進位字串,例如「#2ca6cd」,也可以是 CSS 具名顏色字串,例如 mediumblue。

up_color: blue

如果使用 up_color 參數,系統會覆寫 color_application 參數。

down_color

設定圖表中負值長條的顏色。顏色值可以是引號括住的十六進位字串,例如「#2ca6cd」,也可以是 CSS 具名顏色字串,例如 mediumblue。

down_color: "#ff0000"

如果使用 down_color 參數,系統會覆寫 color_application 參數。

total_color

設定圖表中總計值長條的顏色。顏色值可以是引號括住的十六進位字串,例如「#2ca6cd」,也可以是 CSS 具名顏色字串,例如 mediumblue。

total_color: yellow

如果使用 total_color 參數,系統會覆寫 color_application 參數。

color_application

color_application 參數及其子參數 collection_id 和 palette_id 可用於將特定顏色集合和調色盤套用至資訊主頁元素。如要瞭解 Looker 的原生顏色集合,請參閱「顏色集合」說明文件頁面。

如果您有要使用的調色盤的集合 ID 和調色盤 ID,可以將這些 ID 輸入 collection_id 和 palette_id 子參數。集合 ID 或調色盤 ID 可能是英數字元代碼,也可能是以顏色集合名稱為依據。英數字元代碼適用於 Looker 的原生集合。這些是執行個體專屬的,如下所示:


color_application:
  collection_id: 1297dk12-86a7-4xe0-8dfc-82de20b3806a
  palette_id: 93c8aeb7-3f8a-4ca7-6fee-88c3617516a1

自訂顏色集合會使用以顏色集合名稱為準的集合和調色盤 ID,這些 ID 可在不同執行個體之間移植,外觀如下:


color_application:
  collection_id: blue-tone-collection
  palette_id: blue-tone-collection-categorical-0

您也可以使用 UI 尋找所需顏色、集合或調色盤,並產生 LookML 將這些項目新增至資訊主頁。前往使用者定義的內容 (例如 Look、資訊主頁或探索),然後使用 UI 將所需顏色、集合或調色盤套用至該內容的視覺化圖表。完成後,請按照這些步驟取得資訊主頁 LookML,複製產生的 LookML,然後貼到 color_application 區段。

color_application,以及正值、負值和總值長條

根據預設,系統會將指定調色盤的第一個顏色套用至瀑布圖中的正值長條、將調色盤的第二個顏色套用至瀑布圖中的負值長條,並將指定調色盤的第三個顏色套用至瀑布圖中的總計長條。選用的子參數 reverse 會分別將應用程式變更為最後一個顏色、倒數第二個顏色和倒數第三個顏色。

color_application:
  collection_id: blue-tone-collection
  palette_id: blue-tone-collection-categorical-0
  options:
    reverse: true

如果同時使用這兩種顏色參數,up_color、down_color 和 total_color 參數會覆寫 color_application 參數中指定的任何顏色。

值參數

本節所述的參數對應於瀑布圖的視覺化編輯器中「值」選單的選項。

show_value_labels

在資料點旁邊顯示長條、線條或點的值。

show_value_labels: true | false

## default value: false

label_color

label_color 參數接受標籤的顏色值。顏色值可格式化為十六進位字串 (例如 #2ca6cd),或 CSS 具名顏色字串 (例如 mediumblue)。


label_color: [blue]

X 軸參數

本節所述參數對應於瀑布圖的視覺化編輯器 X 選單中的選項。

x_axis_scale

這項參數會決定 x 軸比例的計算方式。

  • auto:系統會根據基礎資料推斷比例。這是預設設定。
  • ordinal:資料會繪製為間隔均勻的離散項目。
  • time:資料會以時間為單位繪製,並適當標示座標軸。如果基礎資料無法轉換為日期,這項功能就無法運作。
x_axis_scale: auto | ordinal | time

## default value: auto

show_x_axis_label

這項參數可決定是否顯示 X 軸標籤。

show_x_axis_label: true | false

## default value: true

show_x_axis_ticks

這項參數會決定是否要在 x 軸上顯示值。

show_x_axis_ticks: true | false

## default value: true

x_axis_zoom

這個參數可指定使用者能否放大視覺化效果的 X 軸。如果 x_axis_zoom 設為 true,即可縮放畫面。如果 x_axis_zoom 設為 false,就無法縮放。

如果將「x_axis_zoom」設為 false,系統會停用「y_axis_zoom」。

x_axis_zoom: true | false

# default value: true

Y 軸參數

本節所述參數對應於瀑布圖的視覺化編輯器 Y 選單中的選項。

show_y_axis_labels

這項參數會決定是否顯示 Y 軸標籤。

show_y_axis_labels: true | false

## default value: true

show_y_axis_ticks

這項參數會決定是否在 Y 軸上顯示值。

show_y_axis_ticks: true | false

## default value: true

y_axis_gridlines

這項參數會決定格線是否從 Y 軸延伸。

y_axis_gridlines: true | false

## default value: true

y_axis_zoom

這個參數會指定使用者是否可以放大視覺化效果的 Y 軸。將 y_axis_zoom 設為 true 即可縮放畫面。

如果將 y_axis_zoom 設為 false,使用者就無法縮放 Y 軸的較小部分。不過,如果 x_axis_zoom 參數設為 true,使用者可能仍可縮放 X 軸的較小部分。

如果將 x_axis_zoom 設為 false,系統會停用 y_axis_zoom。

y_axis_zoom: true | false

# default value: true

進階視覺化設定

本節所述的參數對應至選用的圖表設定覆寫,您可以點選視覺化編輯器「繪圖」部分的「編輯圖表設定」按鈕,將這些參數套用至圖表。

advanced_vis_config

這項參數接受 HighCharts JSON 片段,可覆寫多項視覺化設定,並開啟新功能。如需使用 HighCharts JSON 達成常見用途的範例,請參閱「使用圖表設定編輯器自訂視覺化效果」說明文件頁面。


advanced_vis_config: "{ series: [{ formatters: [{ select: 'value >= 50', style: { color: 'orange' } }]}]}"

# This example changes the color to orange for any series value that is greater than or equal to 50.

# default value: null