2
0

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 3 years have passed since last update.

Google Dataportalで積み上げグラフを作る方法

Posted at

はじめに

この記事では,ダッシュボード作成・データ視覚化サービスのGoogle Dataportalで,積み上げグラフを作成する方法について説明します.

以下の2つの場合で作り方が異なってきます.

  • 縦持ちデータの場合
  • 横持ちデータの場合

方法1:横持ちデータの場合

以下の様な,横持ちデータを積み上げグラフにしたいとします.

Date Col1 Col2 Col3 Col4
1/1 2000 1000 3000 4000
1/2 1500 3000 2500 3300
1/3 4000 2000 1200 1300
1/4 4600 1400 1000 1000

1. データポータルに取り込み

普通にデータリソースから取り込みます.

すると表の形で取り込まれます.
スクリーンショット 2021-03-06 16.28.51.png

2. グラフを棒グラフに変更

右のバーから,グラフを棒グラフに変更します.
スクリーンショット 2021-03-06 16.30.09.png

3. ディメンションと指標を設定

ディメンションとは「グラフを表示する単位」,指標とは「グラフに現したい値」のことです.今回は,1日ごとの値を見たいので,ディメンションをDate,指標をCol1,Col2,Col3,Col4とします.また,時間通りの順番に並べたいので,並び替えをDateの昇順とします.
image.png

これによって,日付順で毎日の値が棒グラフでみられるようになります.
スクリーンショット 2021-03-06 16.35.26.png

4. 積み上げグラフにする

スタイルから積み上げグラフのチェックを入れます.
スクリーンショット 2021-03-06 16.36.12.png

そのままきれいな積み上げグラフになります.
スクリーンショット 2021-03-06 16.37.01.png

方法2. 縦持ちデータの場合

以下の様な,縦持ちデータを積み上げグラフにしたいとします.

Date Type Value
1/1 Col1 2000
1/1 Col2 1000
1/1 Col3 3000
1/1 Col4 4000
1/2 Col1 1500
1/2 Col2 3000
1/2 Col3 2500
1/2 Col4 3300
1/3 Col1 4000
1/3 Col2 2000
1/3 Col3 1200
1/3 Col4 1300
1/4 Col1 4600
1/4 Col2 1400
1/4 Col3 1000
1/4 Col4 1000

1. データ・リソースを取り込み

データリソースから追加します.

2. グラフを追加

とりあえず積み上げグラフを選択.
スクリーンショット 2021-03-06 16.43.54.png

3. ディメンションと内訳,指標を設定

今回は内訳があります.
ディメンションをDate,内訳をType,指標をValueにします.並び順はDateで昇順にします.
スクリーンショット 2021-03-06 16.46.03.png

するとグラフができます
スクリーンショット 2021-03-06 16.46.21.png

まとめ

横持ちグラフの場合は並列に,縦持ちグラフの場合は内訳に列を設定することで積み上げグラフの表示が可能となります.自分は潰しがきく点で,縦持ちグラフがおすすめです.

2
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?