Add d3 chart lib
This commit is contained in:
pare
f04d95ff84
commit
ec4fc0c711
S'han modificat 5 arxius amb 592 adicions i 1 eliminacions
|
@ -26,8 +26,10 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.11.6",
|
"@popperjs/core": "^2.11.6",
|
||||||
|
"@types/d3": "^7.4.0",
|
||||||
"chart.js": "^4.2.0",
|
"chart.js": "^4.2.0",
|
||||||
"classnames": "^2.3.2",
|
"classnames": "^2.3.2",
|
||||||
|
"d3": "^7.8.2",
|
||||||
"flowbite": "^1.6.3",
|
"flowbite": "^1.6.3",
|
||||||
"flowbite-svelte": "^0.30.4",
|
"flowbite-svelte": "^0.30.4",
|
||||||
"highcharts": "^10.3.3",
|
"highcharts": "^10.3.3",
|
||||||
|
|
404
pnpm-lock.yaml
404
pnpm-lock.yaml
|
@ -4,9 +4,11 @@ specifiers:
|
||||||
'@popperjs/core': ^2.11.6
|
'@popperjs/core': ^2.11.6
|
||||||
'@sveltejs/adapter-auto': ^1.0.3
|
'@sveltejs/adapter-auto': ^1.0.3
|
||||||
'@sveltejs/kit': ^1.5.0
|
'@sveltejs/kit': ^1.5.0
|
||||||
|
'@types/d3': ^7.4.0
|
||||||
autoprefixer: ^10.4.7
|
autoprefixer: ^10.4.7
|
||||||
chart.js: ^4.2.0
|
chart.js: ^4.2.0
|
||||||
classnames: ^2.3.2
|
classnames: ^2.3.2
|
||||||
|
d3: ^7.8.2
|
||||||
flowbite: ^1.6.3
|
flowbite: ^1.6.3
|
||||||
flowbite-svelte: ^0.30.4
|
flowbite-svelte: ^0.30.4
|
||||||
highcharts: ^10.3.3
|
highcharts: ^10.3.3
|
||||||
|
@ -24,8 +26,10 @@ specifiers:
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@popperjs/core': 2.11.6
|
'@popperjs/core': 2.11.6
|
||||||
|
'@types/d3': 7.4.0
|
||||||
chart.js: 4.2.0
|
chart.js: 4.2.0
|
||||||
classnames: 2.3.2
|
classnames: 2.3.2
|
||||||
|
d3: 7.8.2
|
||||||
flowbite: 1.6.3
|
flowbite: 1.6.3
|
||||||
flowbite-svelte: 0.30.4_gvo3oetiwnc3nogynwkaz6jdxe
|
flowbite-svelte: 0.30.4_gvo3oetiwnc3nogynwkaz6jdxe
|
||||||
highcharts: 10.3.3
|
highcharts: 10.3.3
|
||||||
|
@ -355,6 +359,189 @@ packages:
|
||||||
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@types/d3-array/3.0.4:
|
||||||
|
resolution: {integrity: sha512-nwvEkG9vYOc0Ic7G7kwgviY4AQlTfYGIZ0fqB7CQHXGyYM6nO7kJh5EguSNA3jfh4rq7Sb7eMVq8isuvg2/miQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-axis/3.0.2:
|
||||||
|
resolution: {integrity: sha512-uGC7DBh0TZrU/LY43Fd8Qr+2ja1FKmH07q2FoZFHo1eYl8aj87GhfVoY1saJVJiq24rp1+wpI6BvQJMKgQm8oA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-brush/3.0.2:
|
||||||
|
resolution: {integrity: sha512-2TEm8KzUG3N7z0TrSKPmbxByBx54M+S9lHoP2J55QuLU0VSQ9mE96EJSAOVNEqd1bbynMjeTS9VHmz8/bSw8rA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-chord/3.0.2:
|
||||||
|
resolution: {integrity: sha512-abT/iLHD3sGZwqMTX1TYCMEulr+wBd0SzyOQnjYNLp7sngdOHYtNkMRI5v3w5thoN+BWtlHVDx2Osvq6fxhZWw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-color/3.1.0:
|
||||||
|
resolution: {integrity: sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-contour/3.0.2:
|
||||||
|
resolution: {integrity: sha512-k6/bGDoAGJZnZWaKzeB+9glgXCYGvh6YlluxzBREiVo8f/X2vpTEdgPy9DN7Z2i42PZOZ4JDhVdlTSTSkLDPlQ==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-array': 3.0.4
|
||||||
|
'@types/geojson': 7946.0.10
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-delaunay/6.0.1:
|
||||||
|
resolution: {integrity: sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-dispatch/3.0.2:
|
||||||
|
resolution: {integrity: sha512-rxN6sHUXEZYCKV05MEh4z4WpPSqIw+aP7n9ZN6WYAAvZoEAghEK1WeVZMZcHRBwyaKflU43PCUAJNjFxCzPDjg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-drag/3.0.2:
|
||||||
|
resolution: {integrity: sha512-qmODKEDvyKWVHcWWCOVcuVcOwikLVsyc4q4EBJMREsoQnR2Qoc2cZQUyFUPgO9q4S3qdSqJKBsuefv+h0Qy+tw==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-dsv/3.0.1:
|
||||||
|
resolution: {integrity: sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-ease/3.0.0:
|
||||||
|
resolution: {integrity: sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-fetch/3.0.2:
|
||||||
|
resolution: {integrity: sha512-gllwYWozWfbep16N9fByNBDTkJW/SyhH6SGRlXloR7WdtAaBui4plTP+gbUgiEot7vGw/ZZop1yDZlgXXSuzjA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-dsv': 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-force/3.0.4:
|
||||||
|
resolution: {integrity: sha512-q7xbVLrWcXvSBBEoadowIUJ7sRpS1yvgMWnzHJggFy5cUZBq2HZL5k/pBSm0GdYWS1vs5/EDwMjSKF55PDY4Aw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-format/3.0.1:
|
||||||
|
resolution: {integrity: sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-geo/3.0.3:
|
||||||
|
resolution: {integrity: sha512-bK9uZJS3vuDCNeeXQ4z3u0E7OeJZXjUgzFdSOtNtMCJCLvDtWDwfpRVWlyt3y8EvRzI0ccOu9xlMVirawolSCw==}
|
||||||
|
dependencies:
|
||||||
|
'@types/geojson': 7946.0.10
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-hierarchy/3.1.2:
|
||||||
|
resolution: {integrity: sha512-9hjRTVoZjRFR6xo8igAJyNXQyPX6Aq++Nhb5ebrUF414dv4jr2MitM2fWiOY475wa3Za7TOS2Gh9fmqEhLTt0A==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-interpolate/3.0.1:
|
||||||
|
resolution: {integrity: sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-color': 3.1.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-path/3.0.0:
|
||||||
|
resolution: {integrity: sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-polygon/3.0.0:
|
||||||
|
resolution: {integrity: sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-quadtree/3.0.2:
|
||||||
|
resolution: {integrity: sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-random/3.0.1:
|
||||||
|
resolution: {integrity: sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-scale-chromatic/3.0.0:
|
||||||
|
resolution: {integrity: sha512-dsoJGEIShosKVRBZB0Vo3C8nqSDqVGujJU6tPznsBJxNJNwMF8utmS83nvCBKQYPpjCzaaHcrf66iTRpZosLPw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-scale/4.0.3:
|
||||||
|
resolution: {integrity: sha512-PATBiMCpvHJSMtZAMEhc2WyL+hnzarKzI6wAHYjhsonjWJYGq5BXTzQjv4l8m2jO183/4wZ90rKvSeT7o72xNQ==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-time': 3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-selection/3.0.4:
|
||||||
|
resolution: {integrity: sha512-ZeykX7286BCyMg9sH5fIAORyCB6hcATPSRQpN47jwBA2bMbAT0s+EvtDP5r1FZYJ95R8QoEE1CKJX+n0/M5Vhg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-shape/3.1.1:
|
||||||
|
resolution: {integrity: sha512-6Uh86YFF7LGg4PQkuO2oG6EMBRLuW9cbavUW46zkIO5kuS2PfTqo2o9SkgtQzguBHbLgNnU90UNsITpsX1My+A==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-path': 3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-time-format/4.0.0:
|
||||||
|
resolution: {integrity: sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-time/3.0.0:
|
||||||
|
resolution: {integrity: sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-timer/3.0.0:
|
||||||
|
resolution: {integrity: sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-transition/3.0.3:
|
||||||
|
resolution: {integrity: sha512-/S90Od8Id1wgQNvIA8iFv9jRhCiZcGhPd2qX0bKF/PS+y0W5CrXKgIiELd2CvG1mlQrWK/qlYh3VxicqG1ZvgA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3-zoom/3.0.2:
|
||||||
|
resolution: {integrity: sha512-t09DDJVBI6AkM7N8kuPsnq/3d/ehtRKBN1xSiYjjMCgbiw6HM6Ged5VhvswmhprfKyGvzeTEL/4WBaK9llWvlA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-interpolate': 3.0.1
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/d3/7.4.0:
|
||||||
|
resolution: {integrity: sha512-jIfNVK0ZlxcuRDKtRS/SypEyOQ6UHaFQBKv032X45VvxSJ6Yi5G9behy9h6tNTHTDGh5Vq+KbmBjUWLgY4meCA==}
|
||||||
|
dependencies:
|
||||||
|
'@types/d3-array': 3.0.4
|
||||||
|
'@types/d3-axis': 3.0.2
|
||||||
|
'@types/d3-brush': 3.0.2
|
||||||
|
'@types/d3-chord': 3.0.2
|
||||||
|
'@types/d3-color': 3.1.0
|
||||||
|
'@types/d3-contour': 3.0.2
|
||||||
|
'@types/d3-delaunay': 6.0.1
|
||||||
|
'@types/d3-dispatch': 3.0.2
|
||||||
|
'@types/d3-drag': 3.0.2
|
||||||
|
'@types/d3-dsv': 3.0.1
|
||||||
|
'@types/d3-ease': 3.0.0
|
||||||
|
'@types/d3-fetch': 3.0.2
|
||||||
|
'@types/d3-force': 3.0.4
|
||||||
|
'@types/d3-format': 3.0.1
|
||||||
|
'@types/d3-geo': 3.0.3
|
||||||
|
'@types/d3-hierarchy': 3.1.2
|
||||||
|
'@types/d3-interpolate': 3.0.1
|
||||||
|
'@types/d3-path': 3.0.0
|
||||||
|
'@types/d3-polygon': 3.0.0
|
||||||
|
'@types/d3-quadtree': 3.0.2
|
||||||
|
'@types/d3-random': 3.0.1
|
||||||
|
'@types/d3-scale': 4.0.3
|
||||||
|
'@types/d3-scale-chromatic': 3.0.0
|
||||||
|
'@types/d3-selection': 3.0.4
|
||||||
|
'@types/d3-shape': 3.1.1
|
||||||
|
'@types/d3-time': 3.0.0
|
||||||
|
'@types/d3-time-format': 4.0.0
|
||||||
|
'@types/d3-timer': 3.0.0
|
||||||
|
'@types/d3-transition': 3.0.3
|
||||||
|
'@types/d3-zoom': 3.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@types/geojson/7946.0.10:
|
||||||
|
resolution: {integrity: sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/node/18.13.0:
|
/@types/node/18.13.0:
|
||||||
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
|
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -505,6 +692,11 @@ packages:
|
||||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/commander/7.2.0:
|
||||||
|
resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
|
||||||
|
engines: {node: '>= 10'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/concat-map/0.0.1:
|
/concat-map/0.0.1:
|
||||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -527,16 +719,109 @@ packages:
|
||||||
internmap: 2.0.3
|
internmap: 2.0.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-axis/3.0.0:
|
||||||
|
resolution: {integrity: sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-brush/3.0.0:
|
||||||
|
resolution: {integrity: sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-drag: 3.0.0
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
d3-selection: 3.0.0
|
||||||
|
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-chord/3.0.1:
|
||||||
|
resolution: {integrity: sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-path: 3.1.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/d3-color/3.1.0:
|
/d3-color/3.1.0:
|
||||||
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
|
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-contour/4.0.2:
|
||||||
|
resolution: {integrity: sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-array: 3.2.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-delaunay/6.0.2:
|
||||||
|
resolution: {integrity: sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
delaunator: 5.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-dispatch/3.0.1:
|
||||||
|
resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-drag/3.0.0:
|
||||||
|
resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-selection: 3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-dsv/3.0.1:
|
||||||
|
resolution: {integrity: sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
commander: 7.2.0
|
||||||
|
iconv-lite: 0.6.3
|
||||||
|
rw: 1.3.3
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-ease/3.0.1:
|
||||||
|
resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-fetch/3.0.1:
|
||||||
|
resolution: {integrity: sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-dsv: 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-force/3.0.0:
|
||||||
|
resolution: {integrity: sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-quadtree: 3.0.1
|
||||||
|
d3-timer: 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/d3-format/3.1.0:
|
/d3-format/3.1.0:
|
||||||
resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==}
|
resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-geo/3.1.0:
|
||||||
|
resolution: {integrity: sha512-JEo5HxXDdDYXCaWdwLRt79y7giK8SbhZJbFWXqbRTolCHFI5jRqteLzCsq51NKbUoX0PjBVSohxrx+NoOUujYA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-array: 3.2.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-hierarchy/3.1.2:
|
||||||
|
resolution: {integrity: sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/d3-interpolate/3.0.1:
|
/d3-interpolate/3.0.1:
|
||||||
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
|
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -549,6 +834,29 @@ packages:
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-polygon/3.0.1:
|
||||||
|
resolution: {integrity: sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-quadtree/3.0.1:
|
||||||
|
resolution: {integrity: sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-random/3.0.1:
|
||||||
|
resolution: {integrity: sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-scale-chromatic/3.0.0:
|
||||||
|
resolution: {integrity: sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-color: 3.1.0
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/d3-scale/4.0.2:
|
/d3-scale/4.0.2:
|
||||||
resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
|
resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -560,6 +868,11 @@ packages:
|
||||||
d3-time-format: 4.1.0
|
d3-time-format: 4.1.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-selection/3.0.0:
|
||||||
|
resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/d3-shape/3.2.0:
|
/d3-shape/3.2.0:
|
||||||
resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==}
|
resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
@ -581,6 +894,72 @@ packages:
|
||||||
d3-array: 3.2.2
|
d3-array: 3.2.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/d3-timer/3.0.1:
|
||||||
|
resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-transition/3.0.1_d3-selection@3.0.0:
|
||||||
|
resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
peerDependencies:
|
||||||
|
d3-selection: 2 - 3
|
||||||
|
dependencies:
|
||||||
|
d3-color: 3.1.0
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-ease: 3.0.1
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
d3-selection: 3.0.0
|
||||||
|
d3-timer: 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3-zoom/3.0.0:
|
||||||
|
resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-drag: 3.0.0
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
d3-selection: 3.0.0
|
||||||
|
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/d3/7.8.2:
|
||||||
|
resolution: {integrity: sha512-WXty7qOGSHb7HR7CfOzwN1Gw04MUOzN8qh9ZUsvwycIMb4DYMpY9xczZ6jUorGtO6bR9BPMPaueIKwiDxu9uiQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dependencies:
|
||||||
|
d3-array: 3.2.2
|
||||||
|
d3-axis: 3.0.0
|
||||||
|
d3-brush: 3.0.0
|
||||||
|
d3-chord: 3.0.1
|
||||||
|
d3-color: 3.1.0
|
||||||
|
d3-contour: 4.0.2
|
||||||
|
d3-delaunay: 6.0.2
|
||||||
|
d3-dispatch: 3.0.1
|
||||||
|
d3-drag: 3.0.0
|
||||||
|
d3-dsv: 3.0.1
|
||||||
|
d3-ease: 3.0.1
|
||||||
|
d3-fetch: 3.0.1
|
||||||
|
d3-force: 3.0.0
|
||||||
|
d3-format: 3.1.0
|
||||||
|
d3-geo: 3.1.0
|
||||||
|
d3-hierarchy: 3.1.2
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
d3-path: 3.1.0
|
||||||
|
d3-polygon: 3.0.1
|
||||||
|
d3-quadtree: 3.0.1
|
||||||
|
d3-random: 3.0.1
|
||||||
|
d3-scale: 4.0.2
|
||||||
|
d3-scale-chromatic: 3.0.0
|
||||||
|
d3-selection: 3.0.0
|
||||||
|
d3-shape: 3.2.0
|
||||||
|
d3-time: 3.1.0
|
||||||
|
d3-time-format: 4.1.0
|
||||||
|
d3-timer: 3.0.1
|
||||||
|
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||||
|
d3-zoom: 3.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/debug/4.3.4:
|
/debug/4.3.4:
|
||||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
|
@ -602,6 +981,12 @@ packages:
|
||||||
resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==}
|
resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/delaunator/5.0.0:
|
||||||
|
resolution: {integrity: sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==}
|
||||||
|
dependencies:
|
||||||
|
robust-predicates: 3.0.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/detect-indent/6.1.0:
|
/detect-indent/6.1.0:
|
||||||
resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
|
resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -790,6 +1175,13 @@ packages:
|
||||||
resolution: {integrity: sha512-r7wgUPQI9tr3jFDn3XT36qsNwEIZYcfgz4mkKEA6E4nn5p86y+u1EZjazIG4TRkl5/gmGRtkBUiZW81g029RIw==}
|
resolution: {integrity: sha512-r7wgUPQI9tr3jFDn3XT36qsNwEIZYcfgz4mkKEA6E4nn5p86y+u1EZjazIG4TRkl5/gmGRtkBUiZW81g029RIw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/iconv-lite/0.6.3:
|
||||||
|
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
|
||||||
|
engines: {node: '>=0.10.0'}
|
||||||
|
dependencies:
|
||||||
|
safer-buffer: 2.1.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
/import-fresh/3.3.0:
|
/import-fresh/3.3.0:
|
||||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
@ -1135,6 +1527,10 @@ packages:
|
||||||
glob: 7.2.3
|
glob: 7.2.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/robust-predicates/3.0.1:
|
||||||
|
resolution: {integrity: sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/rollup/3.14.0:
|
/rollup/3.14.0:
|
||||||
resolution: {integrity: sha512-o23sdgCLcLSe3zIplT9nQ1+r97okuaiR+vmAPZPTDYB7/f3tgWIYNyiQveMsZwshBT0is4eGax/HH83Q7CG+/Q==}
|
resolution: {integrity: sha512-o23sdgCLcLSe3zIplT9nQ1+r97okuaiR+vmAPZPTDYB7/f3tgWIYNyiQveMsZwshBT0is4eGax/HH83Q7CG+/Q==}
|
||||||
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
||||||
|
@ -1149,6 +1545,10 @@ packages:
|
||||||
queue-microtask: 1.2.3
|
queue-microtask: 1.2.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/rw/1.3.3:
|
||||||
|
resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/sade/1.8.1:
|
/sade/1.8.1:
|
||||||
resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==}
|
resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
|
@ -1156,6 +1556,10 @@ packages:
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/safer-buffer/2.1.2:
|
||||||
|
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/sander/0.5.1:
|
/sander/0.5.1:
|
||||||
resolution: {integrity: sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==}
|
resolution: {integrity: sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
181
src/lib/d3plot.svelte
Normal file
181
src/lib/d3plot.svelte
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import * as d3 from 'd3';
|
||||||
|
|
||||||
|
export let data: {date: string, avgTemp: number}[] = [
|
||||||
|
{date: "2023-01-01", avgTemp: 22},
|
||||||
|
{date: "2023-01-02", avgTemp: 19},
|
||||||
|
{date: "2023-01-03", avgTemp: 16},
|
||||||
|
{date: "2023-01-04", avgTemp: 9},
|
||||||
|
{date: "2023-01-05", avgTemp: 4},
|
||||||
|
{date: "2023-01-06", avgTemp: 5},
|
||||||
|
{date: "2023-01-07", avgTemp: 5},
|
||||||
|
{date: "2023-01-08", avgTemp: 2},
|
||||||
|
{date: "2023-01-09", avgTemp: 4},
|
||||||
|
{date: "2023-01-10", avgTemp: 1},
|
||||||
|
{date: "2023-01-11", avgTemp: 6},
|
||||||
|
{date: "2023-01-12", avgTemp: 6},
|
||||||
|
{date: "2023-01-13", avgTemp: -1},
|
||||||
|
{date: "2023-01-14", avgTemp: -3},
|
||||||
|
{date: "2023-01-15", avgTemp: -4},
|
||||||
|
{date: "2023-01-16", avgTemp: -1},
|
||||||
|
{date: "2023-01-17", avgTemp: -3},
|
||||||
|
{date: "2023-01-18", avgTemp: -2},
|
||||||
|
{date: "2023-01-19", avgTemp: 0},
|
||||||
|
{date: "2023-01-20", avgTemp: -1},
|
||||||
|
{date: "2023-01-21", avgTemp: 1},
|
||||||
|
{date: "2023-01-22", avgTemp: 0},
|
||||||
|
{date: "2023-01-23", avgTemp: -2},
|
||||||
|
];
|
||||||
|
let vis;
|
||||||
|
|
||||||
|
let chart = LineChart(data, { x: d.date, y: d.avgTemp, yLabel: 'Daily average temperature', width, height: 500, color: 'steelblue' })
|
||||||
|
|
||||||
|
// Copyright 2021 Observable, Inc.
|
||||||
|
// Released under the ISC license.
|
||||||
|
// https://observablehq.com/@d3/line-with-tooltip
|
||||||
|
function LineChart(data, {
|
||||||
|
x = ([x]) => x, // given d in data, returns the (temporal) x-value
|
||||||
|
y = ([, y]) => y, // given d in data, returns the (quantitative) y-value
|
||||||
|
title, // given d in data, returns the title text
|
||||||
|
defined, // for gaps in data
|
||||||
|
curve = d3.curveLinear, // method of interpolation between points
|
||||||
|
marginTop = 20, // top margin, in pixels
|
||||||
|
marginRight = 30, // right margin, in pixels
|
||||||
|
marginBottom = 30, // bottom margin, in pixels
|
||||||
|
marginLeft = 40, // left margin, in pixels
|
||||||
|
width = 640, // outer width, in pixels
|
||||||
|
height = 400, // outer height, in pixels
|
||||||
|
xType = d3.scaleUtc, // type of x-scale
|
||||||
|
xDomain, // [xmin, xmax]
|
||||||
|
xRange = [marginLeft, width - marginRight], // [left, right]
|
||||||
|
yType = d3.scaleLinear, // type of y-scale
|
||||||
|
yDomain, // [ymin, ymax]
|
||||||
|
yRange = [height - marginBottom, marginTop], // [bottom, top]
|
||||||
|
color = "currentColor", // stroke color of line
|
||||||
|
strokeWidth = 1.5, // stroke width of line, in pixels
|
||||||
|
strokeLinejoin = "round", // stroke line join of line
|
||||||
|
strokeLinecap = "round", // stroke line cap of line
|
||||||
|
yFormat, // a format specifier string for the y-axis
|
||||||
|
yLabel, // a label for the y-axis
|
||||||
|
} = {}) {
|
||||||
|
// Compute values.
|
||||||
|
const X = d3.map(data, x);
|
||||||
|
const Y = d3.map(data, y);
|
||||||
|
const O = d3.map(data, d => d);
|
||||||
|
const I = d3.map(data, (_, i) => i);
|
||||||
|
|
||||||
|
// Compute which data points are considered defined.
|
||||||
|
if (defined === undefined) defined = (d, i) => !isNaN(X[i]) && !isNaN(Y[i]);
|
||||||
|
const D = d3.map(data, defined);
|
||||||
|
|
||||||
|
// Compute default domains.
|
||||||
|
if (xDomain === undefined) xDomain = d3.extent(X);
|
||||||
|
if (yDomain === undefined) yDomain = [0, d3.max(Y)];
|
||||||
|
|
||||||
|
// Construct scales and axes.
|
||||||
|
const xScale = xType(xDomain, xRange);
|
||||||
|
const yScale = yType(yDomain, yRange);
|
||||||
|
const xAxis = d3.axisBottom(xScale).ticks(width / 80).tickSizeOuter(0);
|
||||||
|
const yAxis = d3.axisLeft(yScale).ticks(height / 40, yFormat);
|
||||||
|
|
||||||
|
// Compute titles.
|
||||||
|
if (title === undefined) {
|
||||||
|
const formatDate = xScale.tickFormat(null, "%b %-d, %Y");
|
||||||
|
const formatValue = yScale.tickFormat(100, yFormat);
|
||||||
|
title = i => `${formatDate(X[i])}\n${formatValue(Y[i])}`;
|
||||||
|
} else {
|
||||||
|
const O = d3.map(data, d => d);
|
||||||
|
const T = title;
|
||||||
|
title = i => T(O[i], i, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct a line generator.
|
||||||
|
const line = d3.line()
|
||||||
|
.defined(i => D[i])
|
||||||
|
.curve(curve)
|
||||||
|
.x(i => xScale(X[i]))
|
||||||
|
.y(i => yScale(Y[i]));
|
||||||
|
|
||||||
|
const svg = d3.create("svg")
|
||||||
|
.attr("width", width)
|
||||||
|
.attr("height", height)
|
||||||
|
.attr("viewBox", [0, 0, width, height])
|
||||||
|
.attr("style", "max-width: 100%; height: auto; height: intrinsic;")
|
||||||
|
.attr("font-family", "sans-serif")
|
||||||
|
.attr("font-size", 10)
|
||||||
|
.style("-webkit-tap-highlight-color", "transparent")
|
||||||
|
.style("overflow", "visible")
|
||||||
|
.on("pointerenter pointermove", pointermoved)
|
||||||
|
.on("pointerleave", pointerleft)
|
||||||
|
.on("touchstart", event => event.preventDefault());
|
||||||
|
|
||||||
|
svg.append("g")
|
||||||
|
.attr("transform", `translate(0,${height - marginBottom})`)
|
||||||
|
.call(xAxis);
|
||||||
|
|
||||||
|
svg.append("g")
|
||||||
|
.attr("transform", `translate(${marginLeft},0)`)
|
||||||
|
.call(yAxis)
|
||||||
|
.call(g => g.select(".domain").remove())
|
||||||
|
.call(g => g.selectAll(".tick line").clone()
|
||||||
|
.attr("x2", width - marginLeft - marginRight)
|
||||||
|
.attr("stroke-opacity", 0.1))
|
||||||
|
.call(g => g.append("text")
|
||||||
|
.attr("x", -marginLeft)
|
||||||
|
.attr("y", 10)
|
||||||
|
.attr("fill", "currentColor")
|
||||||
|
.attr("text-anchor", "start")
|
||||||
|
.text(yLabel));
|
||||||
|
|
||||||
|
svg.append("path")
|
||||||
|
.attr("fill", "none")
|
||||||
|
.attr("stroke", color)
|
||||||
|
.attr("stroke-width", strokeWidth)
|
||||||
|
.attr("stroke-linejoin", strokeLinejoin)
|
||||||
|
.attr("stroke-linecap", strokeLinecap)
|
||||||
|
.attr("d", line(I));
|
||||||
|
|
||||||
|
const tooltip = svg.append("g")
|
||||||
|
.style("pointer-events", "none");
|
||||||
|
|
||||||
|
function pointermoved(event) {
|
||||||
|
const i = d3.bisectCenter(X, xScale.invert(d3.pointer(event)[0]));
|
||||||
|
tooltip.style("display", null);
|
||||||
|
tooltip.attr("transform", `translate(${xScale(X[i])},${yScale(Y[i])})`);
|
||||||
|
|
||||||
|
const path = tooltip.selectAll("path")
|
||||||
|
.data([,])
|
||||||
|
.join("path")
|
||||||
|
.attr("fill", "white")
|
||||||
|
.attr("stroke", "black");
|
||||||
|
|
||||||
|
const text = tooltip.selectAll("text")
|
||||||
|
.data([,])
|
||||||
|
.join("text")
|
||||||
|
.call(text => text
|
||||||
|
.selectAll("tspan")
|
||||||
|
.data(`${title(i)}`.split(/\n/))
|
||||||
|
.join("tspan")
|
||||||
|
.attr("x", 0)
|
||||||
|
.attr("y", (_, i) => `${i * 1.1}em`)
|
||||||
|
.attr("font-weight", (_, i) => i ? null : "bold")
|
||||||
|
.text(d => d));
|
||||||
|
|
||||||
|
const {x, y, width: w, height: h} = text.node().getBBox();
|
||||||
|
text.attr("transform", `translate(${-w / 2},${15 - y})`);
|
||||||
|
path.attr("d", `M${-w / 2 - 10},5H-5l5,-5l5,5H${w / 2 + 10}v${h + 20}h-${w + 20}z`);
|
||||||
|
svg.property("value", O[i]).dispatch("input", {bubbles: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
function pointerleft() {
|
||||||
|
tooltip.style("display", "none");
|
||||||
|
svg.node().value = null;
|
||||||
|
svg.dispatch("input", {bubbles: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.assign(svg.node(), {value: null});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<main>
|
||||||
|
<div bind:this={vis}><svg bind:this={chart}></svg></div>
|
||||||
|
</main>
|
|
@ -1,2 +1,3 @@
|
||||||
export { default as Navbar } from "./navbar.svelte"
|
export { default as Navbar } from "./navbar.svelte"
|
||||||
export { default as Graphic } from "./graph.svelte"
|
export { default as Graphic } from "./graph.svelte"
|
||||||
|
export { default as D3LinePlot } from "./d3plot.svelte"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { enhance } from "$app/forms";
|
import { enhance } from "$app/forms";
|
||||||
|
import { D3LinePlot } from "$lib";
|
||||||
import Graph from "../../lib/graph.svelte";
|
import Graph from "../../lib/graph.svelte";
|
||||||
|
|
||||||
let display: string = 'none';
|
let display: string = 'none';
|
||||||
|
@ -23,6 +24,8 @@
|
||||||
<button type="button" on:click={toggleDisplay}>Canviar ubicació</button>
|
<button type="button" on:click={toggleDisplay}>Canviar ubicació</button>
|
||||||
<pre>{ JSON.stringify(data) }</pre>
|
<pre>{ JSON.stringify(data) }</pre>
|
||||||
<Graph ubicacio={data.ubicacio} series={data.temps} />
|
<Graph ubicacio={data.ubicacio} series={data.temps} />
|
||||||
|
<hr>
|
||||||
|
<D3LinePlot />
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<p>Dades provinents de:</p>
|
<p>Dades provinents de:</p>
|
||||||
|
|
Loading…
Referencia en una nova incidència