Update graphs
This commit is contained in:
pare
dcf8babc00
commit
a06ea205f6
S'han modificat 6 arxius amb 179 adicions i 34 eliminacions
15
package.json
15
package.json
|
@ -10,17 +10,18 @@
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "^1.0.0",
|
"@sveltejs/adapter-auto": "^1.0.3",
|
||||||
"@sveltejs/kit": "^1.0.0",
|
"@sveltejs/kit": "^1.5.0",
|
||||||
"svelte": "^3.54.0",
|
"svelte": "^3.55.1",
|
||||||
"svelte-check": "^3.0.1",
|
"svelte-check": "^3.0.3",
|
||||||
"tslib": "^2.4.1",
|
"tslib": "^2.5.0",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.5",
|
||||||
"vite": "^4.0.0"
|
"vite": "^4.1.1"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chart.js": "^4.2.0",
|
"chart.js": "^4.2.0",
|
||||||
|
"highcharts": "^10.3.3",
|
||||||
"layercake": "^7.2.2",
|
"layercake": "^7.2.2",
|
||||||
"svelte-chartjs": "^3.1.2"
|
"svelte-chartjs": "^3.1.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
lockfileVersion: 5.4
|
lockfileVersion: 5.4
|
||||||
|
|
||||||
specifiers:
|
specifiers:
|
||||||
'@sveltejs/adapter-auto': ^1.0.0
|
'@sveltejs/adapter-auto': ^1.0.3
|
||||||
'@sveltejs/kit': ^1.0.0
|
'@sveltejs/kit': ^1.5.0
|
||||||
chart.js: ^4.2.0
|
chart.js: ^4.2.0
|
||||||
|
highcharts: ^10.3.3
|
||||||
layercake: ^7.2.2
|
layercake: ^7.2.2
|
||||||
svelte: ^3.54.0
|
svelte: ^3.55.1
|
||||||
svelte-chartjs: ^3.1.2
|
svelte-chartjs: ^3.1.2
|
||||||
svelte-check: ^3.0.1
|
svelte-check: ^3.0.3
|
||||||
tslib: ^2.4.1
|
tslib: ^2.5.0
|
||||||
typescript: ^4.9.3
|
typescript: ^4.9.5
|
||||||
vite: ^4.0.0
|
vite: ^4.1.1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
chart.js: 4.2.0
|
chart.js: 4.2.0
|
||||||
|
highcharts: 10.3.3
|
||||||
layercake: 7.2.2
|
layercake: 7.2.2
|
||||||
svelte-chartjs: 3.1.2_sb7g7nvzgbbexijgaje6yhompe
|
svelte-chartjs: 3.1.2_sb7g7nvzgbbexijgaje6yhompe
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@sveltejs/adapter-auto': 1.0.2_@sveltejs+kit@1.3.10
|
'@sveltejs/adapter-auto': 1.0.3_@sveltejs+kit@1.5.0
|
||||||
'@sveltejs/kit': 1.3.10_svelte@3.55.1+vite@4.1.1
|
'@sveltejs/kit': 1.5.0_svelte@3.55.1+vite@4.1.1
|
||||||
svelte: 3.55.1
|
svelte: 3.55.1
|
||||||
svelte-check: 3.0.3_svelte@3.55.1
|
svelte-check: 3.0.3_svelte@3.55.1
|
||||||
tslib: 2.5.0
|
tslib: 2.5.0
|
||||||
|
@ -271,17 +273,17 @@ packages:
|
||||||
resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==}
|
resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@sveltejs/adapter-auto/1.0.2_@sveltejs+kit@1.3.10:
|
/@sveltejs/adapter-auto/1.0.3_@sveltejs+kit@1.5.0:
|
||||||
resolution: {integrity: sha512-UXpEO/gutERZnD+Z5Vi4J/ifD3WSRuCI7xwtLJTcKNQvJ6t5Xsj1X3Mw2F8Vv/XTUuxf7xPLYUgThU331r0Y9w==}
|
resolution: {integrity: sha512-hc7O12YQqvZ1CD4fo1gMJuPzBZvuoG5kwxb2RRoz4fVoB8B2vuPO2cY751Ln0G6T/HMrAf8kCqw6Pg+wbxcstw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@sveltejs/kit': ^1.0.0
|
'@sveltejs/kit': ^1.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
'@sveltejs/kit': 1.3.10_svelte@3.55.1+vite@4.1.1
|
'@sveltejs/kit': 1.5.0_svelte@3.55.1+vite@4.1.1
|
||||||
import-meta-resolve: 2.2.1
|
import-meta-resolve: 2.2.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@sveltejs/kit/1.3.10_svelte@3.55.1+vite@4.1.1:
|
/@sveltejs/kit/1.5.0_svelte@3.55.1+vite@4.1.1:
|
||||||
resolution: {integrity: sha512-I3DgWCwTYbTz4ZPCJIRkSDrKkMu0bsdk6ghqsOBVNqesf1wBdTdfkXhag3ESWgIEjUV3VUIWPQF7fnt7328mhQ==}
|
resolution: {integrity: sha512-AkWgCO9i2djZjTqCgIQJ5XfnSzRINowh2w2Gk9wDRuTwxKizSuYe3jNvds/HCDDGHo8XE5E0yWNC9j2XxbrX+g==}
|
||||||
engines: {node: ^16.14 || >=18}
|
engines: {node: ^16.14 || >=18}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
|
@ -302,7 +304,7 @@ packages:
|
||||||
sirv: 2.0.2
|
sirv: 2.0.2
|
||||||
svelte: 3.55.1
|
svelte: 3.55.1
|
||||||
tiny-glob: 0.2.9
|
tiny-glob: 0.2.9
|
||||||
undici: 5.16.0
|
undici: 5.18.0
|
||||||
vite: 4.1.1
|
vite: 4.1.1
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -331,8 +333,8 @@ packages:
|
||||||
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/node/18.11.19:
|
/@types/node/18.13.0:
|
||||||
resolution: {integrity: sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==}
|
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/pug/2.0.6:
|
/@types/pug/2.0.6:
|
||||||
|
@ -342,7 +344,7 @@ packages:
|
||||||
/@types/sass/1.43.1:
|
/@types/sass/1.43.1:
|
||||||
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
|
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 18.11.19
|
'@types/node': 18.13.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/anymatch/3.1.3:
|
/anymatch/3.1.3:
|
||||||
|
@ -625,6 +627,10 @@ packages:
|
||||||
function-bind: 1.1.1
|
function-bind: 1.1.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/highcharts/10.3.3:
|
||||||
|
resolution: {integrity: sha512-r7wgUPQI9tr3jFDn3XT36qsNwEIZYcfgz4mkKEA6E4nn5p86y+u1EZjazIG4TRkl5/gmGRtkBUiZW81g029RIw==}
|
||||||
|
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'}
|
||||||
|
@ -1048,8 +1054,8 @@ packages:
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/undici/5.16.0:
|
/undici/5.18.0:
|
||||||
resolution: {integrity: sha512-KWBOXNv6VX+oJQhchXieUznEmnJMqgXMbs0xxH2t8q/FUAWSJvOSr/rMaZKnX5RIVq7JDn0JbP4BOnKG2SGXLQ==}
|
resolution: {integrity: sha512-1iVwbhonhFytNdg0P4PqyIAXbdlVZVebtPDvuM36m66mRw4OGrCm2MYynJv/UENFLdP13J1nPVQzVE2zTs1OeA==}
|
||||||
engines: {node: '>=12.18'}
|
engines: {node: '>=12.18'}
|
||||||
dependencies:
|
dependencies:
|
||||||
busboy: 1.6.0
|
busboy: 1.6.0
|
||||||
|
|
57
src/Session.vim
Normal file
57
src/Session.vim
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
let SessionLoad = 1
|
||||||
|
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
|
||||||
|
let v:this_session=expand("<sfile>:p")
|
||||||
|
silent only
|
||||||
|
silent tabonly
|
||||||
|
cd ~/code/svelte-ts/src
|
||||||
|
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||||
|
let s:wipebuf = bufnr('%')
|
||||||
|
endif
|
||||||
|
let s:shortmess_save = &shortmess
|
||||||
|
if &shortmess =~ 'A'
|
||||||
|
set shortmess=aoOA
|
||||||
|
else
|
||||||
|
set shortmess=aoO
|
||||||
|
endif
|
||||||
|
badd +12 components/graph.svelte
|
||||||
|
badd +19 routes/openmeteo/+page.server.ts
|
||||||
|
badd +23 routes/openmeteo/+page.svelte
|
||||||
|
argglobal
|
||||||
|
%argdel
|
||||||
|
$argadd components/graph.svelte
|
||||||
|
edit components/graph.svelte
|
||||||
|
argglobal
|
||||||
|
balt routes/openmeteo/+page.server.ts
|
||||||
|
setlocal fdm=manual
|
||||||
|
setlocal fde=0
|
||||||
|
setlocal fmr={{{,}}}
|
||||||
|
setlocal fdi=#
|
||||||
|
setlocal fdl=0
|
||||||
|
setlocal fml=1
|
||||||
|
setlocal fdn=20
|
||||||
|
setlocal fen
|
||||||
|
silent! normal! zE
|
||||||
|
let &fdl = &fdl
|
||||||
|
let s:l = 12 - ((11 * winheight(0) + 23) / 46)
|
||||||
|
if s:l < 1 | let s:l = 1 | endif
|
||||||
|
keepjumps exe s:l
|
||||||
|
normal! zt
|
||||||
|
keepjumps 12
|
||||||
|
normal! 034|
|
||||||
|
tabnext 1
|
||||||
|
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||||
|
silent exe 'bwipe ' . s:wipebuf
|
||||||
|
endif
|
||||||
|
unlet! s:wipebuf
|
||||||
|
set winheight=1 winwidth=20
|
||||||
|
let &shortmess = s:shortmess_save
|
||||||
|
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||||
|
if filereadable(s:sx)
|
||||||
|
exe "source " . fnameescape(s:sx)
|
||||||
|
endif
|
||||||
|
let &g:so = s:so_save | let &g:siso = s:siso_save
|
||||||
|
set hlsearch
|
||||||
|
nohlsearch
|
||||||
|
doautoall SessionLoadPost
|
||||||
|
unlet SessionLoad
|
||||||
|
" vim: set ft=vim :
|
|
@ -1,8 +1,73 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Line } from 'svelte-chartjs'
|
import highcharts from "./highcharts";
|
||||||
import { Chart as ChartJS, Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale } from 'chart.js';
|
|
||||||
|
|
||||||
ChartJS.register(Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale);
|
let config = {
|
||||||
export let graphData: object = [];
|
title: {
|
||||||
|
text: 'Solar Employment Growth by Sector, 2010-2016'
|
||||||
|
},
|
||||||
|
|
||||||
|
subtitle: {
|
||||||
|
text: 'Source: thesolarfoundation.com'
|
||||||
|
},
|
||||||
|
|
||||||
|
yAxis: {
|
||||||
|
title: {
|
||||||
|
text: 'Number of Employees'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
accessibility: {
|
||||||
|
rangeDescription: 'Range: 2010 to 2017'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
legend: {
|
||||||
|
layout: 'vertical',
|
||||||
|
align: 'right',
|
||||||
|
verticalAlign: 'middle'
|
||||||
|
},
|
||||||
|
|
||||||
|
plotOptions: {
|
||||||
|
series: {
|
||||||
|
label: {
|
||||||
|
connectorAllowed: false
|
||||||
|
},
|
||||||
|
pointStart: 2010
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
series: [{
|
||||||
|
name: 'Installation',
|
||||||
|
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
|
||||||
|
}, {
|
||||||
|
name: 'Manufacturing',
|
||||||
|
data: [24916, 24064, null, null, 119931, 137133, 154175, 171217]
|
||||||
|
}, {
|
||||||
|
name: 'Sales & Distribution',
|
||||||
|
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
|
||||||
|
}, {
|
||||||
|
name: 'Project Development',
|
||||||
|
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
|
||||||
|
}, {
|
||||||
|
name: 'Other',
|
||||||
|
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
|
||||||
|
}],
|
||||||
|
|
||||||
|
responsive: {
|
||||||
|
rules: [{
|
||||||
|
condition: {
|
||||||
|
maxWidth: 500
|
||||||
|
},
|
||||||
|
chartOptions: {
|
||||||
|
legend: {
|
||||||
|
layout: 'horizontal',
|
||||||
|
align: 'center',
|
||||||
|
verticalAlign: 'bottom'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<Line data={graphData} options={{ responsive: true }}></Line>
|
<div class="chart" use:highcharts={config}></div>
|
||||||
|
|
16
src/components/highcharts.ts
Normal file
16
src/components/highcharts.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import Highcharts from 'highcharts';
|
||||||
|
|
||||||
|
export default (node, config) => {
|
||||||
|
const redraw = true;
|
||||||
|
const oneToOne = true;
|
||||||
|
const chart = Highcharts.chart(node, config);
|
||||||
|
|
||||||
|
return {
|
||||||
|
update(config) {
|
||||||
|
chart.update(config, redraw, oneToOne);
|
||||||
|
},
|
||||||
|
destroy() {
|
||||||
|
chart.destroy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -20,8 +20,8 @@
|
||||||
</div>
|
</div>
|
||||||
<h2>Ubicació actual: { data.ubicacio }</h2>
|
<h2>Ubicació actual: { data.ubicacio }</h2>
|
||||||
<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 graphData={data.temps} />
|
<Graph />
|
||||||
<footer>
|
<footer>
|
||||||
<p>Dades provinents de:</p>
|
<p>Dades provinents de:</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Loading…
Referencia en una nova incidència