2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

この記事誰得? 私しか得しないニッチな技術で記事投稿!

Kusto の render timechart でデータが無い期間のグラフをきれいにする

Posted at

TL;DR

make-series を使う

お題

以下のような日付毎の集計結果をいい感じにグラフ表示させたい。

let ST = datetime(2007-11-01);
let ET = datetime(2007-12-01);
StormEvents 
| where StartTime between (ST .. ET)
| where State == "HAWAII"
| summarize count() by bin(StartTime, 1d)

image.png

ありがちな書き方

そのまま render timechart

let ST = datetime(2007-11-01);
let ET = datetime(2007-12-01);
StormEvents 
| where StartTime between (ST .. ET)
| summarize count() by bin(StartTime, 1d), State
| render timechart 

結果

11/3や11/6、11/8~11/18 などレコードがない期間のポイントが無いグラフが描画される

image.png

make-series をつかう書き方

let ST = datetime(2007-11-01);
let ET = datetime(2007-12-01);
StormEvents 
| where StartTime between (ST .. ET)
| where State == "HAWAII"
| make-series count() on StartTime from ST to ET step 1d
| render timechart 

結果

データがない日は0になってますね。

image.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?