render 运算符render operator

指示用户代理以特定方式呈现查询结果。Instructs the user agent to render the results of the query in a particular way.

range x from 0.0 to 2*pi() step 0.01 | extend y=sin(x) | render linechart

备注

  • Render 运算符应当是查询中的最后一个运算符,仅与生成单个表格数据流结果的查询一起使用。The render operator should be the last operator in the query, and used only with queries that produce a single tabular data stream result.
  • Render 运算符不修改数据。The render operator does not modify data. 它在结果的扩展属性中注入注释(“可视化效果”)。It injects an annotation ("Visualization") into the result's extended properties. 注释包含由查询中的运算符提供的信息。The annotation contains the information provided by the operator in the query.
  • 可视化效果信息的解释由用户代理来完成。The interpretation of the visualization information is done by the user agent. 不同的代理(例如 Kusto.Explorer、Kusto.WebExplorer)可能支持不同的可视化效果。Different agents (such as Kusto.Explorer,Kusto.WebExplorer) might support different visualizations.

语法Syntax

T | render Visualization [with ( PropertyName = PropertyValue [, ...] )]T | render Visualization [with ( PropertyName = PropertyValue [, ...] )]

其中:Where:

  • Visualization 指示要使用的可视化效果的种类。Visualization indicates the kind of visualization to use. 支持的值包括:The supported values are:
可视化Visualization 描述Description
anomalychart 与 timechart 类似,但使用 series_decompose_anomalies 函数突出显示异常Similar to timechart, but highlights anomalies using series_decompose_anomalies function.
areachart 面积图。Area graph. 第一列是 x 轴,应当为数值列。First column is the x-axis and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
barchart 第一列是 x 轴,可以是文本、日期/时间或数值。First column is the x-axis and can be text, datetime or numeric. 其他列是数值,显示为水平条带。Other columns are numeric, displayed as horizontal strips.
card 第一个结果记录被视为标量值集,并显示为卡片。First result record is treated as set of scalar values and shows as a card.
columnchart barchart 一样,但带有竖直条带而不是水平条带。Like barchart with vertical strips instead of horizontal strips.
ladderchart 最后两列是 x 轴,其他列是 y 轴。Last two columns are the x-axis, other columns are y-axis.
linechart 折线图。Line graph. 第一列是 x 轴,应当为数值列。First column is x-axis, and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
piechart 第一列是颜色轴,第二列是数值。First column is color-axis, second column is numeric.
pivotchart 显示数据透视表和图表。Displays a pivot table and chart. 用户可以通过交互方式选择数据、列、行和各种图表类型。User can interactively select data, columns, rows and various chart types.
scatterchart 点图。Points graph. 第一列是 x 轴,应当为数值列。First column is x-axis and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
stackedareachart 堆积面积图。Stacked area graph. 第一列是 x 轴,应当为数值列。First column is x-axis, and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
table 默认设置 - 结果显示为表。Default - results are shown as a table.
timechart 折线图。Line graph. 第一列是 x 轴,且应为日期/时间。First column is x-axis, and should be datetime. 其他(数值)列是 y 轴。Other (numeric) columns are y-axes. 有一个字符串列,其值用来对数值列进行“分组”并在图表中创建不同的线条(将忽略其他字符串列)。There is one string column whose values are used to "group" the numeric columns and create different lines in the chart (further string columns are ignored).
timepivot 在事件时间线上进行交互式导航(沿时间轴旋转)Interactive navigation over the events time-line (pivoting on time axis)
可视化Visualization 描述Description
areachart 面积图。Area graph. 第一列是 x 轴,应当为数值列。First column is the x-axis and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
barchart 第一列是 x 轴,可以是文本、日期/时间或数值。First column is the x-axis and can be text, datetime or numeric. 其他列是数值,显示为水平条带。Other columns are numeric, displayed as horizontal strips.
columnchart barchart 一样,但带有竖直条带而不是水平条带。Like barchart with vertical strips instead of horizontal strips.
piechart 第一列是颜色轴,第二列是数值。First column is color-axis, second column is numeric.
scatterchart 点图。Points graph. 第一列是 x 轴,应当为数值列。First column is the x-axis and should be a numeric column. 其他数值列是 y 轴。Other numeric columns are y-axes.
table 默认设置 - 结果显示为表。Default - results are shown as a table.
timechart 折线图。Line graph. 第一列是 x 轴,且应为日期/时间。First column is x-axis, and should be datetime. 其他(数值)列是 y 轴。Other (numeric) columns are y-axes. 有一个字符串列,其值用来对数值列进行“分组”并在图表中创建不同的线条(将忽略其他字符串列)。There is one string column whose values are used to "group" the numeric columns and create different lines in the chart (further string columns are ignored).
  • PropertyName/PropertyValue 指示在呈现时要使用的其他信息。PropertyName/PropertyValue indicate additional information to use when rendering. 所有属性都是可选的。All properties are optional. 支持的属性如下:The supported properties are:
PropertyNamePropertyName PropertyValuePropertyValue
accumulate 是否将每个度量的值加到其所有前导度量中。Whether the value of each measure gets added to all its predecessors. truefalse(true or false)
kind 可视化效果种类的进一步细化。Further elaboration of the visualization kind. 请参阅下文。See below.
legend 是否显示图例(visiblehidden)。Whether to display a legend or not (visible or hidden).
series 以逗号分隔的列列表,其中的每记录值组合定义了记录所属的系列。Comma-delimited list of columns whose combined per-record values define the series that record belongs to.
ymin 要在 Y 轴上显示的最小值。The minimum value to be displayed on Y-axis.
ymax 要在 Y 轴上显示的最大值。The maximum value to be displayed on Y-axis.
title 可视化效果的标题(string 类型)。The title of the visualization (of type string).
xaxis 如何缩放 x 轴(linearlog)。How to scale the x-axis (linear or log).
xcolumn 结果中的哪一列用于 x 轴。Which column in the result is used for the x-axis.
xtitle x 轴的标题(string 类型)。The title of the x-axis (of type string).
yaxis 如何缩放 y 轴(linearlog)。How to scale the y-axis (linear or log).
ycolumns 由逗号分隔的列列表,其中包含根据 x 列的值提供的值。Comma-delimited list of columns that consist of the values provided per value of the x column.
ysplit 如何拆分多个可视化效果。How to split multiple the visualization. 请参阅下文。See below.
ytitle y 轴的标题(string 类型)。The title of the y-axis (of type string).
anomalycolumns 仅限与 anomalychart 相关的属性。Property relevant only for anomalychart. 将被视为异常系列并在图表中显示为点的列的逗号分隔列表Comma-delimited list of columns which will be considered as anomaly series and displayed as points on the chart
PropertyNamePropertyName PropertyValuePropertyValue
kind 可视化效果种类的进一步细化。Further elaboration of the visualization kind. 请参阅下文。See below.
series 以逗号分隔的列列表,其中的每记录值组合定义了记录所属的系列。Comma-delimited list of columns whose combined per-record values define the series that record belongs to.
title 可视化效果的标题(string 类型)。The title of the visualization (of type string).
yaxis 如何缩放 y 轴(linearlog)。How to scale the y-axis (linear or log).

可以通过提供 kind 属性来进一步详细阐述某些可视化效果。Some visualizations can be further elaborated by providing the kind property. 这些是:These are:

可视化Visualization kind 描述Description
areachart default 每个“区域”都独立存在。Each "area" stands on its own.
unstacked default 相同。Same as default.
stacked 将“区域”堆叠到右侧。Stack "areas" to the right.
stacked100 将“区域”堆叠到右侧,并将每个区域拉伸到与其他区域相同的宽度。Stack "areas" to the right and stretch each one to the same width as the others.
barchart default 每个“条形”都独立存在。Each "bar" stands on its own.
unstacked default 相同。Same as default.
stacked 对“条形”进行堆叠。Stack "bars".
stacked100 对“条形”进行堆叠,并将每个条形拉伸到与其他条形相同的宽度。Stack "bard" and stretch each one to the same width as the others.
columnchart default 每个“柱形”都独立存在。Each "column" stands on its own.
unstacked default 相同。Same as default.
stacked 将“柱形”一个接一个地堆叠。Stack "columns" one atop the other.
stacked100 对“柱形”进行堆叠,并将每个柱形拉伸到与其他柱形相同的高度。Stack "columns" and stretch each one to the same height as the others.
piechart map 预期的柱形为 [经度,纬度] 或 GeoJSON 点、颜色轴和数值。Expected columns are [Longitude, Latitude] or GeoJSON point, color-axis and numeric. 在 Kusto 资源管理器桌面中受支持。Supported in Kusto Explorer desktop.
scatterchart map 预期的柱形为 [经度,纬度] 或 GeoJSON 点。Expected columns are [Longitude, Latitude] or GeoJSON point. 系列列是可选的。Series column is optional. 在 Kusto 资源管理器桌面中受支持。Supported in Kusto Explorer desktop.

某些可视化效果支持拆分为多个 y 轴值:Some visualizations support splitting into multiple y-axis values:

ysplit 描述Description
none 为所有系列数据显示单个 y 轴。A single y-axis is displayed for all series data. (默认值)(Default)
axes 单个图表将显示多个 y 轴(每个系列一个)。A single chart is displayed with multiple y-axes (one per series).
panels 为每个 ycolumn 值呈现一个图表(直至达到某个限制)。One chart is rendered for each ycolumn value (up to some limit).

备注

render 运算符的数据模型将表格数据视为具有下述三种列的数据:The data model of the render operator looks at the tabular data as if it has three kinds of columns:

  • X 轴列(由 xcolumn 属性指示)。The x axis column (indicated by the xcolumn property).
  • 系列列(由 series 属性指示的任意数目的列。)对于每个记录,这些列的组合值定义单个系列,而图表的系列数量与非重复组合值的数量相同。The series columns (any number of columns indicated by the series property.) For each record, the combined values of these columns defines a single series, and the chart has as many series as there are distinct combined values.
  • Y 轴列(由 ycolumns 属性指示的任意数目的列)。The y axis columns (any number of columns indicated by the ycolumns property). 对于每个记录,该系列都具有与 y 轴列一样多的度量(图表中的“点”)。For each record, the series has as many measurements ("points" in the chart) as there are y-axis columns.

提示

  • 可使用 wheresummarizetop 来限制显示的数据量。Use where, summarize and top to limit the volume that you display.
  • 对数据进行排序以定义 x 轴的顺序。Sort the data to define the order of the x-axis.
  • 用户代理可以自由地“推测”查询未指定的属性的值。User agents are free to "guess" the value of properties that are not specified by the query. 需要特别注意的是,在结果架构中提高“不感兴趣的”列可能会导致推测错误。In particular, having "uninteresting" columns in the schema of the result might translate into them guessing wrong. 如果出现这种情况,请尝试通过 project-away 运算符排除此类列。Try projecting-away such columns when that happens.

示例Example

range x from -2 to 2 step 0.1
| extend sin = sin(x), cos = cos(x)
| extend x_sign = iif(x > 0, "x_pos", "x_neg")
| extend sum_sign = iif(sin + cos > 0, "sum_pos", "sum_neg")
| render linechart with  (ycolumns = sin, cos, series = x_sign, sum_sign)