Query help: Render array entries in barchart - timegenerated

New Contributor

Hi all,


I have a datatable consisting of three entries like this:


[foo, bar, foo2, bar2]
[foo, bar, foo2, bar2]
[boo, far, boo2, far2, boo3]


Is there any chance to render this output in a barchart where the x-axis is TimeGenerated and the y-axis is the stacked count of one entry of the datatable. Maybe the following is more expressive for you:




Here, each color represents the occurrence of one element of one entry. In this case the second stack has more elements in its array as the first one.


Any help is appreciated!





2 Replies



Check out this:

let data=datatable(timestamp:datetime, elements:dynamic)[
'2020-02-02', dynamic(['foo', 'bar', 'foo2', 'bar2']),
'2020-02-03', dynamic(['foo', 'bar', 'foo2', 'bar2']),
'2020-02-04', dynamic(['boo', 'far', 'boo2', 'far2', 'boo3']),
'2020-02-05', dynamic(['boo', 'far', 'boo2', 'boo3'])];
| mv-expand elements
| summarize count() by timestamp, tostring(elements)
| render columnchart with(kind=stacked)