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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-auto": "^1.0.0",
|
||||
"@sveltejs/kit": "^1.0.0",
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-check": "^3.0.1",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^4.0.0"
|
||||
"@sveltejs/adapter-auto": "^1.0.3",
|
||||
"@sveltejs/kit": "^1.5.0",
|
||||
"svelte": "^3.55.1",
|
||||
"svelte-check": "^3.0.3",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^4.9.5",
|
||||
"vite": "^4.1.1"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"chart.js": "^4.2.0",
|
||||
"highcharts": "^10.3.3",
|
||||
"layercake": "^7.2.2",
|
||||
"svelte-chartjs": "^3.1.2"
|
||||
}
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@sveltejs/adapter-auto': ^1.0.0
|
||||
'@sveltejs/kit': ^1.0.0
|
||||
'@sveltejs/adapter-auto': ^1.0.3
|
||||
'@sveltejs/kit': ^1.5.0
|
||||
chart.js: ^4.2.0
|
||||
highcharts: ^10.3.3
|
||||
layercake: ^7.2.2
|
||||
svelte: ^3.54.0
|
||||
svelte: ^3.55.1
|
||||
svelte-chartjs: ^3.1.2
|
||||
svelte-check: ^3.0.1
|
||||
tslib: ^2.4.1
|
||||
typescript: ^4.9.3
|
||||
vite: ^4.0.0
|
||||
svelte-check: ^3.0.3
|
||||
tslib: ^2.5.0
|
||||
typescript: ^4.9.5
|
||||
vite: ^4.1.1
|
||||
|
||||
dependencies:
|
||||
chart.js: 4.2.0
|
||||
highcharts: 10.3.3
|
||||
layercake: 7.2.2
|
||||
svelte-chartjs: 3.1.2_sb7g7nvzgbbexijgaje6yhompe
|
||||
|
||||
devDependencies:
|
||||
'@sveltejs/adapter-auto': 1.0.2_@sveltejs+kit@1.3.10
|
||||
'@sveltejs/kit': 1.3.10_svelte@3.55.1+vite@4.1.1
|
||||
'@sveltejs/adapter-auto': 1.0.3_@sveltejs+kit@1.5.0
|
||||
'@sveltejs/kit': 1.5.0_svelte@3.55.1+vite@4.1.1
|
||||
svelte: 3.55.1
|
||||
svelte-check: 3.0.3_svelte@3.55.1
|
||||
tslib: 2.5.0
|
||||
|
@ -271,17 +273,17 @@ packages:
|
|||
resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==}
|
||||
dev: true
|
||||
|
||||
/@sveltejs/adapter-auto/1.0.2_@sveltejs+kit@1.3.10:
|
||||
resolution: {integrity: sha512-UXpEO/gutERZnD+Z5Vi4J/ifD3WSRuCI7xwtLJTcKNQvJ6t5Xsj1X3Mw2F8Vv/XTUuxf7xPLYUgThU331r0Y9w==}
|
||||
/@sveltejs/adapter-auto/1.0.3_@sveltejs+kit@1.5.0:
|
||||
resolution: {integrity: sha512-hc7O12YQqvZ1CD4fo1gMJuPzBZvuoG5kwxb2RRoz4fVoB8B2vuPO2cY751Ln0G6T/HMrAf8kCqw6Pg+wbxcstw==}
|
||||
peerDependencies:
|
||||
'@sveltejs/kit': ^1.0.0
|
||||
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
|
||||
dev: true
|
||||
|
||||
/@sveltejs/kit/1.3.10_svelte@3.55.1+vite@4.1.1:
|
||||
resolution: {integrity: sha512-I3DgWCwTYbTz4ZPCJIRkSDrKkMu0bsdk6ghqsOBVNqesf1wBdTdfkXhag3ESWgIEjUV3VUIWPQF7fnt7328mhQ==}
|
||||
/@sveltejs/kit/1.5.0_svelte@3.55.1+vite@4.1.1:
|
||||
resolution: {integrity: sha512-AkWgCO9i2djZjTqCgIQJ5XfnSzRINowh2w2Gk9wDRuTwxKizSuYe3jNvds/HCDDGHo8XE5E0yWNC9j2XxbrX+g==}
|
||||
engines: {node: ^16.14 || >=18}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
|
@ -302,7 +304,7 @@ packages:
|
|||
sirv: 2.0.2
|
||||
svelte: 3.55.1
|
||||
tiny-glob: 0.2.9
|
||||
undici: 5.16.0
|
||||
undici: 5.18.0
|
||||
vite: 4.1.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
@ -331,8 +333,8 @@ packages:
|
|||
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
||||
dev: true
|
||||
|
||||
/@types/node/18.11.19:
|
||||
resolution: {integrity: sha512-YUgMWAQBWLObABqrvx8qKO1enAvBUdjZOAWQ5grBAkp5LQv45jBvYKZ3oFS9iKRCQyFjqw6iuEa1vmFqtxYLZw==}
|
||||
/@types/node/18.13.0:
|
||||
resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==}
|
||||
dev: true
|
||||
|
||||
/@types/pug/2.0.6:
|
||||
|
@ -342,7 +344,7 @@ packages:
|
|||
/@types/sass/1.43.1:
|
||||
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.19
|
||||
'@types/node': 18.13.0
|
||||
dev: true
|
||||
|
||||
/anymatch/3.1.3:
|
||||
|
@ -625,6 +627,10 @@ packages:
|
|||
function-bind: 1.1.1
|
||||
dev: true
|
||||
|
||||
/highcharts/10.3.3:
|
||||
resolution: {integrity: sha512-r7wgUPQI9tr3jFDn3XT36qsNwEIZYcfgz4mkKEA6E4nn5p86y+u1EZjazIG4TRkl5/gmGRtkBUiZW81g029RIw==}
|
||||
dev: false
|
||||
|
||||
/import-fresh/3.3.0:
|
||||
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -1048,8 +1054,8 @@ packages:
|
|||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/undici/5.16.0:
|
||||
resolution: {integrity: sha512-KWBOXNv6VX+oJQhchXieUznEmnJMqgXMbs0xxH2t8q/FUAWSJvOSr/rMaZKnX5RIVq7JDn0JbP4BOnKG2SGXLQ==}
|
||||
/undici/5.18.0:
|
||||
resolution: {integrity: sha512-1iVwbhonhFytNdg0P4PqyIAXbdlVZVebtPDvuM36m66mRw4OGrCm2MYynJv/UENFLdP13J1nPVQzVE2zTs1OeA==}
|
||||
engines: {node: '>=12.18'}
|
||||
dependencies:
|
||||
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">
|
||||
import { Line } from 'svelte-chartjs'
|
||||
import { Chart as ChartJS, Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale } from 'chart.js';
|
||||
import highcharts from "./highcharts";
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, LineElement, LinearScale, PointElement, CategoryScale);
|
||||
export let graphData: object = [];
|
||||
let config = {
|
||||
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>
|
||||
<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>
|
||||
<h2>Ubicació actual: { data.ubicacio }</h2>
|
||||
<button type="button" on:click={toggleDisplay}>Canviar ubicació</button>
|
||||
<!-- <pre>{ JSON.stringify(data) }</pre> -->
|
||||
<Graph graphData={data.temps} />
|
||||
<pre>{ JSON.stringify(data) }</pre>
|
||||
<Graph />
|
||||
<footer>
|
||||
<p>Dades provinents de:</p>
|
||||
<ul>
|
||||
|
|
Loading…
Referencia en una nova incidència