使用order
函数和make-list
函数对查询结果进行排序和转换,然后使用summarize
和make-series
函数创建柱状图。例如,以下查询将按“Cost”列的值对结果进行排序,并绘制名为“ProjectCostsChart”的柱状图:
datatable(Project:string, Cost:long)
[
"Project A", 10000,
"Project B", 5000,
"Project C", 15000,
"Project D", 12000,
"Project E", 8000,
]
| order by Cost asc
| project Project, Cost
| take 10
| summarize make_list(Cost) by Project
| make-series sum(Cost) default=0 on ('Project A', 'Project B', 'Project C', 'Project D', 'Project E')
| render barchart with(title='ProjectCostsChart', ytitle='Cost')