{"id":2601,"date":"2022-09-19T15:54:52","date_gmt":"2022-09-19T06:54:52","guid":{"rendered":"https:\/\/mattarishitemota.com\/?p=2601"},"modified":"2022-09-19T15:58:38","modified_gmt":"2022-09-19T06:58:38","slug":"ngx-chartjs%e3%81%a7time%e3%82%b9%e3%82%b1%e3%83%bc%e3%83%ab%e3%82%92%e4%bd%bf%e3%81%8a%e3%81%86%e3%81%a8%e3%81%99%e3%82%8b%e3%81%a8%e3%80%81adapter%e3%81%8c%e5%bf%85%e8%a6%81%e3%81%a8%e3%81%ae","status":"publish","type":"post","link":"https:\/\/mattarishitemota.com\/?p=2601","title":{"rendered":"ngx-chartjs\u3067time\u30b9\u30b1\u30fc\u30eb\u3092\u4f7f\u304a\u3046\u3068\u3059\u308b\u3068\u3001adapter\u304c\u5fc5\u8981\u3068\u306e\u30a8\u30e9\u30fc"},"content":{"rendered":"\n<p>\u516c\u5f0f\u306e\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb\u3067\u306f X \u8ef8\u306f\u30ab\u30c6\u30b4\u30ea\u30b9\u30b1\u30fc\u30eb\u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/scttcper\/ngx-chartjs#use\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/scttcper\/ngx-chartjs#use<\/a><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\" data-line=\"3,7,12\"><code>import {\n  \/\/ \u7701\u7565\n  CategoryScale,\n  LinearScale,\n  \/\/ \u7701\u7565\n} from &#39;chart.js&#39;;\nChart.register(BarController, BarElement, CategoryScale, LinearScale, Title, Tooltip, Legend);\n\n\/\/ \u7701\u7565\n\nconst data: ChartData = {\n  labels: [&#39;January&#39;, &#39;February&#39;, &#39;March&#39;, &#39;April&#39;, &#39;May&#39;, &#39;June&#39;, &#39;July&#39;],\n  \/\/ \u4ee5\u4e0b\u7565<\/code><\/pre><\/div>\n\n\n\n<p>X \u8ef8\u304c\u6642\u7cfb\u5217\u306e\u6298\u308c\u7dda\u30b0\u30e9\u30d5\u306b\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u4e0b\u8a18\u306e\u901a\u308a\u5909\u66f4\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\" data-line=\"7,15\"><code>import {\n  Chart,\n  LineController,\n  LineElement,\n  PointElement,\n  LinearScale,\n  TimeScale,\n  Tooltip,\n} from &#39;chart.js&#39;;\nChart.register(LineController, LineElement, PointElement, LinearScale, TimeScale, Tooltip);\n\n\/\/ \u30c7\u30fc\u30bf\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b Unix \u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7(\u30df\u30ea\u79d2) \u3092\u30bb\u30c3\u30c8\n    const data = this.records.map(record =&gt; {\n      return {\n        x: moment(record.date).valueOf(),\n        y: record.value,\n      }\n    });\n<\/code><\/pre><\/div>\n\n\n\n<p>\u305f\u3060\u3001\u3053\u308c\u3060\u3051\u3060\u3068\u5b9f\u884c\u6642\u306b\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-verse\">zone.js:1061 Unhandled Promise rejection: This method is not implemented: Check that a complete date adapter is provided. ; Zone: &lt;root> ; Task: Promise.then ; Value: Error: This method is not implemented: Check that a complete date adapter is provided.\n    at abstract (chart.mjs:4151:9)\n    at DateAdapter.formats (chart.mjs:4159:12)\n    at TimeScale.init (chart.mjs:10406:42)\n    at chart.mjs:5601:13\n    at each (helpers.segment.mjs:60:12)\n    at Chart.buildOrUpdateScales (chart.mjs:5579:9)\n    at Chart._updateScales (chart.mjs:5726:10)\n    at Chart.update (chart.mjs:5687:10)\n    at new Chart (chart.mjs:5476:12)\n    at ctrl-ngx-chartjs.mjs:36:34 Error: This method is not implemented: Check that a complete date adapter is provided.\n    at abstract (http:\/\/localhost:4200\/vendor.js:202509:9)\n    at DateAdapter.formats (http:\/\/localhost:4200\/vendor.js:202520:12)\n    at TimeScale.init (http:\/\/localhost:4200\/vendor.js:210870:98)\n    at http:\/\/localhost:4200\/vendor.js:204396:13\n    at each (http:\/\/localhost:4200\/vendor.js:211549:12)\n    at Chart.buildOrUpdateScales (http:\/\/localhost:4200\/vendor.js:204370:67)\n    at Chart._updateScales (http:\/\/localhost:4200\/vendor.js:204576:10)\n    at Chart.update (http:\/\/localhost:4200\/vendor.js:204511:10)\n    at new Chart (http:\/\/localhost:4200\/vendor.js:204234:12)\n    at http:\/\/localhost:4200\/vendor.js:186409:29<\/pre>\n\n\n\n<p>Chart.js \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u898b\u308b\u3068\u300cDate \u30e9\u30a4\u30d6\u30e9\u30ea\u300d\u3068\u300c\u5bfe\u5fdc\u3059\u308b Adapter\u300d\u304c\u5fc5\u8981\u3068\u306e\u3053\u3068\u3002<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/www.chartjs.org\/docs\/latest\/axes\/cartesian\/time.html#date-adapters\" target=\"_blank\">https:\/\/www.chartjs.org\/docs\/latest\/axes\/cartesian\/time.html#date-adapters<\/a><\/p>\n\n\n\n<p>\u5143\u3005 Moment.js \u3092\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3001<code>npm install chartjs-adapter-moment<\/code> \u3057\u3001app.module.ts \u3067\u30a4\u30f3\u30dd\u30fc\u30c8\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\" data-line=\"11\"><code>import {\n  Chart,\n  LineController,\n  LineElement,\n  PointElement,\n  LinearScale,\n  TimeScale,\n  Tooltip,\n} from &#39;chart.js&#39;;\nChart.register(LineController, LineElement, PointElement, LinearScale, TimeScale, Tooltip);\nimport &#39;chartjs-adapter-moment&#39;;<\/code><\/pre><\/div>\n\n\n\n<p>\u3088\u3046\u3084\u304f\u8868\u793a\u3067\u304d\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"154\" src=\"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/f30e6cd318ca4aa61ea271f4a7757fbb.png?resize=300%2C154&#038;ssl=1\" alt=\"\" class=\"wp-image-2623\" srcset=\"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/f30e6cd318ca4aa61ea271f4a7757fbb.png?resize=300%2C154&amp;ssl=1 300w, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/f30e6cd318ca4aa61ea271f4a7757fbb.png?resize=768%2C393&amp;ssl=1 768w, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/f30e6cd318ca4aa61ea271f4a7757fbb.png?w=980&amp;ssl=1 980w\" sizes=\"(max-width: 300px) 100vw, 300px\" data-recalc-dims=\"1\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u516c\u5f0f\u306e\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb\u3067\u306f X \u8ef8\u306f\u30ab\u30c6\u30b4\u30ea\u30b9\u30b1\u30fc\u30eb\u306b\u306a\u3063\u3066\u3044\u308b\u3002 https:\/\/github.com\/scttcper\/ngx-chartjs#use X \u8ef8\u304c\u6642\u7cfb\u5217\u306e\u6298\u308c\u7dda\u30b0\u30e9\u30d5\u306b\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3001\u4e0b\u8a18\u306e\u901a\u308a\u5909\u66f4\u3002 \u305f <span class=\"more-text\">&hellip;<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[23,33],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2615,"url":"https:\/\/mattarishitemota.com\/?p=2615","url_meta":{"origin":2601,"position":0},"title":"Chart.js\u3067\u30c4\u30fc\u30eb\u30c1\u30c3\u30d7\u8868\u793a\u6642\u306b\u30a4\u30d9\u30f3\u30c8\u51e6\u7406\u3057\u305f\u3044","author":"Owner","date":"2022\u5e749\u670819\u65e5","format":false,"excerpt":"Chart.js \u3067\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3057\u3066\u3044\u3066\u3001\u30b0\u30e9\u30d5\u4e0a\u306e\u70b9\uff08Point\uff09\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642\u306b\u3001\u305d\u306e\u30c7\u30fc\u30bf\u3092\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/d5da8785ea31b3e1b947f604d0df1c4f.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2612,"url":"https:\/\/mattarishitemota.com\/?p=2612","url_meta":{"origin":2601,"position":1},"title":"Chart.js\u306eonHover\u30a4\u30d9\u30f3\u30c8\u3067\u30c7\u30fc\u30bf\u66f4\u65b0\u3057\u3066\u3082\u5909\u66f4\u691c\u77e5\u3055\u308c\u306a\u3044","author":"Owner","date":"2022\u5e749\u670819\u65e5","format":false,"excerpt":"Chart.js \u3067\u8868\u793a\u3057\u305f\u30b0\u30e9\u30d5\u304b\u3089\u3001\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3002 \u30c7\u30fc\u30bf\u70b9\u3092\u30af\u30ea\u30c3\u30af\u3057\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2584,"url":"https:\/\/mattarishitemota.com\/?p=2584","url_meta":{"origin":2601,"position":2},"title":"ng2-charts\u3067generate\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc","author":"Owner","date":"2022\u5e749\u67083\u65e5","format":false,"excerpt":"\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u5f93\u3063\u3066 ng generate ng2-charts:line \u3067\u751f\u6210\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/2fbf7a3903c6ecc158f2577ec157ebb6.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/2fbf7a3903c6ecc158f2577ec157ebb6.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/2fbf7a3903c6ecc158f2577ec157ebb6.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/2fbf7a3903c6ecc158f2577ec157ebb6.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2567,"url":"https:\/\/mattarishitemota.com\/?p=2567","url_meta":{"origin":2601,"position":3},"title":"AngularFire \u3067 Realtime Database \u3092\u4f7f\u304a\u3046\u3068\u3059\u308b\u3068 NullInjectorError","author":"Owner","date":"2022\u5e748\u670818\u65e5","format":false,"excerpt":"ng add @angular\/fire \u3057\u3066\u8868\u793a\u3055\u308c\u305f\u30e1\u30cb\u30e5\u30fc\u3067 Realtime Databas\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":816,"url":"https:\/\/mattarishitemota.com\/?p=816","url_meta":{"origin":2601,"position":4},"title":"ng serve &#8211;build \u3067 GC \u30a8\u30e9\u30fc","author":"Owner","date":"2020\u5e745\u670823\u65e5","format":false,"excerpt":"ng serve --build \u3057\u305f\u6642\u306b\u3001\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u3067\u5931\u6557\u3057\u305f\u3002GC \u3067\u30e1\u30e2\u30ea\u4e0d\u8db3\u306b\u306a\u3063\u305f\u69d8\u5b50\u3002\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2432,"url":"https:\/\/mattarishitemota.com\/?p=2432","url_meta":{"origin":2601,"position":5},"title":"Konva.js \u3067\u3069\u3046\u3057\u3066\u3082\u6587\u5b57\u304c\u306b\u3058\u3093\u3067\u898b\u3048\u308b\u6642\u306f","author":"Owner","date":"2022\u5e744\u670816\u65e5","format":false,"excerpt":"Konva.js \u306e Text \u3067\u6587\u5b57\u3092\u66f8\u304d\u51fa\u3057\u3066\u3044\u308b\u306e\u3060\u304c\u3001\u3069\u3046\u3057\u3066\u3082\u6587\u5b57\u304c\u306b\u3058\u3093\u3067\u898b\u3048\u3066\u6c17\u306b\u306a\u3063\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/2601"}],"collection":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2601"}],"version-history":[{"count":10,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/2601\/revisions"}],"predecessor-version":[{"id":2632,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/2601\/revisions\/2632"}],"wp:attachment":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}