获取自己列中的列名来渲染饼图

Get column names in its own column to render pie chart

我正在 Kusto 中编写查询以解析来自传感器的心跳数据。这是我写的:

datatable(timestamp:datetime, healthycount:int, unhealthycount:int, origin:string)
[
    datetime(1910-06-11), 10, 1, 'origin',
    datetime(1910-05-11), 9, 2, 'origin'
]
| summarize latest = arg_max(timestamp, *) by origin
| project healthy = healthycount,
    unhealthy = unhealthycount

这会输出这样的数据:

+--------------+----------------+
|   healthy    |   unhealthy    |
+--------------+----------------+
|           10 |              1 |
+--------------+----------------+

但是,我想将此数据表示为饼图,但为此我需要以下格式的数据:

+----------------+-------+
|      key       | value |
+----------------+-------+
| healthy        |    10 |
| unhealthy      |     1 |
+----------------+-------+

这可以吗?我在寻找什么术语?

这是一种方法:

datatable(timestamp:datetime, healthycount:int, unhealthycount:int, origin:string)
[
    datetime(1910-06-11), 10, 1, 'origin',
    datetime(1910-05-11), 9, 2, 'origin'
]
| summarize arg_max(timestamp, *) by origin
| extend Pack = pack("healthycount", healthycount, "unhealthycount", unhealthycount)
| mv-expand kind=array Pack 
| project key = tostring(Pack[0]), value = toint(Pack[1])