📊 Node-RED Dashboard 2.0 データ可視化ウィジェット ガイド
このガイドでは、Dashboard 2.0のデータ可視化系ウィジェット について詳しく解説します。センサーデータのグラフ表示、ゲージによるリアルタイム監視、テーブルでのデータ一覧表示など、IoTダッシュボードに欠かせない機能を学びましょう。
📈 1. データ可視化ウィジェット概要
🎨 日常のアナロジー:車のダッシュボード
車を運転するとき、ダッシュボードを見ると様々な情報が視覚的に表示されています:
スピードメーター(ゲージ) - 現在の速度を針や数値で表示
燃料計(ゲージ) - 残量をバーやセグメントで表示
走行距離計(テキスト) - 累計距離を数値で表示
燃費グラフ(チャート) - 時系列での変化を折れ線で表示
Dashboard 2.0のデータ可視化ウィジェットも同様に、IoTセンサーやシステムの状態を直感的に把握できる形で表示します。
📋 データ可視化ウィジェット一覧
📈
chart
折れ線・棒・円グラフなど多彩なチャート
動作を図で見る
ui-chart ノードは、届いた値を 1 点ずつグラフに足していきます。
温度 24 温度 26 温度 25 topic: "温度" ui-chart ダッシュボード 新しい点
同じ topic の値が、1 本の線としてつながっていく
🔧 2. サンプルフロー
📌 複数のフローを読み込むとき: このサイトの Dashboard 2.0 のフロー(サンプルフローと演習の解答例)は、すべて同じダッシュボード設定ノード(ui-base)を共有しています。2つ目以降のフローを読み込むと、「読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。」という通知が出ます。「コピーを読み込み」 を選んでください。共有している設定ノードは既にあるものが使われ、どのフローのページも1つのダッシュボードにまとまります。ページはダッシュボードの左のメニューから選べます。ダッシュボード全体の見た目(ヘッダーやメニューの表示)は、最初に読み込んだフローの ui-base の設定になります。
ページが表示されないとき: ダッシュボードの設定ノード(ui-base)が2つ以上あると、そのうち1つのページしか表示されません。このサイトの以前の版のフローを読み込んでいると、この状態になります。以前の版のフローのタブを削除してから、エディタの メニュー → 設定ノード を開き、画面上部の「未使用」を選んで、どのノードからも使われていない ui-group・ui-page・ui-base・ui-theme を削除します。ui-group を消すとそれを使っていた ui-page が、ui-page を消すと ui-base が未使用になるので、未使用のものが無くなるまで繰り返してください。そのあとで、フローを読み込み直します。
📥 サンプルフローを試す手順:
下のフローJSONを「コピー」ボタンでコピー
Node-REDエディタで メニュー → 読み込み を選択
JSONをペーストして「読み込み」をクリック
エディタ右上の「デプロイ」ボタンをクリック (クリックするまでフローは動きません)
ブラウザでダッシュボード(http://localhost:1880/dashboard)を開き、左のメニューからページを選んで動作を確認
公式サンプルフロー
最初のサンプルフローは、Dashboard 2.0 の開発元である FlowFuse が公開している公式サンプルを、1つのタブにまとめたものです。出典は次の2か所です。
ノードの設定値とノードIDは公式のままです。このサイトで手を加えたのは次の点だけです。
1つのタブにまとめ、例が重ならないよう位置をずらし、例の名前を書いたコメントノードを置いた
GitHub examples はグループ(ui-group)が空のままで、読み込んでもダッシュボードに表示されない。そこで「GitHub Examples(可視化系)」ページ(/flowfuse-examples-visualization)と例ごとのグループを用意し、各ウィジェットに割り当てた
同じ設定ノード(ui-base など)が例ごとに少しずつ違う値で入っていたため、1つにそろえた
例(出典・表示されるページ)
内容
chart-line-multiple 公式ドキュメント(ui-chart)/dashboard/charts
「Sample Data A」「Sample Data B」の Inject が、propertyA と propertyB を持つオブジェクトの配列を送ります。chart は propertyA を x 軸、propertyB を y 軸にとり、msg.topic ごとに別の線で描きます。「Clear Chart」は空の配列を送って、グラフを消します。
chart-bar-finance-grouped 公式ドキュメント(ui-chart)/dashboard/charts
年ごとの四半期の値({"year":2021,"Q1":115,...})を送り、年を x 軸にして、Q1〜Q4 の棒を並べます。系列(Q1〜Q4)は chart の設定に JSON で書いてあり、1つのオブジェクトの複数のキーを、それぞれ別の棒にする例です。
chart-pie-doughnut 公式ドキュメント(ui-chart)/dashboard/charts
年・四半期・収益のデータを、ドーナツグラフと円グラフで表示します。どちらも年ごとに輪を分け、四半期を区分、収益を大きさにしています。ドーナツ側の「Finance Data」は2021年と2022年の8件を送るので輪が2つ、円グラフ側は2021年の4件だけなので輪が1つになります。名前の無い Inject は空の配列を送って、グラフを消します。
chart-scatter-grouped 公式ドキュメント(ui-chart)/dashboard/charts
series・x・y を持つ点の配列を送り、series(A・B・C)ごとに色を分けた散布図を描きます。
ui-table-cell-types 公式ドキュメント(ui-table)/dashboard/table
デプロイすると Inject が自動で1回動き、表に2行のデータを送ります(Inject のボタンで送り直せます)。列ごとに表示形式(リンク、プログレスバー、折れ線・棒の小さなグラフ、チェック/バツ、色の点、日時など)を変えた例です。
guage GitHub examples/dashboard/flowfuse-examples-visualization
Inject のボタンを押すと、数値 72 をゲージに送ります。ゲージは 0〜100(単位 °F)の針の形で、値の範囲ごとに色を変えています。例の名前の綴り(guage)は公式のファイル名のままです。
progress の公式サンプルはありません。progress は、次の応用フローで扱います。
📥 可視化系 公式サンプルフローJSON(クリックで展開)
[
{
"id": "dash2_visualization_official_tab",
"type": "tab",
"label": "可視化系 公式サンプル",
"disabled": false,
"info": "",
"env": []
},
{
"id": "cmt_dash2_visualization_official_chart_line_multiple",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "chart-line-multiple(公式ドキュメント ui-chart)",
"info": "",
"x": 320,
"y": 60,
"wires": []
},
{
"id": "eed78059233cb876",
"type": "ui-chart",
"z": "dash2_visualization_official_tab",
"group": "b429518aee48a6fb",
"name": "Array Line Chart",
"label": "chart",
"order": 1,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisLabel": "Property A",
"xAxisProperty": "propertyA",
"xAxisPropertyType": "property",
"xAxisType": "linear",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisLabel": "Property B",
"yAxisProperty": "propertyB",
"ymin": "0",
"ymax": "10",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": [
"#1f77b4",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": 6,
"height": 8,
"className": "",
"x": 400,
"y": 150,
"wires": [
[]
]
},
{
"id": "b21df8b397cb3233",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Clear Chart",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 210,
"y": 110,
"wires": [
[
"eed78059233cb876"
]
]
},
{
"id": "3493e8d72fbfa5a9",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Sample Data A",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "Sample Data A",
"payload": "[{\"propertyA\":10,\"propertyB\":2},{\"propertyA\":15,\"propertyB\":3},{\"propertyA\":25,\"propertyB\":5},{\"propertyA\":30,\"propertyB\":6},{\"propertyA\":40,\"propertyB\":8}]",
"payloadType": "json",
"x": 200,
"y": 150,
"wires": [
[
"eed78059233cb876"
]
]
},
{
"id": "3d24d72914056683",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Sample Data B",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "Sample Data B",
"payload": "[{\"propertyA\":7,\"propertyB\":6},{\"propertyA\":15,\"propertyB\":2},{\"propertyA\":24,\"propertyB\":9},{\"propertyA\":32,\"propertyB\":4},{\"propertyA\":47,\"propertyB\":9}]",
"payloadType": "json",
"x": 200,
"y": 190,
"wires": [
[
"eed78059233cb876"
]
]
},
{
"id": "cmt_dash2_visualization_official_chart_bar_finance_grouped",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "chart-bar-finance-grouped(公式ドキュメント ui-chart)",
"info": "",
"x": 320,
"y": 270,
"wires": []
},
{
"id": "48f2d5b3e40cb944",
"type": "ui-chart",
"z": "dash2_visualization_official_tab",
"group": "b429518aee48a6fb",
"name": "Chart: Finance",
"label": "Finance Data",
"order": 1,
"chartType": "bar",
"category": "[\"Q1\", \"Q2\", \"Q3\", \"Q4\"]",
"categoryType": "json",
"xAxisLabel": "Year",
"xAxisProperty": "year",
"xAxisPropertyType": "property",
"xAxisType": "category",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisLabel": "Profit",
"yAxisProperty": "radius",
"ymin": "",
"ymax": "",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": [
"#0095ff",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": 6,
"height": 8,
"className": "",
"x": 390,
"y": 320,
"wires": [
[]
]
},
{
"id": "3ccddcc77ed44e81",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Finance Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"year\":2021,\"Q1\":115,\"Q2\":207,\"Q3\":198,\"Q4\":163},{\"year\":2022,\"Q1\":170,\"Q2\":200,\"Q3\":230,\"Q4\":210},{\"year\":2023,\"Q1\":86,\"Q2\":140,\"Q3\":180,\"Q4\":138}]",
"payloadType": "json",
"x": 200,
"y": 320,
"wires": [
[
"48f2d5b3e40cb944"
]
]
},
{
"id": "8df4587f825276eb",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Clear Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 210,
"y": 360,
"wires": [
[
"48f2d5b3e40cb944"
]
]
},
{
"id": "cmt_dash2_visualization_official_chart_pie_doughnut",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "chart-pie-doughnut(公式ドキュメント ui-chart)",
"info": "",
"x": 320,
"y": 440,
"wires": []
},
{
"id": "bc346c7d325fe6b5",
"type": "ui-chart",
"z": "dash2_visualization_official_tab",
"group": "e0d7a0182b3c8eb7",
"name": "Doughnut Chart",
"label": "Doughnut Chart",
"order": 5,
"chartType": "doughnut",
"category": "year",
"categoryType": "property",
"xAxisLabel": "",
"xAxisProperty": "quarter",
"xAxisPropertyType": "property",
"xAxisType": "radial",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisLabel": "",
"yAxisProperty": "earnings",
"ymin": "",
"ymax": "",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": [
"#0095ff",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": "3",
"height": "6",
"className": "",
"x": 410,
"y": 490,
"wires": [
[]
]
},
{
"id": "c8e227dc6c78b5f2",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Finance Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"year\":2021,\"quarter\":\"Q1\",\"earnings\":115},{\"year\":2021,\"quarter\":\"Q2\",\"earnings\":120},{\"year\":2021,\"quarter\":\"Q3\",\"earnings\":100},{\"year\":2021,\"quarter\":\"Q4\",\"earnings\":180},{\"year\":2022,\"quarter\":\"Q1\",\"earnings\":142},{\"year\":2022,\"quarter\":\"Q2\",\"earnings\":106},{\"year\":2022,\"quarter\":\"Q3\",\"earnings\":164},{\"year\":2022,\"quarter\":\"Q4\",\"earnings\":172}]",
"payloadType": "json",
"x": 200,
"y": 490,
"wires": [
[
"bc346c7d325fe6b5"
]
]
},
{
"id": "2413205ce1f39442",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 220,
"y": 530,
"wires": [
[
"bc346c7d325fe6b5"
]
]
},
{
"id": "b87fe3201b219a05",
"type": "ui-chart",
"z": "dash2_visualization_official_tab",
"group": "e0d7a0182b3c8eb7",
"name": "Pie Chart",
"label": "Pie Chart",
"order": 4,
"chartType": "pie",
"category": "year",
"categoryType": "property",
"xAxisLabel": "",
"xAxisProperty": "quarter",
"xAxisPropertyType": "property",
"xAxisType": "radial",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisLabel": "",
"yAxisProperty": "earnings",
"ymin": "",
"ymax": "",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": [
"#0095ff",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": "3",
"height": "6",
"className": "",
"x": 390,
"y": 590,
"wires": [
[]
]
},
{
"id": "d10804e8db462840",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Finance Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"year\":2021,\"quarter\":\"Q1\",\"earnings\":115},{\"year\":2021,\"quarter\":\"Q2\",\"earnings\":120},{\"year\":2021,\"quarter\":\"Q3\",\"earnings\":100},{\"year\":2021,\"quarter\":\"Q4\",\"earnings\":180}]",
"payloadType": "json",
"x": 200,
"y": 590,
"wires": [
[
"b87fe3201b219a05"
]
]
},
{
"id": "49dbac215fa8b40f",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 220,
"y": 630,
"wires": [
[
"b87fe3201b219a05"
]
]
},
{
"id": "cmt_dash2_visualization_official_chart_scatter_grouped",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "chart-scatter-grouped(公式ドキュメント ui-chart)",
"info": "",
"x": 320,
"y": 710,
"wires": []
},
{
"id": "16c2839487757a01",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Scatter Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"series\":\"A\",\"x\":5,\"y\":84},{\"series\":\"A\",\"x\":9,\"y\":10},{\"series\":\"A\",\"x\":11,\"y\":70},{\"series\":\"B\",\"x\":12,\"y\":28},{\"series\":\"B\",\"x\":15,\"y\":35},{\"series\":\"B\",\"x\":26,\"y\":42},{\"series\":\"C\",\"x\":20,\"y\":12},{\"series\":\"C\",\"x\":24,\"y\":54},{\"series\":\"C\",\"x\":27,\"y\":60},{\"series\":\"C\",\"x\":30,\"y\":66}]",
"payloadType": "json",
"x": 200,
"y": 760,
"wires": [
[
"d6ddc83bcd4de04a"
]
]
},
{
"id": "d6ddc83bcd4de04a",
"type": "ui-chart",
"z": "dash2_visualization_official_tab",
"group": "b429518aee48a6fb",
"name": "Chart: Scatter",
"label": "Scatter Plot Example",
"order": 1,
"chartType": "scatter",
"category": "series",
"categoryType": "property",
"xAxisLabel": "x",
"xAxisProperty": "x",
"xAxisPropertyType": "property",
"xAxisType": "linear",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisLabel": "y",
"yAxisProperty": "y",
"ymin": "0",
"ymax": "100",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": [
"#0095ff",
"#ff0000",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true,
"width": 6,
"height": 8,
"className": "",
"x": 410,
"y": 760,
"wires": [
[]
]
},
{
"id": "aa0ac5025fc32d7f",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "Clear Data",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 210,
"y": 800,
"wires": [
[
"d6ddc83bcd4de04a"
]
]
},
{
"id": "cmt_dash2_visualization_official_ui_table_cell_types",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "ui-table-cell-types(公式ドキュメント ui-table)",
"info": "",
"x": 320,
"y": 880,
"wires": []
},
{
"id": "78b43be39f6db8e1",
"type": "ui-table",
"z": "dash2_visualization_official_tab",
"group": "5c66023267e5559e",
"name": "",
"label": "text",
"order": 3,
"width": 0,
"height": 0,
"maxrows": "0",
"autocols": false,
"showSearch": false,
"selectionType": "none",
"columns": [
{
"title": "My Column",
"key": "columnA",
"type": "text",
"width": "",
"align": "start"
},
{
"title": "My Other Column",
"key": "columnB",
"type": "text",
"width": "",
"align": "start"
},
{
"title": "URL",
"key": "link",
"type": "link",
"width": "300px",
"align": "start"
},
{
"title": "Progress",
"key": "progress",
"type": "progress",
"width": "",
"align": "start"
},
{
"title": "Row",
"key": "",
"type": "row",
"width": "",
"align": "start"
},
{
"title": "Trend",
"key": "array",
"type": "sparkline-trend",
"width": "",
"align": "start"
},
{
"title": "Bar",
"key": "array",
"type": "sparkline-bar",
"width": "",
"align": "start"
},
{
"title": "Tick/Cross",
"key": "boolean",
"type": "tickcross",
"width": "",
"align": "start"
},
{
"title": "Spot",
"key": "color",
"type": "color",
"width": "",
"align": "center"
},
{
"title": "Date & Time",
"key": "timestamp",
"type": "datetime",
"width": "",
"align": "start"
}
],
"x": 340,
"y": 930,
"wires": [
[]
]
},
{
"id": "6cdf36ffe9daf59c",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"columnA\":\"Hello\",\"columnB\":\"World\",\"link\":\"https://news.bbc.co.uk\",\"progress\":76,\"color\":\"#FF0000\",\"array\":[6,7,9,2,4],\"boolean\":true,\"timestamp\":1710484200000},{\"columnA\":\"Hey\",\"columnB\":\"Globe\",\"link\":\"https://flowfuse.com\",\"progress\":56,\"color\":\"#24aa69\",\"array\":[1,3,6,3,5],\"boolean\":false,\"timestamp\":1735689540000}]",
"payloadType": "json",
"x": 200,
"y": 930,
"wires": [
[
"78b43be39f6db8e1"
]
]
},
{
"id": "cmt_dash2_visualization_official_guage",
"type": "comment",
"z": "dash2_visualization_official_tab",
"name": "guage(GitHub examples)",
"info": "",
"x": 320,
"y": 1010,
"wires": []
},
{
"id": "d0c36237eeebb6d5",
"type": "inject",
"z": "dash2_visualization_official_tab",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "72",
"payloadType": "num",
"x": 200,
"y": 1060,
"wires": [
[
"130fa4d5c69fd905"
]
]
},
{
"id": "130fa4d5c69fd905",
"type": "ui-gauge",
"z": "dash2_visualization_official_tab",
"name": "Temperature",
"group": "dash2_visualization_gh_grp_guage",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gauge-34",
"gstyle": "needle",
"title": "gauge",
"units": "°F",
"prefix": "",
"suffix": "",
"segments": [
{
"from": "0",
"color": "#3d10e0"
},
{
"from": "65",
"color": "#00ff4c"
},
{
"from": "73",
"color": "#ea5353"
}
],
"min": "0",
"max": "100",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"styleRounded": true,
"styleGlow": false,
"className": "",
"floatingTitlePosition": "top-left",
"x": 360,
"y": 1060,
"wires": []
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": [
"ui-control",
"ui-notification",
"ui-text",
"ui-template"
],
"showPathInSidebar": false,
"headerContent": "none",
"navigationStyle": "default",
"titleBarStyle": "default"
},
{
"id": "5075a7d8e4947586",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094CE",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
},
{
"id": "c2ff5ba1f92a0f0e",
"type": "ui-theme",
"name": "Default",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
},
{
"id": "afa24cae12543ca5",
"type": "ui-theme",
"name": "Example Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#fafdff",
"groupOutline": "#000000"
},
"sizes": {
"groupGap": "12px",
"widgetGap": "12px",
"pagePadding": "12px",
"groupBorderRadius": "0px",
"density": "default"
}
},
{
"id": "d0621b8f20aee671",
"type": "ui-page",
"name": "Charts",
"ui": "c2e1aa56f50f03bd",
"path": "/charts",
"icon": "home",
"layout": "notebook",
"theme": "5075a7d8e4947586",
"order": 27,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "bbc7b44a426b2b01",
"type": "ui-page",
"name": "UI Table Example",
"ui": "c2e1aa56f50f03bd",
"path": "/table",
"icon": "table",
"layout": "grid",
"theme": "c2ff5ba1f92a0f0e",
"order": 11,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "dash2_visualization_gh_page",
"type": "ui-page",
"name": "GitHub Examples(可視化系)",
"ui": "c2e1aa56f50f03bd",
"path": "/flowfuse-examples-visualization",
"icon": "github",
"layout": "grid",
"theme": "afa24cae12543ca5",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "3"
},
{
"name": "Tablet",
"px": "576",
"cols": "6"
},
{
"name": "Small Desktop",
"px": "768",
"cols": "9"
},
{
"name": "Desktop",
"px": "1024",
"cols": "12"
}
],
"order": 30,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "b429518aee48a6fb",
"type": "ui-group",
"name": "Chart Examples",
"page": "d0621b8f20aee671",
"width": "6",
"height": "1",
"order": 4,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "e0d7a0182b3c8eb7",
"type": "ui-group",
"name": "PIe Charts",
"page": "d0621b8f20aee671",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "5c66023267e5559e",
"type": "ui-group",
"name": "Table Cell Types",
"page": "bbc7b44a426b2b01",
"width": "12",
"height": "1",
"order": 3,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "dash2_visualization_gh_grp_guage",
"type": "ui-group",
"name": "guage",
"page": "dash2_visualization_gh_page",
"width": "6",
"height": "1",
"order": 6,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
}
]
応用(サイト独自): 全パターンのサンプル
ここから先は公式サンプルではなく、本サイトが用意した応用教材 です。このガイドで説明する chart・gauge・table・progress の使い方を、1つのタブにまとめています。ダッシュボードでは /dashboard/visualization に表示されます。3章以降の説明は、このフローを例に進めます。
Inject
→
データ生成
→
chart
slider
→
gauge
📋 応用フローJSON(クリックで展開)
[
{
"id": "viz_tab",
"type": "tab",
"label": "データ可視化サンプル",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "viz_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "viz_ui_page",
"type": "ui-page",
"name": "データ可視化",
"ui": "c2e1aa56f50f03bd",
"path": "/visualization",
"icon": "mdi-chart-line",
"layout": "grid",
"theme": "viz_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "viz_group_chart",
"type": "ui-group",
"name": "📈 チャート",
"page": "viz_ui_page",
"width": "6",
"height": "10",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "viz_group_gauge",
"type": "ui-group",
"name": "🎯 ゲージ",
"page": "viz_ui_page",
"width": "6",
"height": "10",
"order": 2,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "viz_group_table",
"type": "ui-group",
"name": "📋 テーブル",
"page": "viz_ui_page",
"width": "6",
"height": "6",
"order": 3,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "viz_group_progress",
"type": "ui-group",
"name": "📊 プログレス",
"page": "viz_ui_page",
"width": "6",
"height": "4",
"order": 4,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "viz_inject_chart",
"type": "inject",
"z": "viz_tab",
"name": "Chart: 5秒毎",
"props": [
{"p": "payload"},
{"p": "topic", "vt": "str"}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": "0.1",
"topic": "センサーA",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 60,
"wires": [["viz_change_chart"]]
},
{
"id": "viz_change_chart",
"type": "change",
"z": "viz_tab",
"name": "パターン1: シンプル数値",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 100)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 60,
"wires": [["viz_chart_line"]]
},
{
"id": "viz_inject_chart_obj",
"type": "inject",
"z": "viz_tab",
"name": "Chart: オブジェクト形式",
"props": [
{"p": "payload"},
{"p": "topic", "vt": "str"}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": "0.5",
"topic": "センサーB",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 120,
"wires": [["viz_change_chart_obj"]]
},
{
"id": "viz_change_chart_obj",
"type": "change",
"z": "viz_tab",
"name": "パターン2: オブジェクト形式",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"time\": $millis(), \"value\": $floor($random() * 100)}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 420,
"y": 120,
"wires": [["viz_chart_obj"]]
},
{
"id": "viz_chart_obj",
"type": "ui-chart",
"z": "viz_tab",
"group": "viz_group_chart",
"name": "オブジェクト形式チャート",
"label": "オブジェクト形式",
"order": 2,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisLabel": "",
"xAxisProperty": "time",
"xAxisPropertyType": "property",
"xAxisType": "time",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"xmin": "",
"xmax": "",
"yAxisLabel": "",
"yAxisProperty": "value",
"yAxisPropertyType": "property",
"ymin": "",
"ymax": "",
"bins": "",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": ["#2196f3", "#b92d5d", "#4caf50", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "6",
"height": "4",
"className": "",
"interpolation": "linear",
"x": 640,
"y": 120,
"wires": [[]]
},
{
"id": "viz_inject_chart_arr",
"type": "inject",
"z": "viz_tab",
"name": "Chart: 配列形式",
"props": [
{"p": "payload"}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "1",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 180,
"wires": [["viz_change_chart_arr"]]
},
{
"id": "viz_change_chart_arr",
"type": "change",
"z": "viz_tab",
"name": "パターン3: 配列形式",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\"1月\", \"2月\", \"3月\", \"4月\"].{\"category\": $, \"sales\": $floor($random() * 100 + 50)}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 390,
"y": 180,
"wires": [["viz_chart_bar"]]
},
{
"id": "viz_chart_bar",
"type": "ui-chart",
"z": "viz_tab",
"group": "viz_group_chart",
"name": "配列形式棒グラフ",
"label": "月別売上",
"order": 3,
"chartType": "bar",
"category": "category",
"categoryType": "property",
"xAxisLabel": "",
"xAxisProperty": "category",
"xAxisPropertyType": "property",
"xAxisType": "category",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"xmin": "",
"xmax": "",
"yAxisLabel": "",
"yAxisProperty": "sales",
"yAxisPropertyType": "property",
"ymin": "",
"ymax": "",
"bins": "",
"action": "replace",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": false,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": ["#4caf50", "#b92d5d", "#2196f3", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "6",
"height": "4",
"className": "",
"interpolation": "linear",
"x": 600,
"y": 180,
"wires": [[]]
},
{
"id": "viz_chart_line",
"type": "ui-chart",
"z": "viz_tab",
"group": "viz_group_chart",
"name": "温度チャート",
"label": "パターン1: シンプル数値",
"order": 1,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisLabel": "",
"xAxisProperty": "",
"xAxisPropertyType": "property",
"xAxisType": "time",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"xmin": "",
"xmax": "",
"yAxisLabel": "",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"ymin": "",
"ymax": "",
"bins": "",
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": ["#b92d5d", "#2196f3", "#4caf50", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "6",
"height": "4",
"className": "",
"interpolation": "linear",
"x": 560,
"y": 60,
"wires": [[]]
},
{
"id": "viz_inject_gauge",
"type": "inject",
"z": "viz_tab",
"name": "Gauge: 3秒毎",
"props": [
{"p": "payload"},
{"p": "topic", "vt": "str"}
],
"repeat": "3",
"crontab": "",
"once": true,
"onceDelay": "0.1",
"topic": "温度",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 280,
"wires": [["viz_change_gauge"]]
},
{
"id": "viz_change_gauge",
"type": "change",
"z": "viz_tab",
"name": "ランダム温度生成",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 100)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 370,
"y": 280,
"wires": [["viz_gauge_34"]]
},
{
"id": "viz_gauge_34",
"type": "ui-gauge",
"z": "viz_tab",
"name": "温度ゲージ",
"group": "viz_group_gauge",
"order": 1,
"value": "payload",
"valueType": "msg",
"width": "6",
"height": "4",
"gtype": "gauge-half",
"gstyle": "rounded",
"title": "現在温度",
"alwaysShowTitle": false,
"units": "°C",
"icon": "mdi-thermometer",
"prefix": "",
"suffix": "",
"segments": [
{"from": "0", "color": "#2196f3", "text": "", "textType": "label"},
{"from": "30", "color": "#4caf50", "text": "", "textType": "label"},
{"from": "60", "color": "#ff9800", "text": "", "textType": "label"},
{"from": "80", "color": "#f44336", "text": "", "textType": "label"}
],
"min": 0,
"max": 100,
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"className": "",
"floatingTitlePosition": "top-left",
"x": 560,
"y": 280,
"wires": [[]]
},
{
"id": "viz_inject_table",
"type": "inject",
"z": "viz_tab",
"name": "テーブルデータ",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "1",
"topic": "",
"payload": "[{\"id\":1,\"name\":\"センサーA\",\"value\":25.5,\"status\":\"正常\"},{\"id\":2,\"name\":\"センサーB\",\"value\":30.2,\"status\":\"正常\"},{\"id\":3,\"name\":\"センサーC\",\"value\":45.8,\"status\":\"警告\"},{\"id\":4,\"name\":\"センサーD\",\"value\":18.3,\"status\":\"正常\"}]",
"payloadType": "json",
"x": 140,
"y": 340,
"wires": [["viz_table"]]
},
{
"id": "viz_table",
"type": "ui-table",
"z": "viz_tab",
"group": "viz_group_table",
"name": "センサー一覧",
"label": "センサーデータ",
"order": 1,
"width": "0",
"height": "0",
"maxrows": 10,
"autocols": true,
"showSearch": true,
"deselect": true,
"selectionType": "none",
"columns": [],
"mobileBreakpoint": "sm",
"mobileBreakpointType": "defaults",
"action": "replace",
"className": "",
"x": 350,
"y": 340,
"wires": [[]]
},
{
"id": "viz_slider_progress",
"type": "ui-slider",
"z": "viz_tab",
"group": "viz_group_progress",
"name": "進捗スライダー",
"label": "進捗率",
"order": 1,
"width": "0",
"height": "0",
"outs": "all",
"topic": "",
"topicType": "str",
"min": 0,
"max": 100,
"step": 1,
"className": "",
"thumbLabel": true,
"x": 140,
"y": 400,
"wires": [["viz_progress"]]
},
{
"id": "viz_progress",
"type": "ui-progress",
"z": "viz_tab",
"group": "viz_group_progress",
"name": "処理進捗",
"order": 2,
"width": "0",
"height": "0",
"color": "#b92d5d",
"className": "",
"x": 340,
"y": 400,
"wires": []
}
]
📈 3. chart(チャート)
🔹 対応チャートタイプ
📈
Line(折れ線)
時系列データの推移表示に最適
⚬
Scatter(散布図)
2変数の相関分析に最適
🥧
Pie/Doughnut(円)
構成比の表示に最適
🔹 主要プロパティ
chart はエディターが部分的に日本語化されている(ui_chart の ja ロケールあり)。ja 翻訳のあるキーは日本語表示、無いキー(Area/Pie/Doughnut/Histogram、Interpolation、Stack Series、X/Y Format・Label、Text/Grid Color 等)は英語表示なので「英語ラベル(日本語訳)」で示す。エディターのセクション(先頭/Chart Configuration/Axis Configuration/Styling・Colors)ごとに分けて解説する。グラフの種類によって表示される項目は変わる。
先頭の共通項目
設定項目 説明 デフォルト
名前 フローエディター上でノードを識別する管理名。 (空)
グループ チャートを配置するダッシュボードのグループ。 (必須)
Size (サイズ)グループ内で占める幅と高さ。0 で自動。 6×8
ラベル チャート上部に表示するタイトル。 (空)
クラス 任意の CSS クラス名。 (空)
Chart Configuration(グラフ設定)
設定項目 説明 デフォルト
種類 グラフの種類。折れ線グラフ(line)/Area(面)/棒グラフ(bar)/散布図(scatter)/Pie(円)/Doughnut(ドーナツ)/Histogram(ヒストグラム)。選んだ種類で以降の項目が変わる。 折れ線グラフ
凡例を表示 系列の凡例を表示するか。 オフ
Interpolation (補間方法)折れ線・面で点と点の間をどう結ぶか。Linear(直線)/Step(階段)/Smooth(滑らか)。 Linear
Stack Series (系列の積み上げ)棒・面グラフで系列を積み上げ表示するか。 しない
動作 新しいデータの扱い。追加(append)/置換(replace)。実行時に msg でも切り替えられる。 追加
点の様式 / 形 / 半径 (px) データ点を表示するか、その形(円・四角・三角など)と半径。 円 / 4
Axis Configuration(軸設定)
設定項目 説明 デフォルト
X-軸の種類 X 軸の種類。時間軸(timescale)/数値軸(linear)/分類軸(categorical)。 時間軸
X Format (X軸の表示形式)時間軸ラベルの表示フォーマット(日時の書式)。 (自動)
X Label (X軸ラベル)X 軸に添える名称。 (空)
X-Axis (X軸の範囲)最小(min)・最大(max)と、ヒストグラムの Bins(ビン数)。 (自動)/ Bins 10
X-軸の上限 表示するデータ量の上限。直近〇秒/分/時間/日/週、または〇点までで切る。 (無制限)
Y Label (Y軸ラベル)Y 軸に添える名称。 (空)
Y-軸 (Y軸の範囲)最小(min)・最大(max)の表示範囲。 (自動)
プロパティ プロットするデータの場所を指定する。系列(series)のキー、X 軸・Y 軸に使うプロパティ(既定の Y は payload)。 系列 topic / Y payload
Styling/Colors(配色・スタイル)
設定項目 説明 デフォルト
配色 系列ごとの色の並び。 (既定パレット)
Text Color (文字色)軸ラベルなどの文字色。「Set text color to default」を有効にするとテーマ既定色を使う。 既定色を使用
Grid Color (グリッド色)グリッド線の色。「Set grid color to default」を有効にするとテーマ既定色を使う。 既定色を使用
🔹 入力データ形式
パターン1: シンプルな数値(時系列自動)
用途: 数値1つの送信による時系列グラフの描画
X軸のタイプが「Timescale」で、X値を指定しない場合、現在時刻が自動的に使用されます。
パターン2: オブジェクト形式
用途: 横軸の値や系列名を指定した描画
パターン3: 配列形式(一括データ)
用途: 過去分をまとめて渡すグラフの一括描画
🔹 補間方法(Interpolation)
折れ線グラフでポイント間をどう描画するかを選択できます:
Linear - 直線で接続(デフォルト)
Step - 階段状に接続(ON/OFF状態の表示に最適)
Bezier - 滑らかな曲線で接続
Cubic - より滑らかな曲線
Cubic-Mono - オーバーシュートしない滑らかな曲線
🔹 タイムスタンプのフォーマット
フォーマット
表示例
{HH}:{mm}:{ss}
12:30:45
{HH}:{mm}
12:30
{yyyy}-{M}-{d}
2024-12-25
{d}/{M}
25/12
{ee} {HH}:{mm}
Wed 12:30
🔹 チャートのクリア
💡 ヒント: チャートの全データをクリアするには、msg.payload = [](空配列)を送信します。
button
→
chart
🔹 既知の不具合・制限事項
⚠️ ui-chart には以下の既知の不具合・注意点が報告されています (Dashboard 2.0、eCharts ベース)。
長時間稼働や複雑な構成で利用する場合は、特に下表のワークアラウンドを設計に取り入れてください。
確認時点: 2026-09-12、@flowfuse/node-red-dashboard 1.31.0 のソースで確認しました。「Dashboard 2.0」は製品名で、パッケージのバージョンは 1.x です(2.x というバージョンは存在しません)。
バージョンによる違い: ui-chart の描画エンジンは 1.27.0(2025-09-10)で Chart.js から eCharts へ変わりました 。1.26.x 以前を使っている場合、下表のうち eCharts 固有の記述(formatter など)は当てはまりません。
分類
現象
影響
暫定対策
複数系列
複数 series を含むリアルタイム payload を順次送ると、ブラウザ更新やページ切替後にチャート内容が消える。
監視画面・時系列表示で、リロード後に履歴表示が空になる。
更新・ページ切替後に過去データを再送する設計、または一時的に series ごとにメッセージを分割。
動的オプション
毎サンプルごとに msg.ui_update.chartOptions を送ると、そのたびに全オプションの再マージと setOption() の再適用が走る。
送信頻度に比例して CPU 使用率が増え、画面が遅延する。
chartOptions は毎回送らず、初期化時・変更時のみ送る。必要に応じて throttle / rate limit を入れる。
series オプション
msg.ui_update.chartOptions.series の設定がページ更新で永続しない。データ到着前や非表示ページのチャートに送ると反映されないことがある。
線色・系列別設定が意図どおり残らない。
データ投入後に series オプションを再送する。series には name と type を必ず明示する。
legend
必要な series / value キーを持たないデータが混じると、凡例に undefined が表示される。
凡例が汚れる。不要データが内部で保持・再送される可能性。
chart ノードへ送る前に switch ノードで、必要なキーを持つデータだけを通す(条件「キーを含む」で series や value を指定)。
X 軸
棒グラフなどで重複する X ラベルを使うと、後続データが前のデータを上書きするように見える。
「今日 00–23時」「明日 00–23時」のような重複ラベル表示で不都合。
内部 X 値は一意にし、表示ラベルだけ短縮する。eCharts の formatter を活用。
極端な数値
Number.MAX_VALUE や極端値を含むと Y 軸の自動スケールで描画不能となり、タブクラッシュに至るケースもある。
センサー異常値や桁あふれで画面が壊れる可能性。
chart 投入前に値を検証し、上限・下限でクリップ。異常値は別表示にする。
大量 series
非表示の系列が多数あっても更新処理が走り、描画・操作が重くなる。
多数系列の監視画面でブラウザが固まる。
非表示系列は chart data から外す、表示系列数を制限、サーバ側で間引きを行う。
💡 設計時のチェックリスト:
msg.ui_update.chartOptions は変更時だけ送る(毎サンプル送らない)
chart ノード前で 必ず 入力データを検証し、series / x / y が欠けたデータを除外する
長期稼働の監視画面では、ブラウザ更新・ページ切替・再接続時の再描画テストを必ず実施する
X 軸ラベルは内部値を一意にし、表示用フォーマットを別途指定する
💊 まず試したい応急処置:「Clear Chart History」ボタン
上記のような不具合(凡例に undefined が残る、過去データが壊れている、
複数系列の表示が崩れているなど)が発生した場合、
chart ノードの編集ダイアログ左上にある「Clear Chart History」ボタン
を押すと、内部に蓄積された履歴データがクリアされて表示が正常に戻るケースがあります。
根本解決ではありませんが、配信中のダッシュボードを止めずに復旧したい場合に有効です。
▲ chart ノードの編集ダイアログ。左上の「Clear Chart History」ボタンで履歴をクリアできる。
💡 「Clear Chart History」の使いどころ:
凡例に undefined が出てしまった後、入力データ側を修正したのに表示が戻らない
テスト中に投入した不正データが残っていて、本番データの表示を邪魔している
series 設定変更後に古い系列が残ってしまっている
長時間稼働で動作が重くなってきた場合の暫定リセット
押下後は 「完了」ボタンを押してデプロイ することで反映されます。
クリア後にまた症状が再発する場合は、入力データ側のフィルタリングや
chartOptions の送信頻度などを併せて見直してください。
最新の不具合情報・修正状況は
FlowFuse Dashboard の GitHub Issues
を参照してください。
🎯 4. gauge(ゲージ)
🔹 ゲージタイプ
🔹 主要プロパティ
gauge ウィジェットは ja ロケールがなく英語表示(「英語ラベル(日本語訳)」で示す)。エディターのセクション(先頭/Value/Limits/Labelling/Sizes/Styling)ごとに分ける。ゲージの種類(Type)によって表示される項目は変わる。
先頭の共通項目
設定項目 説明 デフォルト
Name (名前)フローエディター上でノードを識別する管理名。 (空)
Group (グループ)配置するダッシュボードのグループ。 (必須)
Size (サイズ)グループ内で占める幅と高さ。0 で自動。 自動
Type (ゲージの種類)Tile(タイル)/3/4 Gauge(3/4 円)/Half Gauge(半円)/Battery Level(電池)/Tank Level(タンク)。 Tile
Style (針の様式)Needle(針)/Rounded(丸)。一部の Type でのみ表示。 Needle
Value(値)
設定項目 説明 デフォルト
Value (値)ゲージが表示する値のプロパティ。右の型セレクタ(typedInput)で型を選ぶ。 msg.payload
Limits(範囲とセグメント)
設定項目 説明 デフォルト
Range (範囲)min.(最小値)と max.(最大値)。 0 / 100
Segments (セグメント)from(しきい値)と色のリストでゲージを色分けする。「Defaults」ボタンで既定の3色を入れられる。 (既定3色)
Labelling(ラベル表示)
設定項目 説明 デフォルト
Label (ラベル)ゲージに添える名称(内部プロパティ title)。 (空)
Always Show Label (ラベルを常に表示)Tile 種類で、ラベルを常に表示するか。表示位置(Top Left/Top Right/Bottom Left/Bottom Right)も選ぶ。 オフ
Prefix (接頭辞) / Suffix (接尾辞)値の前後に添える文字列。 (空)
Units (単位)値に添える単位(°C、% など)。 (空)
Icon (アイコン)表示する Material Design Icons。 (空)
Sizes(サイズ調整)
設定項目 説明 デフォルト
Gauge (ゲージバーの太さ)ゲージ本体の帯の太さ。 16
Gap (間隔)セグメント間のすき間。 4
Segments (凡例キーの太さ)セグメント凡例キーの太さ。 8
Styling(スタイル)
設定項目 説明 デフォルト
Class (クラス)任意の CSS クラス名。 (空)
🔹 セグメント(色分け)の設定
// セグメント設定例
[
{ "from": 0, "color": "#2196f3" }, // 青: 0-30
{ "from": 30, "color": "#4caf50" }, // 緑: 30-60
{ "from": 60, "color": "#ff9800" }, // オレンジ: 60-80
{ "from": 80, "color": "#f44336" } // 赤: 80-100
]
🔹 動的プロパティの更新
🔹 値のフォーマット(JSONata)
Valueプロパティで「JSONata」タイプを選択すると、値を加工して表示できます:
$round(payload, 1) // 小数点1桁に丸める
$round(payload, 0) // 整数に丸める
payload * 100 // パーセント変換
📋 5. table(テーブル)
🔹 基本的な使い方
データ
→
table
→
選択行
🔹 入力データ形式
🔹 主要プロパティ
table はエディターが部分的に日本語化されている(ui_table の ja ロケールあり)。名前・グループ・ラベル・クラス・上限の行数・列 は日本語、ja 翻訳のない Size・Action・Breakpoint・Interaction・Search・Deselect は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
設定項目 説明 デフォルト
名前 フローエディター上でノードを識別する管理名。 (空)
グループ テーブルを配置するダッシュボードのグループ。 (必須)
Size (サイズ)グループ内で占める幅と高さ。0 で自動。 自動
ラベル テーブル上部に表示するタイトル。 (空)
クラス 任意の CSS クラス名。 (空)
上限の行数 保持・表示する最大行数。超えた古い行は捨てる。 (無制限)
Action (動作)新しいデータの扱い。Append(追加)/Replace(置換)。 Append
Breakpoint (モバイル切替幅)この幅より狭いとモバイル向けレイアウトに切り替える。 (既定)
Interaction (行の操作)行をどう選べるか。None(なし)/Click(クリック)/Checkboxes(チェックボックス)。選ぶと行データを出力する。 None
Search (検索)「Show」を有効にすると、テーブル上に検索入力欄を表示する。 非表示
列 「列を自動判断(Auto Calculate Columns)」を有効にすると、データのキーから列を自動生成する。無効にすると下の列定義で手動指定する。 自動判断オン
Deselect (全行選択解除)テーブルが埋まったとき全行の選択を解除するか(Deselect all rows when the table is filled)。 オフ
列定義 (editableList)手動で列を定義するリスト。各列に キー・ラベル・Type(型)・Width(幅)・Align(寄せ)を設定する。 (なし)
🔹 列のカスタム定義
// Columnsプロパティの設定例
[
{ "key": "id", "label": "ID", "width": "60px" },
{ "key": "name", "label": "センサー名", "width": "150px" },
{ "key": "value", "label": "現在値", "width": "100px", "align": "right" },
{ "key": "status", "label": "状態", "width": "80px" }
]
🔹 行選択時の出力
📊 6. progress(プログレスバー)
🔹 基本的な使い方
進捗値
→
progress
🔹 主要プロパティ
progress ウィジェットは ja ロケールがなく、エディター表示は英語(「名前」は Node-RED 共通項目なので日本語)。英語項目は「英語ラベル(日本語訳)」で示す。表はエディターの上から下への並びに沿う。
設定項目 説明 デフォルト
名前 フローエディター上でノードを識別する管理名。 (空)
Group (グループ)配置するダッシュボードのグループ。 (必須)
Size (サイズ)グループ内で占める幅と高さ。0 で自動。 自動
Label (ラベル)プログレスバーに添える名称。 "Progress"
Color (色)バーの色。 (テーマ色)
Class (クラス)任意の CSS クラス名。 (空)
🔹 入力データ
msg.payload = 75; // 0-100の値
📝 7. 演習問題
📌 複数のフローを読み込むとき: このサイトの Dashboard 2.0 のフロー(サンプルフローと演習の解答例)は、すべて同じダッシュボード設定ノード(ui-base)を共有しています。2つ目以降のフローを読み込むと、「読み込もうとしているノードのいくつかは、既にワークスペース内に存在しています。」という通知が出ます。「コピーを読み込み」 を選んでください。共有している設定ノードは既にあるものが使われ、どのフローのページも1つのダッシュボードにまとまります。ページはダッシュボードの左のメニューから選べます。ダッシュボード全体の見た目(ヘッダーやメニューの表示)は、最初に読み込んだフローの ui-base の設定になります。
ページが表示されないとき: ダッシュボードの設定ノード(ui-base)が2つ以上あると、そのうち1つのページしか表示されません。このサイトの以前の版のフローを読み込んでいると、この状態になります。以前の版のフローのタブを削除してから、エディタの メニュー → 設定ノード を開き、画面上部の「未使用」を選んで、どのノードからも使われていない ui-group・ui-page・ui-base・ui-theme を削除します。ui-group を消すとそれを使っていた ui-page が、ui-page を消すと ui-base が未使用になるので、未使用のものが無くなるまで繰り返してください。そのあとで、フローを読み込み直します。
各ウィジェットごとに実践的な演習問題を用意しました。段階的に取り組んで、データ可視化の技術を身につけましょう。
💡 演習の進め方:
解答フローをインポートする前に、まず自分で作成してみましょう
解答フローには完全なダッシュボード構成が含まれているため、インポート後すぐにデプロイして動作確認できます
ヒントは「学習対象外のノード」は詳しく、「学習対象ノード」は最小限にしています
📈 chart ウィジェット演習
演習 C-1: シンプルな温度グラフ初級
📋 課題:
温度センサーの値をリアルタイムで折れ線グラフに表示するダッシュボードを作成してください。
💼 使いどころ: 測定値の変化を時間軸で追い、傾向を目で確かめる場面で使います。
🎯 要求仕様:
Injectノード: 2秒ごとにトリガー
Changeノード: 20〜40の範囲でランダムな温度値を生成
ui-chart: 折れ線グラフで温度推移を表示(過去60秒分)
💡 ヒント
Changeノードの設定: 「値の代入」のルールを2つ設定します。
msg.payload に「JSONata式」型の $floor($random() * 21) + 20
msg.topic に「文字列」型の 室温
$random() は 0 以上 1 未満の数を返します。21 を掛けて $floor で小数を切り捨てると 0〜20 の整数になり、20 を足すと 20〜40 になります。
ui-chartの設定:
種類: 折れ線グラフ(line)
X-軸の種類: 時間軸(timescale)
X-軸の上限: 直近1分
プロパティ → 系列: msg.topic
✅ 解答例フロー
[
{
"id": "d2viz_ex1_tab",
"type": "tab",
"label": "演習1: 温度モニター",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "d2viz_ex1_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "ex1_ui_page",
"type": "ui-page",
"name": "温度モニター",
"ui": "c2e1aa56f50f03bd",
"path": "/exercise1",
"icon": "mdi-thermometer",
"layout": "grid",
"theme": "d2viz_ex1_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "ex1_ui_group",
"type": "ui-group",
"name": "🌡️ 温度モニター",
"page": "ex1_ui_page",
"width": "6",
"height": "8",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "d2viz_ex1_inject",
"type": "inject",
"z": "d2viz_ex1_tab",
"name": "2秒毎",
"props": [{"p": "payload"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 100,
"wires": [["d2viz_ex1_change"]]
},
{
"id": "d2viz_ex1_change",
"type": "change",
"z": "d2viz_ex1_tab",
"name": "温度生成",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 20",
"tot": "jsonata"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "室温",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 280,
"y": 100,
"wires": [["ex1_chart"]]
},
{
"id": "ex1_chart",
"type": "ui-chart",
"z": "d2viz_ex1_tab",
"group": "ex1_ui_group",
"name": "温度推移",
"label": "温度推移",
"order": 1,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "msg",
"xAxisType": "time",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"action": "append",
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": ["#b92d5d"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "0",
"height": "0",
"className": "",
"x": 450,
"y": 80,
"wires": [[]]
}
]
演習 C-2: 複数センサー比較チャート中級
📋 課題:
3つのセンサーからのデータを1つのチャートで比較表示するダッシュボードを作成してください。
💼 使いどころ: 複数の測定点を同じグラフに重ね、値の差を見比べる場面で使います。
🎯 要求仕様:
3つのInjectノード: それぞれ異なるtopic(センサーA/B/C)を持つ
各センサーで異なる範囲のランダム値を生成(Changeノード)
ui-chart: 3つの折れ線を凡例付きで表示
クリアボタン: チャートをリセット
💡 ヒント
各Injectノードの設定:
センサーA: topic = "センサーA", 10-30の値
センサーB: topic = "センサーB", 20-40の値
センサーC: topic = "センサーC", 15-35の値
各Changeノードの設定: 「値の代入」で msg.payload に「JSONata式」型の式を設定します。
センサーA(10〜30): $floor($random() * 21) + 10
センサーB(20〜40): $floor($random() * 21) + 20
センサーC(15〜35): $floor($random() * 21) + 15
クリアボタン(ui-buttonまたはInject):
Payload: [] (空配列)
Payload Type: JSON
✅ 解答例フロー
[
{
"id": "d2viz_ex2_tab",
"type": "tab",
"label": "演習2: 複数センサー比較",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "d2viz_ex2_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "ex2_ui_page",
"type": "ui-page",
"name": "センサー比較",
"ui": "c2e1aa56f50f03bd",
"path": "/exercise2",
"icon": "mdi-chart-multiline",
"layout": "grid",
"theme": "d2viz_ex2_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "ex2_ui_group",
"type": "ui-group",
"name": "📈 センサー比較",
"page": "ex2_ui_page",
"width": "6",
"height": "6",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex2_inject_a",
"type": "inject",
"z": "d2viz_ex2_tab",
"name": "センサーA",
"props": [{"p": "payload"},{"p": "topic", "vt": "str"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "センサーA",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 80,
"wires": [["ex2_change_a"]]
},
{
"id": "ex2_inject_b",
"type": "inject",
"z": "d2viz_ex2_tab",
"name": "センサーB",
"props": [{"p": "payload"},{"p": "topic", "vt": "str"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.5,
"topic": "センサーB",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 140,
"wires": [["ex2_change_b"]]
},
{
"id": "ex2_inject_c",
"type": "inject",
"z": "d2viz_ex2_tab",
"name": "センサーC",
"props": [{"p": "payload"},{"p": "topic", "vt": "str"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 1,
"topic": "センサーC",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 200,
"wires": [["ex2_change_c"]]
},
{
"id": "ex2_change_a",
"type": "change",
"z": "d2viz_ex2_tab",
"name": "10-30",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 10",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 290,
"y": 80,
"wires": [["ex2_chart"]]
},
{
"id": "ex2_change_b",
"type": "change",
"z": "d2viz_ex2_tab",
"name": "20-40",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 20",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 290,
"y": 140,
"wires": [["ex2_chart"]]
},
{
"id": "ex2_change_c",
"type": "change",
"z": "d2viz_ex2_tab",
"name": "15-35",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 15",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 290,
"y": 200,
"wires": [["ex2_chart"]]
},
{
"id": "ex2_clear",
"type": "inject",
"z": "d2viz_ex2_tab",
"name": "クリア",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "[]",
"payloadType": "json",
"x": 130,
"y": 260,
"wires": [["ex2_chart"]]
},
{
"id": "ex2_chart",
"type": "ui-chart",
"z": "d2viz_ex2_tab",
"group": "ex2_ui_group",
"name": "センサー比較",
"label": "センサー比較チャート",
"order": 1,
"chartType": "line",
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "msg",
"xAxisType": "time",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"action": "append",
"pointShape": "circle",
"pointRadius": 4,
"showLegend": true,
"removeOlder": 1,
"removeOlderUnit": "3600",
"removeOlderPoints": "",
"colors": ["#b92d5d", "#2196f3", "#4caf50"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "0",
"height": "0",
"className": "",
"x": 470,
"y": 140,
"wires": [[]]
}
]
演習 C-3: カテゴリ別棒グラフとデータクリア上級
📋 課題:
月別の売上データを棒グラフで表示し、データの更新・クリア・アニメーションの切替えができるダッシュボードを作成してください。
💼 使いどころ: 月別などの区分ごとの数量を比較し、表示内容を入れ替える場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, ui-button, ui-chart
ui-chart: カテゴリ別(Categorical)の棒グラフで月別売上を表示
ui-button「データ更新」: クリックで新しいランダムデータを生成(replaceで置換)
ui-button「クリア」: 空配列を送信してチャートをリセット
💡 ヒント
Injectノードの設定:
起動時に1回だけ実行(once: true)
PayloadはChangeノードで作るため空でOK
Changeノード(データ生成): 「値の代入」で msg.payload に「JSONata式」型の次の式を設定します。
["1月", "2月", "3月", "4月", "5月", "6月"].{"x": $, "y": $floor($random() * 50 + 50)}
配列の後ろに .{ … } を書くと、配列の要素ごとに { … } のオブジェクトを作ります。$ はその要素("1月" など)を表すので、{"x": "1月", "y": 73} のようなオブジェクトが6個並んだ配列になります。
ui-button(クリア):
Payload: [](空配列)
Payload Type: JSON
ui-chartの設定:
種類: 棒グラフ(bar)
X-軸の種類: 分類軸(categorical)
プロパティ → X: "x"、Y: "y"
動作: 置換(replace)(データ更新時に置換)
✅ 解答例フロー
[
{
"id": "c3_tab",
"type": "tab",
"label": "演習 C-3: カテゴリ別棒グラフ",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "c3viz_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "c3viz_ui_page",
"type": "ui-page",
"name": "演習C-3",
"ui": "c2e1aa56f50f03bd",
"path": "/viz-c3",
"icon": "mdi-chart-bar",
"layout": "grid",
"theme": "c3viz_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "c3viz_ui_group",
"type": "ui-group",
"name": "月別売上",
"page": "c3viz_ui_page",
"width": "6",
"height": "10",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "c3_inject",
"type": "inject",
"z": "c3_tab",
"name": "初期データ",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 80,
"wires": [["c3_change_data"]]
},
{
"id": "c3_change_data",
"type": "change",
"z": "c3_tab",
"name": "売上データ生成",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\"].{\"x\": $, \"y\": $floor($random() * 50 + 50)}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 80,
"wires": [["c3_chart"]]
},
{
"id": "c3_btn_update",
"type": "ui-button",
"z": "c3_tab",
"group": "c3viz_ui_group",
"name": "データ更新",
"label": "🔄 データ更新",
"order": 1,
"width": "3",
"height": "1",
"emulateClick": false,
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "",
"payloadType": "date",
"topic": "update",
"topicType": "str",
"buttonColor": "",
"x": 130,
"y": 140,
"wires": [["c3_change_data"]]
},
{
"id": "c3_btn_clear",
"type": "ui-button",
"z": "c3_tab",
"group": "c3viz_ui_group",
"name": "クリア",
"label": "🗑️ クリア",
"order": 2,
"width": "3",
"height": "1",
"emulateClick": false,
"color": "",
"bgcolor": "#f44336",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "[]",
"payloadType": "json",
"topic": "clear",
"topicType": "str",
"x": 130,
"y": 200,
"wires": [["c3_chart"]]
},
{
"id": "c3_chart",
"type": "ui-chart",
"z": "c3_tab",
"group": "c3viz_ui_group",
"name": "月別売上",
"label": "月別売上(万円)",
"order": 3,
"chartType": "bar",
"category": "",
"categoryType": "none",
"xAxisProperty": "x",
"xAxisPropertyType": "property",
"xAxisType": "category",
"yAxisProperty": "y",
"yAxisPropertyType": "property",
"action": "replace",
"pointShape": "rect",
"pointRadius": 4,
"showLegend": false,
"removeOlder": 1,
"removeOlderUnit": "3600",
"colors": ["#b92d5d", "#2196f3", "#4caf50"],
"textColor": ["#666666"],
"textColorDefault": true,
"gridColor": ["#e5e5e5"],
"gridColorDefault": true,
"width": "6",
"height": "4",
"className": "",
"x": 520,
"y": 120,
"wires": [[]]
}
]
🎯 gauge ウィジェット演習
演習 G-1: シンプルな温度ゲージ初級
📋 課題:
2秒ごとにランダムな温度値を生成し、3/4ゲージで表示するフローを作成してください。
💼 使いどころ: 現在値が許容範囲のどこにあるかを、1つの計器で示す場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, ui-gauge
Inject: 2秒間隔で繰り返し実行
Change: 15~35のランダム値を生成
ui-gauge: 3/4ゲージ、4段階のセグメント色分け
💡 ヒント
Injectノード:
Changeノード: 「値の代入」で msg.payload に「JSONata式」型の $floor($random() * 21) + 15 を設定します。
$random() は 0 以上 1 未満の数を返します。21 を掛けて $floor で小数を切り捨てると 0〜20 の整数になり、15 を足すと 15〜35 になります。
ui-gaugeの設定:
Type: 3/4 Gauge
Min: 0, Max: 50
Units: °C
Segments: 0→青, 20→緑, 30→オレンジ, 35→赤
✅ 解答例フロー
[
{
"id": "g1_tab",
"type": "tab",
"label": "演習 G-1: シンプルゲージ",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "g1_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "g1_ui_page",
"type": "ui-page",
"name": "演習G-1",
"ui": "c2e1aa56f50f03bd",
"path": "/g1",
"icon": "home",
"layout": "grid",
"theme": "g1_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "g1_ui_group",
"type": "ui-group",
"name": "温度ゲージ",
"page": "g1_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "g1_inject",
"type": "inject",
"z": "g1_tab",
"name": "2秒毎",
"props": [{"p": "payload"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 100,
"wires": [["g1_change"]]
},
{
"id": "g1_change",
"type": "change",
"z": "g1_tab",
"name": "温度生成(15-35)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 15",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 100,
"wires": [["g1_gauge"]]
},
{
"id": "g1_gauge",
"type": "ui-gauge",
"z": "g1_tab",
"name": "温度ゲージ",
"group": "g1_ui_group",
"order": 1,
"width": "6",
"height": "4",
"gtype": "gauge-34",
"gstyle": "rounded",
"title": "室温",
"units": "°C",
"icon": "mdi-thermometer",
"prefix": "",
"suffix": "",
"segments": [
{"from": 0, "color": "#2196f3"},
{"from": 20, "color": "#4caf50"},
{"from": 30, "color": "#ff9800"},
{"from": 35, "color": "#f44336"}
],
"min": 0,
"max": 50,
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"className": "",
"floatingTitlePosition": "top-left",
"x": 550,
"y": 100,
"wires": []
}
]
演習 G-2: 複数タイプのゲージ比較中級
📋 課題:
同じ値を異なるタイプのゲージ(Half, Tile, Battery)で同時に表示し、各タイプの特徴を比較できるダッシュボードを作成してください。
💼 使いどころ: 同じ値でも見せ方で伝わり方が変わることを確かめ、画面に合う表示形式を選ぶ場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, ui-gauge × 3
ui-gauge 1: Half Gauge(半円)
ui-gauge 2: Tile(タイル)
ui-gauge 3: Battery(バッテリー)
全てのゲージに同じ値を送信
💡 ヒント
Inject/Changeノード:
G-1と同様。Changeノードの式は、0〜100 にするなら $floor($random() * 101)
Changeの出力を3つのゲージに接続(1つの出力から複数のノードへ配線すると、同じ値が3つに届く)
ui-gaugeの設定:
Half: gtype = "gauge-half"
Tile: gtype = "gauge-tile"
Battery: gtype = "gauge-battery"
✅ 解答例フロー
[
{
"id": "g2_tab",
"type": "tab",
"label": "演習 G-2: ゲージタイプ比較",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "g2_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "g2_ui_page",
"type": "ui-page",
"name": "演習G-2",
"ui": "c2e1aa56f50f03bd",
"path": "/g2",
"icon": "home",
"layout": "grid",
"theme": "g2_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "g2_ui_group",
"type": "ui-group",
"name": "ゲージ比較",
"page": "g2_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "g2_inject",
"type": "inject",
"z": "g2_tab",
"name": "2秒毎",
"props": [{"p": "payload"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 140,
"wires": [["g2_change"]]
},
{
"id": "g2_change",
"type": "change",
"z": "g2_tab",
"name": "値生成(0-100)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 101)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 140,
"wires": [["g2_half", "g2_tile", "g2_battery"]]
},
{
"id": "g2_half",
"type": "ui-gauge",
"z": "g2_tab",
"name": "Half Gauge",
"group": "g2_ui_group",
"order": 1,
"width": "4",
"height": "3",
"gtype": "gauge-half",
"gstyle": "rounded",
"title": "Half Gauge",
"units": "%",
"icon": "",
"segments": [
{"from": 0, "color": "#2196f3"},
{"from": 50, "color": "#4caf50"},
{"from": 80, "color": "#f44336"}
],
"min": 0,
"max": 100,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 550,
"y": 80,
"wires": []
},
{
"id": "g2_tile",
"type": "ui-gauge",
"z": "g2_tab",
"name": "Tile Gauge",
"group": "g2_ui_group",
"order": 2,
"width": "4",
"height": "3",
"gtype": "gauge-tile",
"gstyle": "rounded",
"title": "Tile Gauge",
"units": "%",
"icon": "mdi-percent",
"segments": [
{"from": 0, "color": "#2196f3"},
{"from": 50, "color": "#4caf50"},
{"from": 80, "color": "#f44336"}
],
"min": 0,
"max": 100,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 550,
"y": 140,
"wires": []
},
{
"id": "g2_battery",
"type": "ui-gauge",
"z": "g2_tab",
"name": "Battery Gauge",
"group": "g2_ui_group",
"order": 3,
"width": "4",
"height": "3",
"gtype": "gauge-battery",
"gstyle": "rounded",
"title": "Battery Gauge",
"units": "%",
"icon": "",
"segments": [
{"from": 0, "color": "#f44336"},
{"from": 20, "color": "#ff9800"},
{"from": 50, "color": "#4caf50"}
],
"min": 0,
"max": 100,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 550,
"y": 200,
"wires": []
}
]
演習 G-3: 動的プロパティ更新ゲージ上級
📋 課題:
msg.ui_updateを使って、値に応じてゲージのラベルやセグメント色を動的に変更するフローを作成してください。
💼 使いどころ: 値に応じて目盛りや色をフロー側から変え、状態に合わせた見た目にする場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, Switch, ui-gauge
値が30未満: ラベル「低温」、青系のセグメント
値が30~60: ラベル「正常」、緑系のセグメント
値が60以上: ラベル「高温警告」、赤系のセグメント
💡 ヒント
ノードの構成: Inject → Change(値を作る)→ Switch(範囲で3つに分ける)→ Change × 3(msg.ui_update を設定)→ ui-gauge
値を作るChange: 「値の代入」で msg.payload に「JSONata式」型の $floor($random() * 81) + 10(10〜90)
Switch: プロパティは msg.payload。条件は「< 30」「< 60」「その他」の3つで、「最初に合致した条件で終了」を選ぶ。30 未満は出力1、30〜59 は出力2、60 以上は出力3 に出る
3つのChange: それぞれ「値の代入」で msg.ui_update に「JSON」型の値を設定し、3つとも同じ ui-gauge へつなぐ
出力1(低温)のChangeに設定する値:
{
"label": "低温",
"segments": [
{ "from": 0, "color": "#90caf9" },
{ "from": 20, "color": "#2196f3" }
]
}
出力2(正常)は "label": "正常"、色 #a5d6a7(0〜)と #4caf50(40〜)。出力3(高温警告)は "label": "高温警告"、色 #ffcc80(0〜)と #f44336(60〜)です。
✅ 解答例フロー
[
{
"id": "g3_tab",
"type": "tab",
"label": "演習 G-3: 動的ゲージ",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "g3_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "g3_ui_page",
"type": "ui-page",
"name": "演習G-3",
"ui": "c2e1aa56f50f03bd",
"path": "/g3",
"icon": "home",
"layout": "grid",
"theme": "g3_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "g3_ui_group",
"type": "ui-group",
"name": "動的ゲージ",
"page": "g3_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "g3_inject",
"type": "inject",
"z": "g3_tab",
"name": "2秒毎",
"props": [{"p": "payload"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 100,
"wires": [["g3_change_value"]]
},
{
"id": "g3_change_value",
"type": "change",
"z": "g3_tab",
"name": "値生成(10-90)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 81) + 10",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 100,
"wires": [["g3_switch"]]
},
{
"id": "g3_switch",
"type": "switch",
"z": "g3_tab",
"name": "温度判定",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "30",
"vt": "num"
},
{
"t": "lt",
"v": "60",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 530,
"y": 100,
"wires": [["g3_change_low"], ["g3_change_normal"], ["g3_change_high"]]
},
{
"id": "g3_change_low",
"type": "change",
"z": "g3_tab",
"name": "低温",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"label\": \"低温\", \"segments\": [{\"from\": 0, \"color\": \"#90caf9\"}, {\"from\": 20, \"color\": \"#2196f3\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 60,
"wires": [["g3_gauge"]]
},
{
"id": "g3_change_normal",
"type": "change",
"z": "g3_tab",
"name": "正常",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"label\": \"正常\", \"segments\": [{\"from\": 0, \"color\": \"#a5d6a7\"}, {\"from\": 40, \"color\": \"#4caf50\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 100,
"wires": [["g3_gauge"]]
},
{
"id": "g3_change_high",
"type": "change",
"z": "g3_tab",
"name": "高温警告",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"label\": \"高温警告\", \"segments\": [{\"from\": 0, \"color\": \"#ffcc80\"}, {\"from\": 60, \"color\": \"#f44336\"}]}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 140,
"wires": [["g3_gauge"]]
},
{
"id": "g3_gauge",
"type": "ui-gauge",
"z": "g3_tab",
"name": "動的ゲージ",
"group": "g3_ui_group",
"order": 1,
"width": "6",
"height": "4",
"gtype": "gauge-34",
"gstyle": "rounded",
"title": "状態",
"units": "°C",
"icon": "mdi-thermometer",
"segments": [
{"from": 0, "color": "#4caf50"}
],
"min": 0,
"max": 100,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 570,
"y": 100,
"wires": []
}
]
📋 table ウィジェット演習
演習 TB-1: シンプルなデータ一覧初級
📋 課題:
センサー情報をテーブルで表示するシンプルなフローを作成してください。
💼 使いどころ: 複数件のデータを一覧表として並べて確認する場面で使います。
🎯 要求仕様:
使用ノード: Inject, ui-table
Inject: JSON配列データを4件以上
ui-table: 列を自動判断(Auto Calculate Columns)で表示
💡 ヒント
Injectノード:
Payload Type: JSON
起動時に1回実行
[
{"id": 1, "name": "温度センサー", "value": 25.5, "status": "正常"},
{"id": 2, "name": "湿度センサー", "value": 60, "status": "正常"},
{"id": 3, "name": "圧力センサー", "value": 1013, "status": "警告"},
{"id": 4, "name": "照度センサー", "value": 500, "status": "正常"}
]
ui-tableの設定:
列を自動判断: 有効
上限の行数: 10
動作: 置換(replace)
✅ 解答例フロー
[
{
"id": "tb1_tab",
"type": "tab",
"label": "演習 TB-1: シンプルテーブル",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "tb1_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "tb1_ui_page",
"type": "ui-page",
"name": "演習TB-1",
"ui": "c2e1aa56f50f03bd",
"path": "/tb1",
"icon": "home",
"layout": "grid",
"theme": "tb1_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "tb1_ui_group",
"type": "ui-group",
"name": "センサー一覧",
"page": "tb1_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "tb1_inject",
"type": "inject",
"z": "tb1_tab",
"name": "センサーデータ",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"id\":1,\"name\":\"温度センサー\",\"value\":25.5,\"status\":\"正常\"},{\"id\":2,\"name\":\"湿度センサー\",\"value\":60,\"status\":\"正常\"},{\"id\":3,\"name\":\"圧力センサー\",\"value\":1013,\"status\":\"警告\"},{\"id\":4,\"name\":\"照度センサー\",\"value\":500,\"status\":\"正常\"}]",
"payloadType": "json",
"x": 150,
"y": 100,
"wires": [["tb1_table"]]
},
{
"id": "tb1_table",
"type": "ui-table",
"z": "tb1_tab",
"group": "tb1_ui_group",
"name": "センサー一覧",
"label": "",
"order": 1,
"width": "0",
"height": "0",
"maxrows": 10,
"autocols": true,
"showSearch": true,
"deselect": true,
"selectionType": "none",
"columns": [],
"mobileBreakpoint": "sm",
"mobileBreakpointType": "defaults",
"action": "replace",
"className": "",
"x": 370,
"y": 100,
"wires": [[]]
}
]
演習 TB-2: 行選択と詳細表示中級
📋 課題:
複数センサーの状態を一覧表示し、行を選択すると詳細が表示されるダッシュボードを作成してください。
💼 使いどころ: 一覧から1件を選び、その詳細を同じ画面に表示する場面で使います。
🎯 要求仕様:
ui-table: センサー一覧(ID、名前、値、状態)を表示
行選択時: 選択したセンサーの情報をui-textで表示
更新ボタン: テーブルデータを更新
💡 ヒント
テーブルデータの形式:
msg.payload = [
{ "id": 1, "name": "温度センサー", "value": 25.5, "status": "正常" },
{ "id": 2, "name": "湿度センサー", "value": 65, "status": "正常" },
{ "id": 3, "name": "圧力センサー", "value": 1013, "status": "警告" }
];
この配列は、Changeノードの「値の代入」で msg.payload に「JSON」型で設定できます。解答例では「JSONata式」型にして、値を $random() で毎回変えています。
ui-tableの出力:
行を選択すると、その行のオブジェクトがmsg.payloadとして出力されます。
✅ 解答例フロー
[
{
"id": "d2viz_ex3_tab",
"type": "tab",
"label": "演習3: センサーテーブル",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "d2viz_ex3_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "ex3_ui_page",
"type": "ui-page",
"name": "センサー管理",
"ui": "c2e1aa56f50f03bd",
"path": "/exercise3",
"icon": "mdi-table",
"layout": "grid",
"theme": "d2viz_ex3_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "ex3_group_table",
"type": "ui-group",
"name": "📋 センサー一覧",
"page": "ex3_ui_page",
"width": "6",
"height": "6",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex3_group_detail",
"type": "ui-group",
"name": "📝 選択詳細",
"page": "ex3_ui_page",
"width": "6",
"height": "3",
"order": 2,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "d2viz_ex3_inject",
"type": "inject",
"z": "d2viz_ex3_tab",
"name": "データ更新",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 100,
"wires": [["d2viz_ex3_change"]]
},
{
"id": "d2viz_ex3_change",
"type": "change",
"z": "d2viz_ex3_tab",
"name": "テーブルデータ生成",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "[\n {\"id\": 1, \"name\": \"温度センサー\", \"value\": $formatNumber($random() * 10 + 20, \"0.0\"), \"status\": \"正常\"},\n {\"id\": 2, \"name\": \"湿度センサー\", \"value\": $floor($random() * 30 + 50), \"status\": \"正常\"},\n {\"id\": 3, \"name\": \"圧力センサー\", \"value\": $floor($random() * 50 + 990), \"status\": $random() > 0.7 ? \"警告\" : \"正常\"},\n {\"id\": 4, \"name\": \"照度センサー\", \"value\": $floor($random() * 500 + 100), \"status\": \"正常\"}\n]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 100,
"wires": [["ex3_table"]]
},
{
"id": "ex3_table",
"type": "ui-table",
"z": "d2viz_ex3_tab",
"group": "ex3_group_table",
"name": "センサー一覧",
"label": "",
"order": 1,
"width": "6",
"height": "5",
"maxrows": 10,
"autocols": true,
"showSearch": true,
"deselect": true,
"selectionType": "click",
"columns": [],
"mobileBreakpoint": "sm",
"mobileBreakpointType": "defaults",
"action": "replace",
"className": "",
"x": 530,
"y": 100,
"wires": [["d2viz_ex3_template"]]
},
{
"id": "d2viz_ex3_template",
"type": "template",
"z": "d2viz_ex3_tab",
"name": "詳細フォーマット",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "mustache",
"template": "選択: {{name}} (ID: {{id}})\n現在値: {{value}}\n状態: {{status}}",
"output": "str",
"x": 720,
"y": 100,
"wires": [["ex3_text"]]
},
{
"id": "ex3_text",
"type": "ui-text",
"z": "d2viz_ex3_tab",
"group": "ex3_group_detail",
"name": "選択詳細",
"label": "選択されたセンサー:",
"order": 1,
"width": "0",
"height": "0",
"fontSize": 14,
"fontStyle": false,
"fontWeight": false,
"alignment": "left",
"className": "",
"x": 910,
"y": 100,
"wires": []
}
]
演習 TB-3: カスタム列定義とソート上級
📋 課題:
テーブルの列を手動定義し、列幅・表示順序・ソート機能をカスタマイズしたダッシュボードを作成してください。
💼 使いどころ: 表示する列と順序を決め、並べ替えのできる一覧にする場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, Function, ui-table, ui-button
ui-table: カスタム列定義(ID、名前、値、状態の順)
列幅をそれぞれ指定(ID: 60px、名前: 150px、値: 100px、状態: 80px)
ui-button「値でソート」: 値の昇順/降順を切替え
ui-button「データ追加」: 新しい行を追加(append)
💡 ヒント
カスタム列定義(Columnsプロパティ):
[
{ "key": "id", "label": "ID", "width": "60px" },
{ "key": "name", "label": "センサー名", "width": "150px" },
{ "key": "value", "label": "現在値", "width": "100px", "align": "right" },
{ "key": "status", "label": "状態", "width": "80px" }
]
初期データを設定するChangeノード: 「値の代入」のルールを3つ、次の順に並べます。ソートと追加の処理は、このフロー変数を読み書きします。
flow.tableData に「JSON」型で、4件のセンサーデータの配列
flow.sortAsc に「真偽」型の true(最初は昇順)
msg.payload に flow.tableData(種類は「flow.」)
ソート用Functionノード:
// フロー変数でソート順を管理
let sortAsc = flow.get("sortAsc");
if (sortAsc === undefined) sortAsc = true;
let data = flow.get("tableData") || [];
data.sort((a, b) => sortAsc ? a.value - b.value : b.value - a.value);
flow.set("sortAsc", !sortAsc);
msg.payload = data;
return msg;
データ追加用Functionノード:
// 新しいデータを1件追加
let data = flow.get("tableData") || [];
let newId = data.length > 0 ? Math.max(...data.map(d => d.id)) + 1 : 1;
msg.payload = [{
"id": newId,
"name": "センサー" + newId,
"value": Math.floor(Math.random() * 50 + 10),
"status": Math.random() > 0.3 ? "正常" : "警告"
}];
msg.action = "append";
return msg;
ui-tableの設定:
列を自動判断: 無効(手動定義を使用)
列定義: 上記のカスタム定義を設定
上限の行数: 10
✅ 解答例フロー
[
{
"id": "tb3_tab",
"type": "tab",
"label": "演習 TB-3: カスタムテーブル",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "tb3viz_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "tb3viz_ui_page",
"type": "ui-page",
"name": "演習TB-3",
"ui": "c2e1aa56f50f03bd",
"path": "/viz-tb3",
"icon": "mdi-table",
"layout": "grid",
"theme": "tb3viz_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "tb3viz_ui_group",
"type": "ui-group",
"name": "カスタムテーブル",
"page": "tb3viz_ui_page",
"width": "6",
"height": "12",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "tb3_inject_init",
"type": "inject",
"z": "tb3_tab",
"name": "初期データ",
"props": [{"p": "payload"}],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 80,
"wires": [["d2viz_tb3_change_init"]]
},
{
"id": "d2viz_tb3_change_init",
"type": "change",
"z": "tb3_tab",
"name": "初期データ設定",
"rules": [
{
"t": "set",
"p": "tableData",
"pt": "flow",
"to": "[{\"id\": 1, \"name\": \"温度センサー\", \"value\": 25.5, \"status\": \"正常\"}, {\"id\": 2, \"name\": \"湿度センサー\", \"value\": 60, \"status\": \"正常\"}, {\"id\": 3, \"name\": \"圧力センサー\", \"value\": 45, \"status\": \"警告\"}, {\"id\": 4, \"name\": \"照度センサー\", \"value\": 30, \"status\": \"正常\"}]",
"tot": "json"
},
{
"t": "set",
"p": "sortAsc",
"pt": "flow",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tableData",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 80,
"wires": [["tb3_table"]]
},
{
"id": "tb3_btn_sort",
"type": "ui-button",
"z": "tb3_tab",
"group": "tb3viz_ui_group",
"name": "値でソート",
"label": "🔄 値でソート",
"order": 1,
"width": "3",
"height": "1",
"emulateClick": false,
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "date",
"topic": "sort",
"x": 130,
"y": 140,
"wires": [["tb3_func_sort"]]
},
{
"id": "tb3_func_sort",
"type": "function",
"z": "tb3_tab",
"name": "ソート処理",
"func": "// 現在の並び順を読み出す(未設定なら昇順)\nlet sortAsc = flow.get(\"sortAsc\");\nif (sortAsc === undefined) sortAsc = true;\n// 保存しておいたデータを読み出す\nconst data = flow.get(\"tableData\") || [];\n\n// 値(value)で並べ替える。昇順なら小さい順、降順なら大きい順\ndata.sort((a, b) => sortAsc ? a.value - b.value : b.value - a.value);\n// 次に押したときは逆の順にする\nflow.set(\"sortAsc\", !sortAsc);\nflow.set(\"tableData\", data);\n\n// 並べ替えた全件をテーブルへ送る\nmsg.payload = data;\nreturn msg;",
"outputs": 1,
"x": 330,
"y": 140,
"wires": [["tb3_table"]]
},
{
"id": "tb3_btn_add",
"type": "ui-button",
"z": "tb3_tab",
"group": "tb3viz_ui_group",
"name": "データ追加",
"label": "➕ データ追加",
"order": 2,
"width": "3",
"height": "1",
"emulateClick": false,
"color": "",
"bgcolor": "#4caf50",
"className": "",
"icon": "",
"payload": "",
"payloadType": "date",
"topic": "add",
"x": 130,
"y": 200,
"wires": [["tb3_func_add"]]
},
{
"id": "tb3_func_add",
"type": "function",
"z": "tb3_tab",
"name": "データ追加処理",
"func": "// 保存しておいたデータを読み出す\nconst data = flow.get(\"tableData\") || [];\n// 新しい行の ID は、今ある ID の最大値 + 1(データが無ければ 1)\nconst newId = data.length > 0 ? Math.max(...data.map(d => d.id)) + 1 : 1;\n\n// 追加する行(値と状態は乱数で決める)\nconst newItem = {\n \"id\": newId,\n \"name\": \"センサー\" + newId,\n \"value\": Math.floor(Math.random() * 50 + 10),\n \"status\": Math.random() > 0.3 ? \"正常\" : \"警告\"\n};\n\n// フロー変数のデータにも追加しておく(ソートの対象に含めるため)\ndata.push(newItem);\nflow.set(\"tableData\", data);\n\n// テーブルには追加する1行だけを送り、msg.action を \"append\" にして末尾に足す\nmsg.payload = [newItem];\nmsg.action = \"append\";\nreturn msg;",
"outputs": 1,
"x": 330,
"y": 200,
"wires": [["tb3_table"]]
},
{
"id": "tb3_table",
"type": "ui-table",
"z": "tb3_tab",
"group": "tb3viz_ui_group",
"name": "カスタムテーブル",
"label": "",
"order": 3,
"width": "6",
"height": "5",
"maxrows": 10,
"autocols": false,
"showSearch": true,
"deselect": true,
"selectionType": "none",
"columns": [
{ "key": "id", "label": "ID", "width": "60px" },
{ "key": "name", "label": "センサー名", "width": "150px" },
{ "key": "value", "label": "現在値", "width": "100px", "align": "right" },
{ "key": "status", "label": "状態", "width": "80px" }
],
"mobileBreakpoint": "sm",
"mobileBreakpointType": "defaults",
"action": "replace",
"className": "",
"x": 540,
"y": 140,
"wires": [[]]
}
]
📊 progress ウィジェット演習
演習 P-1: シンプルなプログレスバー初級
📋 課題:
スライダーで値を変更すると、リニア(横棒)プログレスバーに反映されるフローを作成してください。
💼 使いどころ: 設定値や達成度の割合を、横棒の長さで示す場面で使います。
🎯 要求仕様:
使用ノード: ui-slider, ui-progress
ui-slider: 0〜100の範囲
ui-progress: リニアスタイル、値表示あり
💡 ヒント
ui-sliderの設定:
Min: 0, Max: 100
Step: 1
Label: 進捗率
ui-progressの設定:
✅ 解答例フロー
[
{
"id": "p1_tab",
"type": "tab",
"label": "演習 P-1: シンプルプログレス",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "p1_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "p1_ui_page",
"type": "ui-page",
"name": "演習P-1",
"ui": "c2e1aa56f50f03bd",
"path": "/p1",
"icon": "home",
"layout": "grid",
"theme": "p1_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "p1_ui_group",
"type": "ui-group",
"name": "プログレス",
"page": "p1_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "p1_slider",
"type": "ui-slider",
"z": "p1_tab",
"group": "p1_ui_group",
"name": "進捗スライダー",
"label": "進捗率",
"order": 1,
"width": "6",
"height": "1",
"outs": "all",
"topic": "",
"topicType": "str",
"min": 0,
"max": 100,
"step": 1,
"className": "",
"thumbLabel": true,
"x": 150,
"y": 100,
"wires": [["p1_progress"]]
},
{
"id": "p1_progress",
"type": "ui-progress",
"z": "p1_tab",
"group": "p1_ui_group",
"name": "進捗バー",
"order": 2,
"width": "6",
"height": "1",
"color": "#b92d5d",
"className": "",
"x": 370,
"y": 100,
"wires": []
}
]
演習 P-2: 円形プログレスと自動更新中級
📋 課題:
処理進捗をシミュレートし、円形プログレスバーで0%から100%まで自動的に進行するフローを作成してください。
💼 使いどころ: 処理の進み具合を円形の表示で伝え、完了までの残りを見せる場面で使います。
🎯 要求仕様:
使用ノード: ui-button, Change, Switch, Trigger, ui-progress
ui-button「開始」: クリックで進捗開始
ui-progress: 円形スタイル、値表示あり
0.5秒ごとに10%ずつ増加し、100%で停止
💡 ヒント
ui-buttonの設定:
Label: 🚀 開始
Payload: 0(初期値)
Payload Type: num
ノードの構成: ui-button → Change(進捗計算)→ ui-progress と Switch(100%未満か)→ Trigger(0.5秒待つ)→ 進捗計算のChangeへ戻す(ループ)
Changeノード(進捗計算): 「値の代入」のルールを2つ、次の順に並べます。
flow.progress に「JSONata式」型の payload = 0 ? 10 : $min([$flowContext("progress") + 10, 100])
msg.payload に flow.progress(種類は「flow.」)
1つ目の式は、ボタンから 0 が届いたら 10 から始め、それ以外(ループで戻ってきたとき)はフロー変数の値に 10 を足します。$min で 100 を超えないようにしています。$flowContext("progress") は、フロー変数 progress を読み出す JSONata の関数です。
Switchノード: プロパティは msg.payload、条件は「< 100」の1つ。100 になると条件に合わず、ループが止まります。
Triggerノード(遅延):
送信データ: 何も送らない
送信後の処理: 指定した時間待機(500 ミリ秒)
再送信データ: 真偽 true
出力を進捗計算のChangeノードに接続(ループ)
ui-progressの設定:
✅ 解答例フロー
[
{
"id": "p2_tab",
"type": "tab",
"label": "演習 P-2: 円形プログレス",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "Dashboard",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"navigationStyle": "default"
},
{
"id": "p2_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
}
},
{
"id": "p2_ui_page",
"type": "ui-page",
"name": "演習P-2",
"ui": "c2e1aa56f50f03bd",
"path": "/p2",
"icon": "home",
"layout": "grid",
"theme": "p2_ui_theme",
"order": 1,
"visible": true,
"disabled": false
},
{
"id": "p2_ui_group",
"type": "ui-group",
"name": "円形プログレス",
"page": "p2_ui_page",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true
},
{
"id": "p2_btn_start",
"type": "ui-button",
"z": "p2_tab",
"group": "p2_ui_group",
"name": "開始",
"label": "🚀 開始",
"order": 1,
"width": "3",
"height": "1",
"emulateClick": false,
"color": "",
"bgcolor": "#4caf50",
"className": "",
"icon": "",
"payload": "0",
"payloadType": "num",
"topic": "start",
"x": 130,
"y": 100,
"wires": [["d2viz_p2_change"]]
},
{
"id": "d2viz_p2_change",
"type": "change",
"z": "p2_tab",
"name": "進捗計算",
"rules": [
{
"t": "set",
"p": "progress",
"pt": "flow",
"to": "payload = 0 ? 10 : $min([$flowContext(\"progress\") + 10, 100])",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "progress",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 100,
"wires": [["p2_progress", "p2_switch"]]
},
{
"id": "p2_switch",
"type": "switch",
"z": "p2_tab",
"name": "100%未満か",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "100",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 350,
"y": 160,
"wires": [["p2_trigger"]]
},
{
"id": "p2_trigger",
"type": "trigger",
"z": "p2_tab",
"name": "0.5秒待機",
"op1": "",
"op2": "true",
"op1type": "nul",
"op2type": "bool",
"duration": "500",
"extend": false,
"overrideDelay": false,
"units": "ms",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 320,
"y": 160,
"wires": [["d2viz_p2_change"]]
},
{
"id": "p2_progress",
"type": "ui-progress",
"z": "p2_tab",
"group": "p2_ui_group",
"name": "処理進捗",
"order": 2,
"width": "3",
"height": "3",
"color": "#2196f3",
"className": "",
"x": 510,
"y": 100,
"wires": []
}
]
演習 P-3: 動的色変更プログレス上級
📋 課題:
値に応じてプログレスバーの色が動的に変化するダッシュボードを作成してください。
💼 使いどころ: 残量や負荷の水準に応じて色を変え、注意が必要な状態を目立たせる場面で使います。
🎯 要求仕様:
使用ノード: Inject, Change, Switch, ui-progress
0〜30%: 赤色(危険)
31〜70%: オレンジ色(注意)
71〜100%: 緑色(正常)
msg.ui_updateで色を動的に変更
💡 ヒント
Injectノード:
ノードの構成: Inject → Change(値を作る)→ Switch(範囲で3つに分ける)→ Change × 3(msg.ui_update を設定)→ ui-progress
値を作るChange: 「値の代入」で msg.payload に「JSONata式」型の $floor($random() * 101)(0〜100)
Switch: プロパティは msg.payload。条件は「<= 30」「<= 70」「その他」の3つで、「最初に合致した条件で終了」を選ぶ
3つのChange: それぞれ「値の代入」で msg.ui_update に「JSONata式」型の式を設定し、3つとも同じ ui-progress へつなぐ
出力1(危険)のChangeに設定する式:
{"color": "#f44336", "label": "危険 (" & payload & "%)"}
& は文字列をつなぐ JSONata の演算子で、ラベルは「危険 (25%)」のようになります。出力2(注意)は色 #ff9800、出力3(正常)は色 #4caf50 で、ラベルの言葉だけを変えます。
ui-progressの設定:
✅ 解答例フロー
[
{
"id": "p3_tab",
"type": "tab",
"label": "演習 P-3: 動的色プログレス",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "p3viz_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "p3viz_ui_page",
"type": "ui-page",
"name": "演習P-3",
"ui": "c2e1aa56f50f03bd",
"path": "/viz-p3",
"icon": "mdi-progress-clock",
"layout": "grid",
"theme": "p3viz_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "p3viz_ui_group",
"type": "ui-group",
"name": "動的プログレス",
"page": "p3viz_ui_page",
"width": "6",
"height": "4",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "d2viz_p3_inject",
"type": "inject",
"z": "p3_tab",
"name": "2秒毎",
"props": [{"p": "payload"}],
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 100,
"wires": [["p3_change_value"]]
},
{
"id": "p3_change_value",
"type": "change",
"z": "p3_tab",
"name": "値生成(0-100)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 101)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 100,
"wires": [["p3_switch"]]
},
{
"id": "p3_switch",
"type": "switch",
"z": "p3_tab",
"name": "色判定",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "30",
"vt": "num"
},
{
"t": "lte",
"v": "70",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 490,
"y": 100,
"wires": [["p3_change_danger"], ["p3_change_warn"], ["p3_change_ok"]]
},
{
"id": "p3_change_danger",
"type": "change",
"z": "p3_tab",
"name": "危険",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"color\": \"#f44336\", \"label\": \"危険 (\" & payload & \"%)\"}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 60,
"wires": [["p3_progress"]]
},
{
"id": "p3_change_warn",
"type": "change",
"z": "p3_tab",
"name": "注意",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"color\": \"#ff9800\", \"label\": \"注意 (\" & payload & \"%)\"}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 100,
"wires": [["p3_progress"]]
},
{
"id": "p3_change_ok",
"type": "change",
"z": "p3_tab",
"name": "正常",
"rules": [
{
"t": "set",
"p": "ui_update",
"pt": "msg",
"to": "{\"color\": \"#4caf50\", \"label\": \"正常 (\" & payload & \"%)\"}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 140,
"wires": [["p3_progress"]]
},
{
"id": "p3_progress",
"type": "ui-progress",
"z": "p3_tab",
"group": "p3viz_ui_group",
"name": "動的プログレス",
"order": 1,
"width": "6",
"height": "1",
"color": "#4caf50",
"className": "",
"x": 510,
"y": 100,
"wires": []
}
]
🏆 総合演習
演習4: 総合ダッシュボード 上級
📋 課題:
工場の環境監視ダッシュボードを作成してください。温度・湿度・消費電力を監視し、異常時にはアラートを表示します。
💼 使いどころ: 複数の指標をまとめて監視し、異常時に警告を出す画面を1つに統合する場面で使います。
🎯 要求仕様:
ui-gauge: 温度(Tileタイプ)、湿度(Batteryタイプ)
ui-chart: 消費電力の時系列グラフ(棒グラフ)
ui-table: 過去10件のアラート履歴
ui-progress: システム稼働率
しきい値超過時: ui-notificationでアラート表示
💡 ヒント
温度・湿度・電力・稼働率の値: それぞれChangeノードの「値の代入」で、msg.payload に「JSONata式」型の乱数の式を設定します(例: 温度 20〜40 は $floor($random() * 21) + 20)。
アラート判定: 温度のChangeの出力を、温度ゲージと Switch の両方につなぎます。
Switch: プロパティは msg.payload、条件は「> 35」の1つ。出力を次の2つのChangeにつなぐ
アラート履歴に追加するChange: 「値の代入」のルールを2つ、次の順に並べ、出力を ui-table へつなぐ
global.alertHistory に「JSONata式」型で、下の式
msg.payload に global.alertHistory(種類は「global.」)
通知文を作るChange: msg.payload に「JSONata式」型の "⚠️ 温度警告: " & payload & "°C"。出力を ui-notification へつなぐ
[$append([{"time": $moment().format("HH:mm:ss"), "type": "温度異常", "value": payload & "°C"}], $globalContext("alertHistory"))[[0..9]]]
新しいアラートを1件の配列にして、$append で今までの履歴(グローバル変数 alertHistory)の前につなぎ、[[0..9]] で先頭から10件だけを残します。全体を [ ] で囲んでいるのは、履歴が1件のときも配列のまま保つためです。JSONata は、要素が1つの配列を、その要素だけの値に変えてしまいます(ui-table は配列を受け取る必要があります)。
各ウィジェットの配置:
左上: 温度ゲージ(Tile)
右上: 湿度ゲージ(Battery)
中央: 電力チャート(Bar)
下部: アラート履歴テーブル + 稼働率プログレス
✅ 解答例フロー
[
{
"id": "d2viz_ex4_tab",
"type": "tab",
"label": "演習4: 総合ダッシュボード",
"disabled": false,
"info": ""
},
{
"id": "c2e1aa56f50f03bd",
"type": "ui-base",
"name": "My Dashboard",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": ["ui-notification", "ui-control"],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showPageTitle": true,
"showReconnectNotification": true,
"notificationDisplayTime": 5,
"showDisconnectNotification": true,
"allowInstall": true
},
{
"id": "d2viz_ex4_ui_theme",
"type": "ui-theme",
"name": "Default Theme",
"colors": {
"surface": "#ffffff",
"primary": "#b92d5d",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px",
"density": "default"
}
},
{
"id": "ex4_ui_page",
"type": "ui-page",
"name": "工場監視",
"ui": "c2e1aa56f50f03bd",
"path": "/exercise4",
"icon": "mdi-factory",
"layout": "grid",
"theme": "d2viz_ex4_ui_theme",
"breakpoints": [
{"name": "Default", "px": 0, "cols": 3},
{"name": "Tablet", "px": 576, "cols": 6},
{"name": "Small Desktop", "px": 768, "cols": 9},
{"name": "Desktop", "px": 1024, "cols": 12}
],
"order": 1,
"visible": "true",
"disabled": "false",
"className": ""
},
{
"id": "ex4_group_temp",
"type": "ui-group",
"name": "🌡️ 温度",
"page": "ex4_ui_page",
"width": "3",
"height": "4",
"order": 1,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex4_group_humid",
"type": "ui-group",
"name": "💧 湿度",
"page": "ex4_ui_page",
"width": "3",
"height": "4",
"order": 2,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex4_group_power",
"type": "ui-group",
"name": "⚡ 消費電力",
"page": "ex4_ui_page",
"width": "6",
"height": "5",
"order": 3,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex4_group_alert",
"type": "ui-group",
"name": "🚨 アラート履歴",
"page": "ex4_ui_page",
"width": "4",
"height": "6",
"order": 4,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "ex4_group_status",
"type": "ui-group",
"name": "📊 システム状態",
"page": "ex4_ui_page",
"width": "2",
"height": "3",
"order": 5,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false",
"groupType": "default"
},
{
"id": "d2viz_ex4_inject_temp",
"type": "inject",
"z": "d2viz_ex4_tab",
"name": "温度データ",
"props": [{"p": "payload"}],
"repeat": "3",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 80,
"wires": [["ex4_change_temp"]]
},
{
"id": "ex4_change_temp",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "温度生成(20-40)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 21) + 20",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 80,
"wires": [["d2viz_ex4_gauge_temp", "ex4_switch_alert"]]
},
{
"id": "d2viz_ex4_gauge_temp",
"type": "ui-gauge",
"z": "d2viz_ex4_tab",
"name": "温度",
"group": "ex4_group_temp",
"order": 1,
"width": "0",
"height": "0",
"gtype": "gauge-tile",
"gstyle": "rounded",
"title": "温度",
"units": "°C",
"icon": "mdi-thermometer",
"prefix": "",
"suffix": "",
"segments": [
{"from": 0, "color": "#2196f3"},
{"from": 25, "color": "#4caf50"},
{"from": 35, "color": "#ff9800"},
{"from": 38, "color": "#f44336"}
],
"min": 0,
"max": 50,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 550,
"y": 60,
"wires": []
},
{
"id": "ex4_switch_alert",
"type": "switch",
"z": "d2viz_ex4_tab",
"name": "35℃を超えたか",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "35",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 1,
"x": 550,
"y": 100,
"wires": [["ex4_change_history", "d2viz_ex4_change_notify"]]
},
{
"id": "ex4_change_history",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "アラート履歴に追加",
"rules": [
{
"t": "set",
"p": "alertHistory",
"pt": "global",
"to": "[$append([{\"time\": $moment().format(\"HH:mm:ss\"), \"type\": \"温度異常\", \"value\": payload & \"°C\"}], $globalContext(\"alertHistory\"))[[0..9]]]",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "alertHistory",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 80,
"wires": [["ex4_table"]]
},
{
"id": "d2viz_ex4_change_notify",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "アラート通知文",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "\"⚠️ 温度警告: \" & payload & \"°C\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 750,
"y": 120,
"wires": [["ex4_notification"]]
},
{
"id": "d2viz_ex4_inject_humid",
"type": "inject",
"z": "d2viz_ex4_tab",
"name": "湿度データ",
"props": [{"p": "payload"}],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.3,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 160,
"wires": [["ex4_change_humid"]]
},
{
"id": "ex4_change_humid",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "湿度生成(40-80)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 41) + 40",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 160,
"wires": [["d2viz_ex4_gauge_humid"]]
},
{
"id": "d2viz_ex4_gauge_humid",
"type": "ui-gauge",
"z": "d2viz_ex4_tab",
"name": "湿度",
"group": "ex4_group_humid",
"order": 1,
"width": "0",
"height": "0",
"gtype": "gauge-battery",
"gstyle": "rounded",
"title": "湿度",
"units": "%",
"icon": "",
"prefix": "",
"suffix": "",
"segments": [
{"from": 0, "color": "#ff9800"},
{"from": 30, "color": "#4caf50"},
{"from": 70, "color": "#2196f3"}
],
"min": 0,
"max": 100,
"className": "",
"floatingTitlePosition": "top-left",
"sizeThickness": 16,
"sizeGap": 4,
"sizeKeyThickness": 8,
"x": 550,
"y": 160,
"wires": []
},
{
"id": "ex4_inject_power",
"type": "inject",
"z": "d2viz_ex4_tab",
"name": "電力データ",
"props": [{"p": "payload"},{"p": "topic", "vt": "str"}],
"repeat": "4",
"crontab": "",
"once": true,
"onceDelay": 0.5,
"topic": "電力",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 240,
"wires": [["ex4_change_power"]]
},
{
"id": "ex4_change_power",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "電力生成(100-200kW)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 101) + 100",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 350,
"y": 240,
"wires": [["ex4_chart_power"]]
},
{
"id": "ex4_chart_power",
"type": "ui-chart",
"z": "d2viz_ex4_tab",
"group": "ex4_group_power",
"name": "消費電力",
"label": "消費電力 (kW)",
"order": 1,
"chartType": "bar",
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "msg",
"xAxisType": "time",
"xAxisFormat": "{HH}:{mm}",
"xAxisFormatType": "custom",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"action": "append",
"pointShape": "rect",
"pointRadius": 4,
"showLegend": false,
"removeOlder": 1,
"removeOlderUnit": "3600",
"colors": ["#b92d5d"],
"width": "0",
"height": "0",
"className": "",
"textColorDefault": true,
"gridColorDefault": true,
"x": 570,
"y": 240,
"wires": [[]]
},
{
"id": "ex4_table",
"type": "ui-table",
"z": "d2viz_ex4_tab",
"group": "ex4_group_alert",
"name": "アラート履歴",
"label": "",
"order": 1,
"width": "0",
"height": "0",
"maxrows": 5,
"autocols": true,
"showSearch": false,
"deselect": true,
"selectionType": "none",
"columns": [],
"mobileBreakpoint": "sm",
"mobileBreakpointType": "defaults",
"action": "replace",
"className": "",
"x": 750,
"y": 80,
"wires": [[]]
},
{
"id": "ex4_notification",
"type": "ui-notification",
"z": "d2viz_ex4_tab",
"ui": "c2e1aa56f50f03bd",
"name": "アラート通知",
"position": "top right",
"colorDefault": false,
"color": "#f44336",
"displayTime": 5,
"showCountdown": true,
"outputs": 0,
"allowDismiss": true,
"dismissText": "閉じる",
"raw": false,
"className": "",
"x": 750,
"y": 120,
"wires": []
},
{
"id": "ex4_inject_status",
"type": "inject",
"z": "d2viz_ex4_tab",
"name": "稼働率",
"props": [{"p": "payload"}],
"repeat": "10",
"crontab": "",
"once": true,
"onceDelay": 0.2,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 320,
"wires": [["ex4_change_status"]]
},
{
"id": "ex4_change_status",
"type": "change",
"z": "d2viz_ex4_tab",
"name": "稼働率(85-100)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$floor($random() * 16) + 85",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 320,
"wires": [["ex4_progress"]]
},
{
"id": "ex4_progress",
"type": "ui-progress",
"z": "d2viz_ex4_tab",
"group": "ex4_group_status",
"name": "稼働率",
"order": 1,
"width": "0",
"height": "0",
"color": "#4caf50",
"className": "",
"x": 530,
"y": 320,
"wires": []
}
]
✅ 8. まとめ
📊 データ可視化ウィジェットの使い分け
ウィジェット
最適な用途
入力データ形式
chart (Line)
時系列データの推移、トレンド分析
数値 + topic
chart (Bar)
カテゴリ別比較、期間別集計
配列 / オブジェクト
chart (Pie)
構成比、割合の表示
配列 / オブジェクト
gauge (3/4, Half)
現在値の直感的表示、しきい値監視
数値
gauge (Tile)
コンパクトな数値表示
数値
gauge (Battery, Tank)
残量、レベル表示
数値(%)
table
一覧表示、詳細データ確認
オブジェクト配列
progress
進捗状況、完了率
数値(%)
💡 重要ポイント
時系列チャート : X-Axis Limitを設定して表示期間を制限(メモリ節約)
複数系列 : msg.topicでデータをグループ化
ゲージのセグメント : 閾値に応じた色分けで異常を視覚化
動的プロパティ : msg.ui_updateで実行時に設定変更可能
チャートクリア : 空配列 [] を送信してリセット
🔧 9. トラブルシューティング
問題
原因
解決方法
チャートにデータが表示されない
Y軸のプロパティ指定ミス
データ構造を確認し、正しいキーを指定
複数のラインが1本にまとまる
Seriesの設定不足
msg.topicを設定するか、Seriesでkeyを指定
ゲージの色が変わらない
Segmentsの設定ミス
from値が昇順になっているか確認
テーブルの列が表示されない
データ形式の問題
配列内のオブジェクトにキーが存在するか確認
テーブルのデータが縦に並ぶ
mobileBreakpointの設定
mobileBreakpointを「sm」に設定(レスポンシブ表示の切替点)
テーブルに行データが表示されない(ページネーションのみ表示)
グループの高さ不足、またはmobileBreakpoint未設定
ui-groupの高さを明示的に設定(例: 6)、mobileBreakpointを「sm」に設定
チャートがリセットされる
Action設定がreplace
appendに変更するか、msg.actionで制御
X軸の時間表示がおかしい
タイムスタンプ形式の問題
ミリ秒単位のUnixタイムスタンプを使用
リロード後にチャートが空になる / 凡例に undefined が出る / 動作が重くなる
ui-chart の既知の不具合に該当する可能性
「3. chart(チャート)」内の「既知の不具合・制限事項」 を参照
表示が崩れている/不正なデータが残っている
chart 内部の履歴データに不整合データが蓄積
chart ノード編集画面左上の 「Clear Chart History」 ボタンで履歴をクリア(詳細 )
🏭 10. 実務活用例
ケース1: 工場環境モニタリング
温度・湿度・気圧センサー
→ chart(時系列推移)
→ gauge(現在値表示)
→ 閾値超過時にnotification
ケース2: 生産ライン稼働状況
各設備の稼働率データ
→ chart(棒グラフで比較)
→ progress(全体稼働率)
→ table(設備別詳細)
ケース3: エネルギー管理ダッシュボード
電力・ガス・水道使用量
→ chart(時間帯別消費量)
→ gauge(リアルタイム消費)
→ chart(円グラフで構成比)
ケース4: IoTセンサーネットワーク
複数センサーからのMQTTデータ
→ table(センサー一覧・状態)
→ chart(選択センサーの履歴)
→ gauge(バッテリー残量)
📚 11. 追加リソース
このガイドが役に立ちましたら、実際のプロジェクトで練習してみてください!
データ可視化はIoTダッシュボードの核心機能です。
公式サンプルフローの出典: FlowFuse Dashboard 2.0