{"id":11928,"date":"2026-05-11T15:51:32","date_gmt":"2026-05-11T06:51:32","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=11928"},"modified":"2026-05-11T15:51:32","modified_gmt":"2026-05-11T06:51:32","slug":"chart-js-11928","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/chart-js-11928\/","title":{"rendered":"Chart.js\u3067\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u308b\u304b\u3093\u305f\u3093\u306a\u4f7f\u3044\u65b9\u3010\u30b3\u30d4\u30daOK\u3011"},"content":{"rendered":"<!-- title: Chart.js\u3067\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u308b\u304b\u3093\u305f\u3093\u306a\u4f7f\u3044\u65b9\u3010\u30b3\u30d4\u30daOK\u3011\ndescription: Chart.js\u3092\u4f7f\u3063\u3066\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3092\u3059\u3050\u4f5c\u308c\u308b\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3002CDN\u306e\u8aad\u307f\u8fbc\u307f\u304b\u3089\u3001\u68d2\u306e\u8272\u30fb\u5e45\u30fb\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u306a\u3069\u3088\u304f\u4f7f\u3046\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u307e\u3067\u3001\u624b\u3063\u53d6\u308a\u65e9\u304f\u5b9f\u88c5\u3057\u305f\u3044\u4eba\u5411\u3051\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002\n\u30bf\u30b0: Chart.js, \u68d2\u30b0\u30e9\u30d5, \u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5, JavaScript, \u30b0\u30e9\u30d5\u4f5c\u6210, CDN, chart.umd.js, barPercentage, categoryPercentage, \u6298\u308c\u7dda\u30b0\u30e9\u30d5\u6df7\u5408 -->\n\n<p>Chart.js\u306f\u3001HTML\u306e <code>&lt;canvas&gt;<\/code> \u8981\u7d20\u3092\u4f7f\u3063\u3066\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3059\u308bJavaScript\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n<p>Canvas\u30d9\u30fc\u30b9\u306a\u306e\u3067<b class=\"fw-600\">\u8efd\u91cf\u304b\u3064\u9ad8\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/b>\u3067\u3001\u68d2\u30b0\u30e9\u30d5\u30fb\u6298\u308c\u7dda\u30fb\u5186\u30b0\u30e9\u30d5\u306a\u30698\u7a2e\u985e\u306e\u30b0\u30e9\u30d5\u3092\u624b\u8efd\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002MIT\u30e9\u30a4\u30bb\u30f3\u30b9\u3067\u5546\u7528\u5229\u7528\u3082\u7121\u6599\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f<b class=\"fw-600\">\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\uff08\uff0b\u6298\u308c\u7dda\u306e\u6df7\u5408\u30b0\u30e9\u30d5\uff09<\/b>\u306b\u7d5e\u3063\u3066\u3001\u3059\u3050\u4f7f\u3048\u308b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n<!-- \u2605\u76ee\u6b21\u30ea\u30b9\u30c8 -->\n<ul class=\"tocList mt-1r\" data-toc-id=\"js-tocBWGD\" style=\"height:24rem;\"><\/ul>\n<ins class=\"tocBtn is-fixed\" data-toc-id=\"js-tocBWGD\"><\/ins>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">CDN\u3067\u8aad\u307f\u8fbc\u3080<\/h2>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e0d\u8981\u3067\u3001HTML\u306b1\u884c\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-html\">&lt;script src=&quot;https:\/\/cdn.jsdelivr.net\/npm\/chart.js&quot;&gt;&lt;\/script&gt;\n<\/code><\/pre>\n<p><code>chart.js<\/code> \u3092\u8aad\u307f\u8fbc\u3080\u3068 <code>window.Chart<\/code> \u3068\u3057\u3066\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u30d5\u30c3\u30bf\u30fc\u3067\u8aad\u307f\u8fbc\u3080\u5834\u5408\u306f <code>foot.php<\/code> \u306a\u3069\u306b\u8ffd\u8a18\u3059\u308b\u3060\u3051\u3067OK\u3067\u3059\u3002<\/p>\n<blockquote>\n  <p><b class=\"fw-600\">\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u56fa\u5b9a\u3057\u305f\u3044\u5834\u5408<\/b>\u306f <code>https:\/\/cdn.jsdelivr.net\/npm\/chart.js@4.4.1\/dist\/chart.umd.js<\/code> \u306e\u3088\u3046\u306b\u30d0\u30fc\u30b8\u30e7\u30f3\u756a\u53f7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u672c\u756a\u30b5\u30a4\u30c8\u3067\u306f\u4e88\u671f\u3057\u306a\u3044\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3092\u907f\u3051\u308b\u305f\u3081\u30d0\u30fc\u30b8\u30e7\u30f3\u56fa\u5b9a\u304c\u5b89\u5fc3\u3067\u3059\u3002<\/p>\n<\/blockquote>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">\u57fa\u672c\u306e\u69cb\u9020<\/h2>\n<p>\u30b0\u30e9\u30d5\u3092\u8868\u793a\u3059\u308b\u306b\u306f <code>&lt;canvas&gt;<\/code> \u8981\u7d20\u3068 <code>new Chart()<\/code> \u306e2\u3064\u3060\u3051\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-html\">&lt;div style=&quot;position:relative; width:100%; height:340px;&quot;&gt;\n  &lt;canvas id=&quot;myChart&quot;&gt;&lt;\/canvas&gt;\n&lt;\/div&gt;\n\n&lt;script&gt;\nnew Chart(document.getElementById(&#39;myChart&#39;), {\n  type: &#39;bar&#39;,       \/\/ \u30b0\u30e9\u30d5\u306e\u7a2e\u985e\n  data: { ... },     \/\/ \u30c7\u30fc\u30bf\n  options: { ... }   \/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\n});\n&lt;\/script&gt;\n<\/code><\/pre>\n<p><code>&lt;canvas&gt;<\/code> \u3092 <code>&lt;div&gt;<\/code> \u3067\u56f2\u3093\u3067\u9ad8\u3055\u3092\u6307\u5b9a\u3059\u308b\u306e\u304c\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<code>&lt;canvas&gt;<\/code> \u81ea\u4f53\u306bCSS\u3067\u9ad8\u3055\u3092\u6307\u5b9a\u3059\u308b\u3068\u5d29\u308c\u308b\u3053\u3068\u304c\u3042\u308b\u305f\u3081\u3001<b class=\"fw-600\">\u30e9\u30c3\u30d1\u30fc\u5074\u3067\u9ad8\u3055\u3092\u7ba1\u7406<\/b>\u3057\u307e\u3059\u3002<\/p>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u306e\u30b3\u30fc\u30c9<\/h2>\n<p>\u4ee5\u4e0b\u306f\u300c\u81ea\u793e\u5546\u54c1\u58f2\u4e0a\u300d\u3068\u300c\u30de\u30fc\u30b1\u30c3\u30c8\u30d7\u30ec\u30a4\u30b9\u58f2\u4e0a\u300d\u3092\u7a4d\u307f\u4e0a\u3052\u3001<br class=\"d-none_sp\" \/>\u300c\u55b6\u696d\u5229\u76ca\u300d\u3092\u6298\u308c\u7dda\uff08\u53f3\u8ef8\uff09\u3067\u91cd\u306d\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n\n\n<figure class=\"chart-wrapper\">\n  <!-- \u51e1\u4f8b\uff08HTML\u3067\u81ea\u4f5c\uff09 -->\n  <figcaption class=\"chart-caption fz-xs\">\n    <span><i style=\"color:#005B92;\">\u25a0<\/i>&nbsp;\u81ea\u793e\u5546\u54c1\u58f2\u4e0a<\/span>&ensp;<br class=\"d-none_pc\" \/>\n    <span><i style=\"color:#79ADCC;\">\u25a0<\/i>&nbsp;\u30de\u30fc\u30b1\u30c3\u30c8\u30d7\u30ec\u30a4\u30b9\u58f2\u4e0a<\/span>&ensp;<br class=\"d-none_pc\" \/>\n    <span><i style=\"color:#FE9001;\">\u25cf<\/i>&nbsp;\u55b6\u696d\u5229\u76ca\uff08\u6298\u308c\u7dda\u30fb\u53f3\u8ef8\uff09<\/span>\n\n    <p class=\"fxd-row mt-1r\">\n      <u class=\"unit fz-sm\" style=\"color:#1F2023;\">\u58f2\u4e0a(\u4e07\u5186)<\/u>\n      <u class=\"unit fz-sm\" style=\"color:#FE9001;\">\u55b6\u696d\u5229\u76ca(\u4e07\u5186)<\/u>\n    <\/p><!-- \/\/\/.fxd-row -->\n  <\/figcaption>\n\n  <!-- \u30b0\u30e9\u30d5\u672c\u4f53 -->\n  <div class=\"chart-content mt-1r\" style=\"position:relative; width:100%; height:300px;\">\n    <canvas id=\"js-chartCKNA\" role=\"img\" aria-label=\"2020\u5e74\u301c2024\u5e74\u306eEC\u30b5\u30a4\u30c8\u58f2\u4e0a\u63a8\u79fb\"><\/canvas>\n  <\/div>\n<\/figure><!-- \/\/\/.chart -->\n\n<!-- Chart.js -->\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/Chart.js\/4.4.1\/chart.umd.js\"><\/script>\n<script>\n  (function () {\n    new Chart(document.getElementById('js-chartCKNA'), {\n      data: {\n        labels: ['2020\u5e74', '2021\u5e74', '2022\u5e74', '2023\u5e74', '2024\u5e74'],\n        datasets: [\n          {\n            type: 'bar',\n            label: '\u81ea\u793e\u5546\u54c1\u58f2\u4e0a',\n            data: [1820, 1950, 2100, 2280, 2410],\n            backgroundColor: '#005B92',\n            stack: 'sales',          \/\/ \u2190 \u540c\u3058\u540d\u524d\u3067\u7a4d\u307f\u4e0a\u304c\u308b\n            yAxisID: 'y',\n            order: 2,\n            barPercentage: 0.5,\n            categoryPercentage: 0.6\n          },\n          {\n            type: 'bar',\n            label: '\u30de\u30fc\u30b1\u30c3\u30c8\u30d7\u30ec\u30a4\u30b9\u58f2\u4e0a',\n            data: [2050, 2340, 2980, 3640, 4820],\n            backgroundColor: '#79ADCC',\n            stack: 'sales',          \/\/ \u2190 \u540c\u3058\u540d\u524d\u3067\u7a4d\u307f\u4e0a\u304c\u308b\n            yAxisID: 'y',\n            order: 2,\n            barPercentage: 0.5,\n            categoryPercentage: 0.6\n          },\n          {\n            type: 'line',\n            label: '\u55b6\u696d\u5229\u76ca',\n            data: [350, 390, 510, 580, 650],\n            borderColor: '#FE9001',\n            backgroundColor: '#FE9001',\n            pointRadius: 5,\n            borderDash: [5, 3],      \/\/ \u7834\u7dda\n            yAxisID: 'y2',           \/\/ \u53f3\u8ef8\u306b\u7d10\u4ed8\u3051\u308b\n            order: 1\n          }\n        ]\n      },\n      options: {\n        responsive: true,\n        maintainAspectRatio: false,\n        devicePixelRatio: window.devicePixelRatio || 2,\n        interaction: {\n          mode: 'index',               \/\/ \u2190 \u540c\u3058X\u4f4d\u7f6e\u306e\u5168\u7cfb\u5217\u3092\u307e\u3068\u3081\u3066\u8868\u793a\n          intersect: false\n        },\n        plugins: {\n          legend: { display: false }   \/\/ \u2190 \u30c7\u30d5\u30a9\u30eb\u30c8\u51e1\u4f8b\u3092\u975e\u8868\u793a\n        },\n        scales: {\n          x: {\n            ticks: {\n              font: { size: 13 },\n              color: '#1F2023',\n              maxRotation: 0\n            },\n            grid: { display: false } \/\/ \u2190 \u7e26\u7dda\u3092\u975e\u8868\u793a\n          },\n          y: {\n            stacked: true,             \/\/ \u2190 \u3053\u308c\u304c\u306a\u3044\u3068\u7a4d\u307f\u4e0a\u304c\u3089\u306a\u3044\n            position: 'left',\n            min: 0,\n            max: 8000,\n            ticks: {\n              callback: v => v.toLocaleString() + '\u4e07'\n            }\n          },\n          y2: {\n            position: 'right',\n            min: 0,\n            max: 1000,\n            ticks: {\n              color: '#FE9001',\n              callback: v => v.toLocaleString() + '\u4e07'\n            },\n            grid: {\n              drawOnChartArea: false  \/\/ \u2190 \u5de6\u8ef8\u30b0\u30ea\u30c3\u30c9\u3068\u91cd\u8907\u3055\u305b\u306a\u3044\n            }\n          }\n        }\n      }\n    });\n  })();\n<\/script>\n\n\n<pre class=\"mt-2r\"><code class=\"language-html\">&lt;figure class=&quot;chart-wrapper&quot;&gt;\n  &lt;!-- \u51e1\u4f8b\uff08HTML\u3067\u81ea\u4f5c\uff09 --&gt;\n  &lt;figcaption class=&quot;chart-caption fz-xs&quot;&gt;\n    &lt;span&gt;&lt;i style=&quot;color:#005B92;&quot;&gt;\u25a0&lt;\/i&gt;&amp;nbsp;\u81ea\u793e\u5546\u54c1\u58f2\u4e0a&lt;\/span&gt;&amp;ensp;&lt;br class=&quot;d-none_pc&quot; \/&gt;\n    &lt;span&gt;&lt;i style=&quot;color:#79ADCC;&quot;&gt;\u25a0&lt;\/i&gt;&amp;nbsp;\u30de\u30fc\u30b1\u30c3\u30c8\u30d7\u30ec\u30a4\u30b9\u58f2\u4e0a&lt;\/span&gt;&amp;ensp;&lt;br class=&quot;d-none_pc&quot; \/&gt;\n    &lt;span&gt;&lt;i style=&quot;color:#FE9001;&quot;&gt;\u25cf&lt;\/i&gt;&amp;nbsp;\u55b6\u696d\u5229\u76ca\uff08\u6298\u308c\u7dda\u30fb\u53f3\u8ef8\uff09&lt;\/span&gt;\n\n    &lt;p class=&quot;fxd-row mt-1r&quot;&gt;\n      &lt;u class=&quot;unit fz-sm&quot; style=&quot;color:#1F2023;&quot;&gt;\u58f2\u4e0a(\u4e07\u5186)&lt;\/u&gt;\n      &lt;u class=&quot;unit fz-sm&quot; style=&quot;color:#FE9001;&quot;&gt;\u55b6\u696d\u5229\u76ca(\u4e07\u5186)&lt;\/u&gt;\n    &lt;\/p&gt;&lt;!-- \/\/\/.fxd-row --&gt;\n  &lt;\/figcaption&gt;\n\n  &lt;!-- \u30b0\u30e9\u30d5\u672c\u4f53 --&gt;\n  &lt;div class=&quot;chart-content mt-1r&quot; style=&quot;position:relative; width:100%; height:340px;&quot;&gt;\n    &lt;canvas id=&quot;js-chartCKNA&quot; role=&quot;img&quot; aria-label=&quot;2020\u5e74\u301c2024\u5e74\u306eEC\u30b5\u30a4\u30c8\u58f2\u4e0a\u63a8\u79fb&quot;&gt;&lt;\/canvas&gt;\n  &lt;\/div&gt;\n&lt;\/figure&gt;&lt;!-- \/\/\/.chart --&gt;\n\n&lt;!-- Chart.js --&gt;\n&lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/Chart.js\/4.4.1\/chart.umd.js&quot;&gt;&lt;\/script&gt;\n&lt;script&gt;\n  (function () {\n    new Chart(document.getElementById(&#39;js-chartCKNA&#39;), {\n      data: {\n        labels: &lsqb;&#39;2020\u5e74&#39;, &#39;2021\u5e74&#39;, &#39;2022\u5e74&#39;, &#39;2023\u5e74&#39;, &#39;2024\u5e74&#39;&rsqb;,\n        datasets: &lsqb;\n          {\n            type: &#39;bar&#39;,\n            label: &#39;\u81ea\u793e\u5546\u54c1\u58f2\u4e0a&#39;,\n            data: &lsqb;1820, 1950, 2100, 2280, 2410&rsqb;,\n            backgroundColor: &#39;#005B92&#39;,\n            stack: &#39;sales&#39;,          \/\/ \u2190 \u540c\u3058\u540d\u524d\u3067\u7a4d\u307f\u4e0a\u304c\u308b\n            yAxisID: &#39;y&#39;,\n            order: 2,\n            barPercentage: 0.5,\n            categoryPercentage: 0.6\n          },\n          {\n            type: &#39;bar&#39;,\n            label: &#39;\u30de\u30fc\u30b1\u30c3\u30c8\u30d7\u30ec\u30a4\u30b9\u58f2\u4e0a&#39;,\n            data: &lsqb;2050, 2340, 2980, 3640, 4820&rsqb;,\n            backgroundColor: &#39;#79ADCC&#39;,\n            stack: &#39;sales&#39;,          \/\/ \u2190 \u540c\u3058\u540d\u524d\u3067\u7a4d\u307f\u4e0a\u304c\u308b\n            yAxisID: &#39;y&#39;,\n            order: 2,\n            barPercentage: 0.5,\n            categoryPercentage: 0.6\n          },\n          {\n            type: &#39;line&#39;,\n            label: &#39;\u55b6\u696d\u5229\u76ca&#39;,\n            data: &lsqb;350, 390, 510, 580, 650&rsqb;,\n            borderColor: &#39;#FE9001&#39;,\n            backgroundColor: &#39;#FE9001&#39;,\n            pointRadius: 5,\n            borderDash: &lsqb;5, 3&rsqb;,      \/\/ \u7834\u7dda\n            yAxisID: &#39;y2&#39;,           \/\/ \u53f3\u8ef8\u306b\u7d10\u4ed8\u3051\u308b\n            order: 1\n          }\n        &rsqb;\n      },\n      options: {\n        responsive: true,\n        maintainAspectRatio: false,\n        devicePixelRatio: window.devicePixelRatio || 2,\n        interaction: {\n          mode: &#39;index&#39;,               \/\/ \u2190 \u540c\u3058X\u4f4d\u7f6e\u306e\u5168\u7cfb\u5217\u3092\u307e\u3068\u3081\u3066\u8868\u793a\n          intersect: false\n        },\n        plugins: {\n          legend: { display: false }   \/\/ \u2190 \u30c7\u30d5\u30a9\u30eb\u30c8\u51e1\u4f8b\u3092\u975e\u8868\u793a\n        },\n        scales: {\n          x: {\n            ticks: {\n              font: { size: 13 },\n              color: &#39;#1F2023&#39;,\n              maxRotation: 0\n            },\n            grid: { display: false } \/\/ \u2190 \u7e26\u7dda\u3092\u975e\u8868\u793a\n          },\n          y: {\n            stacked: true,             \/\/ \u2190 \u3053\u308c\u304c\u306a\u3044\u3068\u7a4d\u307f\u4e0a\u304c\u3089\u306a\u3044\n            position: &#39;left&#39;,\n            min: 0,\n            max: 8000,\n            ticks: {\n              callback: v =&gt; v.toLocaleString() + &#39;\u4e07&#39;\n            }\n          },\n          y2: {\n            position: &#39;right&#39;,\n            min: 0,\n            max: 1000,\n            ticks: {\n              color: &#39;#FE9001&#39;,\n              callback: v =&gt; v.toLocaleString() + &#39;\u4e07&#39;\n            },\n            grid: {\n              drawOnChartArea: false  \/\/ \u2190 \u5de6\u8ef8\u30b0\u30ea\u30c3\u30c9\u3068\u91cd\u8907\u3055\u305b\u306a\u3044\n            }\n          }\n        }\n      }\n    });\n  })();\n&lt;\/script&gt;\n<\/code><\/pre>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">\u3088\u304f\u4f7f\u3046\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h2>\n<h3 class=\"fz-ml\">\u7a4d\u307f\u4e0a\u3052\u306b\u5fc5\u8981\u306a2\u3064\u306e\u30bb\u30c3\u30c8<\/h3>\n<p>\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3067\u5fd8\u308c\u304c\u3061\u306a\u306e\u304c\u3001<code>stack<\/code> \u3068 <code>stacked<\/code> \u306e<b class=\"fw-600\">\u4e21\u65b9\u306e\u6307\u5b9a<\/b>\u3067\u3059\u3002\u7247\u65b9\u3060\u3051\u3067\u306f\u6b63\u3057\u304f\u7a4d\u307f\u4e0a\u304c\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre><code class=\"language-javascript\">\/\/ datasets\u306e\u5404bar\u306b\u6307\u5b9a\nstack: &#39;sales&#39;\n\n\/\/ options\u306escales.y\u306b\u6307\u5b9a\ny: { stacked: true }\n<\/code><\/pre>\n<h3 class=\"fz-ml\">\u68d2\u306e\u5e45\u3092\u8abf\u6574\u3059\u308b<\/h3>\n<p><code>barPercentage<\/code> \u3068 <code>categoryPercentage<\/code> \u306e2\u3064\u3092<b class=\"fw-600\">\u5168bar\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u540c\u3058\u5024<\/b>\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-javascript\">barPercentage: 0.5,      \/\/ \u30ab\u30c6\u30b4\u30ea\u5185\u306e\u68d2\u306e\u5e45\uff080\u301c1\uff09\ncategoryPercentage: 0.6  \/\/ \u30ab\u30c6\u30b4\u30ea\u5168\u4f53\u306b\u5bfe\u3059\u308b\u5360\u6709\u7387\uff080\u301c1\uff09\n<\/code><\/pre>\n<table class=\"table my-0.75r\">\n  <thead>\n    <tr class=\"rung\">\n      <th>barPercentage<\/th>\n      <td>categoryPercentage<\/td>\n      <td>\u898b\u305f\u76ee<\/td>\n    <\/tr>\n  <\/thead>\n  <tbody>\n    <tr class=\"rung\">\n      <th>0.8<\/th>\n      <td>0.8<\/td>\n      <td>\u30c7\u30d5\u30a9\u30eb\u30c8\uff08\u592a\u3081\uff09<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>0.5<\/th>\n      <td>0.6<\/td>\n      <td>\u4e2d\u7d30<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>0.3<\/th>\n      <td>0.5<\/td>\n      <td>\u7d30\u3081<\/td>\n    <\/tr>\n  <\/tbody>\n<\/table>\n<p>\u3069\u3061\u3089\u304b\u4e00\u65b9\u3060\u3051\u5909\u3048\u3066\u3082\u52b9\u679c\u304c\u8584\u3044\u306e\u3067\u30012\u3064\u30bb\u30c3\u30c8\u3067\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n<h3 class=\"fz-ml\">\u8ef8\u306b\u5358\u4f4d\u3092\u4ed8\u3051\u308b<\/h3>\n<p><code>ticks.callback<\/code> \u3067\u8ef8\u30e9\u30d9\u30eb\u306b\u5358\u4f4d\u3092\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-javascript\">ticks: {\n  callback: value =&gt; value.toLocaleString() + &#39;\u4e07&#39;\n}\n<\/code><\/pre>\n<p><code>toLocaleString()<\/code> \u3092\u4f7f\u3046\u3068\u3001<code>2000<\/code> \u2192 <code>2,000\u4e07<\/code> \u306e\u3088\u3046\u306b\u30ab\u30f3\u30de\u533a\u5207\u308a\u306b\u3082\u306a\u3063\u3066\u898b\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 class=\"fz-ml\">\u53f3\u8ef8\u306e\u30b0\u30ea\u30c3\u30c9\u7dda\u3092\u975e\u8868\u793a\u306b\u3059\u308b<\/h3>\n<p>\u53f3\u8ef8\u3092\u8ffd\u52a0\u3059\u308b\u3068\u5de6\u8ef8\u3068\u4e8c\u91cd\u306b\u30b0\u30ea\u30c3\u30c9\u7dda\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<code>drawOnChartArea: false<\/code> \u3067\u53f3\u8ef8\u5074\u306e\u30b0\u30ea\u30c3\u30c9\u3092\u975e\u8868\u793a\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-javascript\">y2: {\n  position: &#39;right&#39;,\n  grid: {\n    drawOnChartArea: false\n  }\n}\n<\/code><\/pre>\n<h3 class=\"fz-ml\">\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b<\/h3>\n<p><code>interaction.mode: &#39;index&#39;<\/code> \u306b\u3059\u308b\u3068\u3001\u30db\u30d0\u30fc\u6642\u306b\u540c\u3058X\u4f4d\u7f6e\u306e\u5168\u7cfb\u5217\u3092\u307e\u3068\u3081\u3066\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-javascript\">interaction: {\n  mode: &#39;index&#39;,\n  intersect: false\n},\nplugins: {\n  tooltip: {\n    callbacks: {\n      label: ctx =&gt; `${ctx.dataset.label}: ${ctx.parsed.y.toLocaleString()}\u4e07\u5186`\n    }\n  }\n}\n<\/code><\/pre>\n<h3 class=\"fz-ml\">\u30c7\u30d5\u30a9\u30eb\u30c8\u51e1\u4f8b\u3092\u975e\u8868\u793a\u306b\u3059\u308b<\/h3>\n<p>Chart.js\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u51e1\u4f8b\u306f\u4e38\u30a2\u30a4\u30b3\u30f3\u3067\u898b\u305f\u76ee\u304c\u3044\u307e\u3044\u3061\u3067\u3059\u3002<code>legend.display: false<\/code> \u3067\u975e\u8868\u793a\u306b\u3057\u3066\u3001HTML\u3067\u72ec\u81ea\u306e\u51e1\u4f8b\u3092\u4f5c\u308b\u65b9\u304c\u67d4\u8edf\u306b\u898b\u305f\u76ee\u3092\u6574\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-javascript\">plugins: {\n  legend: { display: false }\n}\n<\/code><\/pre>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">\u307e\u3068\u3081<\/h2>\n<p>Chart.js\u3067\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u308b\u3068\u304d\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\n  <li><code>stack<\/code> \u306e\u540d\u524d\u3092\u63c3\u3048\u308b \uff0b <code>scales.y.stacked: true<\/code> \u306e<b class=\"fw-600\">\u4e21\u65b9\u304c\u5fc5\u8981<\/b><\/li>\n  <li>\u6298\u308c\u7dda\u3068\u306e\u6df7\u5408\u306f dataset\u5358\u4f4d\u3067 <code>type<\/code> \u3092\u6307\u5b9a\u3059\u308b\u3060\u3051<\/li>\n  <li>\u53f3\u8ef8\u306f <code>yAxisID<\/code> \u3067\u7d10\u4ed8\u3051\u3066 <code>scales<\/code> \u306b\u8ffd\u52a0\u3059\u308b<\/li>\n  <li>\u68d2\u306e\u592a\u3055\u306f <code>barPercentage<\/code> \u3068 <code>categoryPercentage<\/code> \u3067\u8abf\u6574\uff08\u5168bar\u7cfb\u5217\u306b\u540c\u3058\u5024\u3092\uff09<\/li>\n  <li>\u51e1\u4f8b\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u975e\u8868\u793a\u306b\u3057\u3066HTML\u3067\u4f5c\u308b\u65b9\u304c\u67d4\u8edf<\/li>\n  <li>\u8ef8\u30e9\u30d9\u30eb\u306f <code>ticks.callback<\/code> \u3067\u5358\u4f4d\u4ed8\u304d\u306b\u3067\u304d\u308b<\/li>\n<\/ul>\n\n<hr class=\"separator mx-auto mt-3r\" \/>\n\n<h2 class=\"fz-xl\">\u95a2\u9023\u8a18\u4e8b<\/h2>\n\n<a href=\"https:\/\/code-plus.jp\/gp\/chart-js-12391\/\" class=\"linkbox my-1.5r\">\n<h4 class=\"linkbox-title fz-md\">Chart.js\u3067\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u308b\u304b\u3093\u305f\u3093\u306a\u4f7f\u3044\u65b9\u3010\u30b3\u30d4\u30daOK\u3011<\/h4>\n<picture class=\"linkbox-thumbnail\">\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/SS-20260529-125518.jpg?ver=20261027194002\" alt=\"Chart.js\u3067\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u308b\u304b\u3093\u305f\u3093\u306a\u4f7f\u3044\u65b9\u3010\u30b3\u30d4\u30daOK\u3011\" loading=\"lazy\" \/>\n<\/picture>\n<span class=\"linkbox-excerpt\">Chart.js\u3092\u4f7f\u3063\u3066\u30b7\u30f3\u30d7\u30eb\u306a\u68d2\u30b0\u30e9\u30d5\u3092\u3059\u3050\u4f5c\u308c\u308b\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3002CDN\u8aad\u307f\u8fbc\u307f\u304b\u3089\u68d2\u306e\u8272\u30fb\u5e45\u30fb\u8ef8\u30e9\u30d9\u30eb\u30fb\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u307e\u3067\u3001\u624b\u3063\u53d6\u308a\u65e9\u304f\u5b9f\u88c5\u3057\u305f\u3044\u4eba\u5411\u3051\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002Chart.js, \u68d2\u30b0\u30e9\u30d5, JavaScript, \u30b0\u30e9\u30d5\u4f5c\u6210,...\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\n<\/span>\n<\/a>","protected":false},"excerpt":{"rendered":"Chart.js\u3092\u4f7f\u3063\u3066\u7a4d\u307f\u4e0a\u3052\u68d2\u30b0\u30e9\u30d5\u3092\u3059\u3050\u4f5c\u308c\u308b\u3088\u3046\u306b\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3002CDN\u306e\u8aad\u307f\u8fbc\u307f\u304b\u3089\u3001\u68d2\u306e\u8272\u30fb\u5e45\u30fb\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u306a\u3069\u3088\u304f\u4f7f\u3046\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u307e\u3067\u3001\u624b\u3063\u53d6\u308a\u65e9\u304f\u5b9f\u88c5\u3057\u305f\u3044\u4eba\u5411\u3051\u306b\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002","protected":false},"author":1,"featured_media":15643,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[8],"tags":[799,806,805,804,803,802,801,800,155,148],"group":[],"pg":[],"class_list":["post-11928","post","type-post","status-publish","format-standard","has-post-thumbnail","category-javascript","tag-799","tag-categorypercentage","tag-barpercentage","tag-chart-umd-js","tag-803","tag-802","tag-chart-js","tag-800","tag-cdn","tag-javascript"],"acf":[],"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=11928"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11928\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/15643"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=11928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=11928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=11928"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=11928"},{"taxonomy":"pg","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pg?post=11928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}