---
title: 'PowerShell + XAML + WPFで作る「JSONデータ件数の円グラフ表示ツール」'
url: 'https://automationse.net/powershell-json-piechart-wpf'
markdown: 'https://automationse.net/powershell-json-piechart-wpf.md'
date: '2025-10-14'
description: 'PowerShellでも、GUIやグラフを自在に扱えることをご存じでしょうか？この記事では、PowerShell 5.x で JSON データを読み込み、カテゴリごとの件数を WPFウィンドウ上に円グラフ で可視化する方法を紹介します。 🎯 ゴール JSONファイルを読み込む カテゴリごとの件数を集計 ダークテーマのWPFウィンドウ…'
taxonomy:
  category:
    - IT関連
  tag:
    - Excel
    - PowerShell
    - アプリ
---

# PowerShell + XAML + WPFで作る「JSONデータ件数の円グラフ表示ツール」

## [PowerShell + XAML + WPFで作る「JSONデータ件数の円グラフ表示ツール」](https://automationse.net/powershell-json-piechart-wpf)

  公開日 2025.10.14 更新日 2025.10.14  [Excel](https://automationse.net/tag:Excel#body-wrapper) [PowerShell](https://automationse.net/tag:PowerShell#body-wrapper) [アプリ](https://automationse.net/tag:%E3%82%A2%E3%83%97%E3%83%AA#body-wrapper)  

 PowerShellでも、GUIやグラフを自在に扱えることをご存じでしょうか？
この記事では、**PowerShell 5.x** で JSON データを読み込み、カテゴリごとの件数を **WPFウィンドウ上に円グラフ** で可視化する方法を紹介します。

---

## 🎯 ゴール

- JSONファイルを読み込む
- カテゴリごとの件数を集計
- ダークテーマのWPFウィンドウに円グラフで表示

---

## 🗂 構成

---

## 🧩 JSONサンプル (`data.json`)

---

## 🪶 ChartWindow.xaml

WPFのレイアウト定義ファイルです。
WindowsFormsHostを使って、.NETのChartコントロールをWPF上に埋め込みます。

---

## 💻 Show-PieChart.ps1

---

## ▶ 実行方法

PowerShell で以下を実行します。

---

## 📊 出力結果

- タイトル：「JSONデータ件数 - 円グラフ」
- 背景はダークグレー、フォントは白
- 各カテゴリごとに件数ラベル付きで可視化
- 3D円グラフで見やすい構成

---

## ⚙️ 応用例

### 🎨 3Dを無効化する

### 💡 合計値で集計する場合

## 📎 まとめ

| 要素 | 内容 |
|---|---|
| 使用技術 | PowerShell 5.x + XAML + WPF |
| 外部ライブラリ | 不要（.NET標準のみ） |
| 出力 | 円グラフ（3D対応） |
| 主な用途 | JSONデータの集計可視化、ダッシュボード表示など |

PowerShellでも、ちょっとしたスクリプトとXAMLで**ダッシュボードのようなUI**が簡単に作れます。
業務ツールの軽量可視化や、ログ集計の確認に活用してみてください。

 [ Previous Post](https://automationse.net/readjson-simple-gui-powershellowershell) [Next Post ](https://automationse.net/powershell-excel-json-refresh)

---

## Navigation

- Parent: [WordPress Import](https://automationse.net/wordpress-import.md)
- Previous: [PowerShellでExcelのデータ接続を更新し、JSON出力する](https://automationse.net/powershell-excel-json-refresh.md)
- Next: [超シンプルに、JSONファイルを読み込んでビューに表示するPowershellアプリをxamlを活用して作ってみる](https://automationse.net/readjson-simple-gui-powershellowershell.md)
