共用方式為


Time chart

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

時程圖表視覺效果是折線圖的類型。 查詢的第一個數據行是 x 軸,而且應該是日期時間。 其他數值數據行是 y 軸。 一個字串數據行值可用來群組數值數據行,並在圖表中建立不同的線條。 忽略其他字串數據行。 The time chart visual is like a line chart except the x-axis is always time.

Note

This visualization can only be used in the context of the render operator.

Syntax

T|rendertimechart [with(propertyName=propertyValue [, ...])]

Learn more about syntax conventions.

Parameters

Name 類型 Required Description
T string ✔️ 輸入數據表名稱。
propertyName, propertyValue string 索引鍵/值屬性組的逗號分隔清單。 See supported properties.

Supported properties

所有屬性都是選擇性的。

PropertyName PropertyValue
accumulate 每個量值的值是否會新增至其所有前置專案 (truefalse)。
legend 是否要顯示圖例(visiblehidden)。
series 以逗號分隔的數據行清單,其合併每個記錄值會定義記錄所屬的數位。
ymin 要顯示在 Y 軸上的最小值。
ymax 要顯示在 Y 軸上的最大值。
title 視覺效果的標題(類型 string為 )。
xaxis 如何縮放 X 軸 (linearlog)。
xcolumn 結果中的哪一個數據行用於 x 軸。
xtitle x 軸的標題(類型為 string)。
yaxis 如何縮放 Y 軸 (linearlog)。
ycolumns 以逗號分隔的數據列清單,其中包含 x 資料行每個值所提供的值。
ysplit 如何將視覺效果分割成多個 Y 軸值。 如需詳細資訊,請參閱 ysplit 屬性
ytitle y 軸的標題(類型 string為 )。

ysplit 屬性

此視覺效果支援分割成多個 Y 軸值:

ysplit Description
none 所有數列數據都會顯示單一 Y 軸。 (Default)
axes 單一圖表會以多個 Y 軸顯示(每個數列一個)。
panels 每個 ycolumn 值都會轉譯一張圖表。 最多五個面板。

Examples

本節中的範例示範如何使用 語法來協助您開始使用。

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. 您可能需要修改範例查詢中的資料表名稱,以符合工作區中的資料表。

轉譯時間圖

下列範例會轉譯標題為 「Web 應用程式」 的時間圖。 一個多月的流量,將數據分解成基準、季節性、趨勢和剩餘元件。

let min_t = datetime(2017-01-05);
let max_t = datetime(2017-02-03 22:00);
let dt = 2h;
demo_make_series2
| make-series num=avg(num) on TimeStamp from min_t to max_t step dt by sid 
| where sid == 'TS1'   //  select a single time series for a cleaner visualization
| extend (baseline, seasonal, trend, residual) = series_decompose(num, -1, 'linefit')  //  decomposition of a set of time series to seasonal, trend, residual, and baseline (seasonal+trend)
| render timechart with(title='Web app. traffic over a month, decomposition')

時間圖視覺效果輸出的螢幕快照。

為時間圖加上標籤

下列範例會轉譯描述依周分組的作物損毀的時間圖。 時間圖 x 軸標籤為 「日期」,而 y 軸標籤為「裁剪損毀」。

StormEvents
| where StartTime between (datetime(2007-01-01) .. datetime(2007-12-31)) 
    and DamageCrops > 0
| summarize EventCount = count() by bin(StartTime, 7d)
| render timechart
    with (
    title="Crop damage over time",
    xtitle="Date",
    ytitle="Crop damage",
    legend=hidden
    )

具有標籤的時間圖螢幕快照。

檢視多個 Y 軸

下列範例會在德克薩斯州、內布拉斯加州和堪薩斯州呈現每日冰凍事件。 視覺效果會使用 ysplit 屬性,在個別面板中轉譯每個狀態的事件以進行比較。

StormEvents
| where State in ("TEXAS", "NEBRASKA", "KANSAS") and EventType == "Hail"
| summarize count() by State, bin(StartTime, 1d)
| render timechart with (ysplit=panels)

時程圖表查詢結果的螢幕快照,其中包含 ysplit 面板屬性。

Supported properties

所有屬性都是選擇性的。

PropertyName PropertyValue
series 以逗號分隔的數據行清單,其合併每個記錄值會定義記錄所屬的數位。
title 視覺效果的標題(類型 string為 )。

Example

下列範例會轉譯標題為 「Web 應用程式」 的時間圖。 一個多月的流量,將數據分解成基準、季節性、趨勢和剩餘元件。

let min_t = datetime(2017-01-05);
let max_t = datetime(2017-02-03 22:00);
let dt = 2h;
demo_make_series2
| make-series num=avg(num) on TimeStamp from min_t to max_t step dt by sid 
| where sid == 'TS1'   //  select a single time series for a cleaner visualization
| extend (baseline, seasonal, trend, residual) = series_decompose(num, -1, 'linefit')  //  decomposition of a set of time series to seasonal, trend, residual, and baseline (seasonal+trend)
| render timechart with(title='Web app. traffic of a month, decomposition')

時間圖視覺效果輸出的螢幕快照。