var meteoCharts = {}; var meteoCompassLabels = {0: 'S', 90: 'V', 180: 'J', 270: 'Z', 360: 'S'}; var meteoRangeMin = 1795388400000; var meteoRangeMax = 1795396288000; function meteoFormatTime(ms) { return moment(ms).format('HH:mm'); } function meteoFormatDateTime(ms) { return moment(ms).format('DD.MM., HH:mm'); } function meteoComputeExtremes(points) { var minPoint = null, maxPoint = null; for (var i = 0; i < points.length; i++) { var p = points[i]; if (p.y === null || p.y === undefined) continue; if (!minPoint || p.y < minPoint.y) minPoint = p; if (!maxPoint || p.y > maxPoint.y) maxPoint = p; } return (minPoint || maxPoint) ? {min: minPoint, max: maxPoint} : null; } function meteoExtremeType(extremes, p) { if (!extremes || !p) return null; if (extremes.max && p.x === extremes.max.x && p.y === extremes.max.y) return 'max'; if (extremes.min && p.x === extremes.min.x && p.y === extremes.min.y) return 'min'; return null; } function meteoBuildDataset(spec) { var extremes = spec.highlightExtremes ? meteoComputeExtremes(spec.points) : null; var baseRadius = spec.pointRadius !== undefined ? spec.pointRadius : 0; var baseHoverRadius = baseRadius || 3; return { label: spec.label, data: spec.points, borderColor: spec.color, backgroundColor: spec.color, borderWidth: 2, tension: 0.15, fill: false, spanGaps: true, showLine: spec.showLine !== false, meteoUnit: spec.unit || '', meteoTooltipMode: spec.tooltipMode || 'default', meteoExtremes: extremes, pointRadius: function(context) { return meteoExtremeType(extremes, context.raw) ? Math.max(baseRadius, 5) : baseRadius; }, pointHoverRadius: function(context) { return meteoExtremeType(extremes, context.raw) ? Math.max(baseHoverRadius, 7) : baseHoverRadius; }, pointBackgroundColor: spec.color, pointBorderColor: '#ffffff', pointBorderWidth: function(context) { return meteoExtremeType(extremes, context.raw) ? 2 : 0; } }; } function buildMeteoChart(canvasId, resetButtonId, specs, extraOptions) { var canvas = document.getElementById(canvasId); if (!canvas || typeof Chart === 'undefined' || !specs.length) { return; } extraOptions = extraOptions || {}; var yScale = {title: {display: !!extraOptions.yLabel, text: extraOptions.yLabel || ''}}; if (extraOptions.yMin !== undefined) yScale.min = extraOptions.yMin; if (extraOptions.yMax !== undefined) yScale.max = extraOptions.yMax; if (extraOptions.yMode === 'compass') { yScale.min = 0; yScale.max = 360; yScale.ticks = { stepSize: 90, callback: function(value) { return meteoCompassLabels[value] !== undefined ? meteoCompassLabels[value] : value; } }; } meteoCharts[canvasId] = new Chart(canvas.getContext('2d'), { type: 'line', data: {datasets: specs.map(meteoBuildDataset)}, options: { responsive: true, maintainAspectRatio: false, animation: false, interaction: {mode: 'nearest', axis: 'x', intersect: false}, scales: { x: { type: 'linear', min: meteoRangeMin, max: meteoRangeMax, ticks: {maxTicksLimit: 8, callback: meteoFormatTime} }, y: yScale }, plugins: { legend: {display: true, position: 'top'}, tooltip: { callbacks: { title: function(items) { return items.length ? meteoFormatDateTime(items[0].parsed.x) : ''; }, label: function(context) { var ds = context.dataset; if (ds.meteoTooltipMode === 'windDirection') { return meteo_wind_direction_name(context.parsed.y); } var extremeType = meteoExtremeType(ds.meteoExtremes, context.raw); var suffix = extremeType === 'max' ? ' (dnešné maximum)' : (extremeType === 'min' ? ' (dnešné minimum)' : ''); return ds.label + ': ' + context.parsed.y + ds.meteoUnit + suffix; } } }, zoom: { pan: {enabled: true, mode: 'x'}, zoom: {wheel: {enabled: true}, pinch: {enabled: true}, mode: 'x'}, limits: {x: {min: meteoRangeMin, max: meteoRangeMax}} } } } }); var resetButton = document.getElementById(resetButtonId); if (resetButton) { resetButton.addEventListener('click', function() { meteoCharts[canvasId].resetZoom(); }); } } $(document).ready(function() { buildMeteoChart('chart-temperature-canvas', 'chart-temperature-reset', [{"label":"Teplota (°C)","color":"#d6212a","points":[{"x":1795388400000,"y":-1.5},{"x":1795388460000,"y":-1.5},{"x":1795388520000,"y":-1.5},{"x":1795388580000,"y":-1.5},{"x":1795388640000,"y":-1.5},{"x":1795388700000,"y":-1.5},{"x":1795388760000,"y":-1.6},{"x":1795388820000,"y":-1.6},{"x":1795388880000,"y":-1.6},{"x":1795388940000,"y":-1.6},{"x":1795389000000,"y":-1.6},{"x":1795389060000,"y":-1.6},{"x":1795389120000,"y":-1.6},{"x":1795389180000,"y":-1.6},{"x":1795389240000,"y":-1.6},{"x":1795389300000,"y":-1.6},{"x":1795389360000,"y":-1.6},{"x":1795389420000,"y":-1.6},{"x":1795389480000,"y":-1.6},{"x":1795389540000,"y":-1.6},{"x":1795389600000,"y":-1.6},{"x":1795389660000,"y":-1.6},{"x":1795389720000,"y":-1.6},{"x":1795389780000,"y":-1.5},{"x":1795389840000,"y":-1.5},{"x":1795389900000,"y":-1.4},{"x":1795389960000,"y":-1.4},{"x":1795390020000,"y":-1.5},{"x":1795390080000,"y":-1.5},{"x":1795390140000,"y":-1.5},{"x":1795390200000,"y":-1.5},{"x":1795390260000,"y":-1.5},{"x":1795390320000,"y":-1.6},{"x":1795390380000,"y":-1.6},{"x":1795390440000,"y":-1.6},{"x":1795390500000,"y":-1.7},{"x":1795390560000,"y":-1.7},{"x":1795390620000,"y":-1.7},{"x":1795390680000,"y":-1.7},{"x":1795390740000,"y":-1.7},{"x":1795390800000,"y":-1.7},{"x":1795390860000,"y":-1.6},{"x":1795390920000,"y":-1.6},{"x":1795390980000,"y":-1.6},{"x":1795391040000,"y":-1.5},{"x":1795391100000,"y":-1.5},{"x":1795391160000,"y":-1.4},{"x":1795391220000,"y":-1.4},{"x":1795391280000,"y":-1.4},{"x":1795391340000,"y":-1.4},{"x":1795391400000,"y":-1.4},{"x":1795391460000,"y":-1.4},{"x":1795391520000,"y":-1.4},{"x":1795391580000,"y":-1.4},{"x":1795391640000,"y":-1.4},{"x":1795391700000,"y":-1.4},{"x":1795391760000,"y":-1.3},{"x":1795391820000,"y":-1.2},{"x":1795391880000,"y":-1.2},{"x":1795391940000,"y":-1.1},{"x":1795392000000,"y":-1.2},{"x":1795392060000,"y":-1.1},{"x":1795392120000,"y":-1},{"x":1795392180000,"y":-1.1},{"x":1795392240000,"y":-1.1},{"x":1795392300000,"y":-1.2},{"x":1795392360000,"y":-1.3},{"x":1795392420000,"y":-1.3},{"x":1795392480000,"y":-1.4},{"x":1795392540000,"y":-1.4},{"x":1795392600000,"y":-1.5},{"x":1795392660000,"y":-1.5},{"x":1795392720000,"y":-1.6},{"x":1795392780000,"y":-1.6}],"highlightExtremes":true,"unit":" °C"},{"label":"Rosný bod (°C)","color":"#5b9f4a","points":[{"x":1795388400000,"y":-2.5},{"x":1795388460000,"y":-2.4},{"x":1795388520000,"y":-2.4},{"x":1795388580000,"y":-2.4},{"x":1795388640000,"y":-2.4},{"x":1795388700000,"y":-2.4},{"x":1795388760000,"y":-2.5},{"x":1795388820000,"y":-2.4},{"x":1795388880000,"y":-2.4},{"x":1795388940000,"y":-2.4},{"x":1795389000000,"y":-2.4},{"x":1795389060000,"y":-2.4},{"x":1795389120000,"y":-2.4},{"x":1795389180000,"y":-2.4},{"x":1795389240000,"y":-2.4},{"x":1795389300000,"y":-2.4},{"x":1795389360000,"y":-2.5},{"x":1795389420000,"y":-2.5},{"x":1795389480000,"y":-2.6},{"x":1795389540000,"y":-2.7},{"x":1795389600000,"y":-2.7},{"x":1795389660000,"y":-2.8},{"x":1795389720000,"y":-2.9},{"x":1795389780000,"y":-2.9},{"x":1795389840000,"y":-3},{"x":1795389900000,"y":-3},{"x":1795389960000,"y":-3},{"x":1795390020000,"y":-3.1},{"x":1795390080000,"y":-3.1},{"x":1795390140000,"y":-3.1},{"x":1795390200000,"y":-3},{"x":1795390260000,"y":-3},{"x":1795390320000,"y":-3},{"x":1795390380000,"y":-3},{"x":1795390440000,"y":-2.9},{"x":1795390500000,"y":-3},{"x":1795390560000,"y":-3},{"x":1795390620000,"y":-3.1},{"x":1795390680000,"y":-3.1},{"x":1795390740000,"y":-3.1},{"x":1795390800000,"y":-3.3},{"x":1795390860000,"y":-3.3},{"x":1795390920000,"y":-3.4},{"x":1795390980000,"y":-3.5},{"x":1795391040000,"y":-3.6},{"x":1795391100000,"y":-3.6},{"x":1795391160000,"y":-3.5},{"x":1795391220000,"y":-3.5},{"x":1795391280000,"y":-3.6},{"x":1795391340000,"y":-3.6},{"x":1795391400000,"y":-3.5},{"x":1795391460000,"y":-3.6},{"x":1795391520000,"y":-3.7},{"x":1795391580000,"y":-3.7},{"x":1795391640000,"y":-3.6},{"x":1795391700000,"y":-3.6},{"x":1795391760000,"y":-3.7},{"x":1795391820000,"y":-3.8},{"x":1795391880000,"y":-3.8},{"x":1795391940000,"y":-3.6},{"x":1795392000000,"y":-3.6},{"x":1795392060000,"y":-3.9},{"x":1795392120000,"y":-3.8},{"x":1795392180000,"y":-3.7},{"x":1795392240000,"y":-3.5},{"x":1795392300000,"y":-3.5},{"x":1795392360000,"y":-3.5},{"x":1795392420000,"y":-3.5},{"x":1795392480000,"y":-3.5},{"x":1795392540000,"y":-3.4},{"x":1795392600000,"y":-3.5},{"x":1795392660000,"y":-3.4},{"x":1795392720000,"y":-3.5},{"x":1795392780000,"y":-3.5}],"highlightExtremes":false,"unit":" °C"}], {"yLabel":"\u00b0C"}); }); $(document).ready(function() { buildMeteoChart('chart-ground-temperature-canvas', 'chart-ground-temperature-reset', [{"label":"5 cm nad povrchom (°C)","color":"#f39c12","points":[{"x":1795388400000,"y":-2.3},{"x":1795388460000,"y":-2.1},{"x":1795388520000,"y":-2.2},{"x":1795388580000,"y":-2.2},{"x":1795388640000,"y":-2.2},{"x":1795388700000,"y":-2.3},{"x":1795388760000,"y":-2.3},{"x":1795388820000,"y":-2.2},{"x":1795388880000,"y":-2.2},{"x":1795388940000,"y":-2.3},{"x":1795389000000,"y":-2.3},{"x":1795389060000,"y":-2.3},{"x":1795389120000,"y":-2.4},{"x":1795389180000,"y":-2.3},{"x":1795389240000,"y":-2.2},{"x":1795389300000,"y":-2.2},{"x":1795389360000,"y":-2.3},{"x":1795389420000,"y":-2.3},{"x":1795389480000,"y":-2.3},{"x":1795389540000,"y":-2.3},{"x":1795389600000,"y":-2.3},{"x":1795389660000,"y":-2.2},{"x":1795389720000,"y":-2.2},{"x":1795389780000,"y":-2.2},{"x":1795389840000,"y":-2.2},{"x":1795389900000,"y":-2.2},{"x":1795389960000,"y":-2.2},{"x":1795390020000,"y":-2.3},{"x":1795390080000,"y":-2.4},{"x":1795390140000,"y":-2.4},{"x":1795390200000,"y":-2.5},{"x":1795390260000,"y":-2.5},{"x":1795390320000,"y":-2.7},{"x":1795390380000,"y":-2.7},{"x":1795390440000,"y":-2.6},{"x":1795390500000,"y":-2.6},{"x":1795390560000,"y":-2.7},{"x":1795390620000,"y":-2.6},{"x":1795390680000,"y":-2.5},{"x":1795390740000,"y":-2.4},{"x":1795390800000,"y":-2.3},{"x":1795390860000,"y":-2.2},{"x":1795390920000,"y":-2.2},{"x":1795390980000,"y":-2.1},{"x":1795391040000,"y":-2.2},{"x":1795391100000,"y":-2.3},{"x":1795391160000,"y":-2.3},{"x":1795391220000,"y":-2.2},{"x":1795391280000,"y":-2.2},{"x":1795391340000,"y":-2.1},{"x":1795391400000,"y":-2.1},{"x":1795391460000,"y":-2.1},{"x":1795391520000,"y":-1.9},{"x":1795391580000,"y":-2},{"x":1795391640000,"y":-2.1},{"x":1795391700000,"y":-2.1},{"x":1795391760000,"y":-2},{"x":1795391820000,"y":-2},{"x":1795391880000,"y":-2},{"x":1795391940000,"y":-2},{"x":1795392000000,"y":-1.9},{"x":1795392060000,"y":-1.8},{"x":1795392120000,"y":-1.9},{"x":1795392180000,"y":-2.3},{"x":1795392240000,"y":-2.4},{"x":1795392300000,"y":-2.5},{"x":1795392360000,"y":-2.5},{"x":1795392420000,"y":-2.7},{"x":1795392480000,"y":-2.7},{"x":1795392540000,"y":-2.7},{"x":1795392600000,"y":-2.7},{"x":1795392660000,"y":-2.8},{"x":1795392720000,"y":-2.7},{"x":1795392780000,"y":-2.7}],"highlightExtremes":true,"unit":" °C"}], {"yLabel":"\u00b0C"}); }); $(document).ready(function() { buildMeteoChart('chart-humidity-canvas', 'chart-humidity-reset', [{"label":"Vlhkosť (%)","color":"#ff9000","points":[{"x":1795388400000,"y":92.9},{"x":1795388460000,"y":93.4},{"x":1795388520000,"y":93.6},{"x":1795388580000,"y":93.8},{"x":1795388640000,"y":93.4},{"x":1795388700000,"y":93.6},{"x":1795388760000,"y":93.9},{"x":1795388820000,"y":94.4},{"x":1795388880000,"y":94.2},{"x":1795388940000,"y":94.3},{"x":1795389000000,"y":94.4},{"x":1795389060000,"y":94.4},{"x":1795389120000,"y":94.4},{"x":1795389180000,"y":94.5},{"x":1795389240000,"y":94.3},{"x":1795389300000,"y":94.1},{"x":1795389360000,"y":94},{"x":1795389420000,"y":93.8},{"x":1795389480000,"y":93.2},{"x":1795389540000,"y":92.6},{"x":1795389600000,"y":92.2},{"x":1795389660000,"y":91.5},{"x":1795389720000,"y":90.9},{"x":1795389780000,"y":90.3},{"x":1795389840000,"y":89.4},{"x":1795389900000,"y":88.8},{"x":1795389960000,"y":88.7},{"x":1795390020000,"y":88.7},{"x":1795390080000,"y":89},{"x":1795390140000,"y":89.3},{"x":1795390200000,"y":89.4},{"x":1795390260000,"y":89.7},{"x":1795390320000,"y":90.1},{"x":1795390380000,"y":90.5},{"x":1795390440000,"y":90.8},{"x":1795390500000,"y":91},{"x":1795390560000,"y":90.9},{"x":1795390620000,"y":90.6},{"x":1795390680000,"y":90.4},{"x":1795390740000,"y":90.1},{"x":1795390800000,"y":89.2},{"x":1795390860000,"y":88.5},{"x":1795390920000,"y":87.7},{"x":1795390980000,"y":87.1},{"x":1795391040000,"y":85.8},{"x":1795391100000,"y":85.9},{"x":1795391160000,"y":85.8},{"x":1795391220000,"y":85.7},{"x":1795391280000,"y":85.4},{"x":1795391340000,"y":85.3},{"x":1795391400000,"y":85.5},{"x":1795391460000,"y":85.3},{"x":1795391520000,"y":84.5},{"x":1795391580000,"y":84.5},{"x":1795391640000,"y":85.4},{"x":1795391700000,"y":85.2},{"x":1795391760000,"y":83.9},{"x":1795391820000,"y":82.9},{"x":1795391880000,"y":82.7},{"x":1795391940000,"y":83.4},{"x":1795392000000,"y":83.7},{"x":1795392060000,"y":81.8},{"x":1795392120000,"y":81.8},{"x":1795392180000,"y":82.7},{"x":1795392240000,"y":83.8},{"x":1795392300000,"y":84.5},{"x":1795392360000,"y":84.9},{"x":1795392420000,"y":85.3},{"x":1795392480000,"y":86},{"x":1795392540000,"y":86.2},{"x":1795392600000,"y":86.5},{"x":1795392660000,"y":86.9},{"x":1795392720000,"y":87.1},{"x":1795392780000,"y":86.8}],"highlightExtremes":true,"unit":" %"}], {"yLabel":"%"}); }); $(document).ready(function() { buildMeteoChart('chart-pressure-canvas', 'chart-pressure-reset', [{"label":"Atmosférický tlak (hPa)","color":"#000000","points":[{"x":1795388400000,"y":1008.6},{"x":1795388460000,"y":1008.6},{"x":1795388520000,"y":1008.6},{"x":1795388580000,"y":1008.6},{"x":1795388640000,"y":1008.6},{"x":1795388700000,"y":1008.6},{"x":1795388760000,"y":1008.6},{"x":1795388820000,"y":1008.6},{"x":1795388880000,"y":1008.6},{"x":1795388940000,"y":1008.6},{"x":1795389000000,"y":1008.6},{"x":1795389060000,"y":1008.6},{"x":1795389120000,"y":1008.6},{"x":1795389180000,"y":1008.6},{"x":1795389240000,"y":1008.6},{"x":1795389300000,"y":1008.6},{"x":1795389360000,"y":1008.6},{"x":1795389420000,"y":1008.6},{"x":1795389480000,"y":1008.6},{"x":1795389540000,"y":1008.6},{"x":1795389600000,"y":1008.6},{"x":1795389660000,"y":1008.7},{"x":1795389720000,"y":1008.7},{"x":1795389780000,"y":1008.7},{"x":1795389840000,"y":1008.7},{"x":1795389900000,"y":1008.7},{"x":1795389960000,"y":1008.7},{"x":1795390020000,"y":1008.7},{"x":1795390080000,"y":1008.7},{"x":1795390140000,"y":1008.7},{"x":1795390200000,"y":1008.8},{"x":1795390260000,"y":1008.8},{"x":1795390320000,"y":1008.9},{"x":1795390380000,"y":1008.9},{"x":1795390440000,"y":1008.9},{"x":1795390500000,"y":1008.9},{"x":1795390560000,"y":1008.9},{"x":1795390620000,"y":1009},{"x":1795390680000,"y":1009},{"x":1795390740000,"y":1009},{"x":1795390800000,"y":1009},{"x":1795390860000,"y":1009},{"x":1795390920000,"y":1009},{"x":1795390980000,"y":1009},{"x":1795391040000,"y":1008.9},{"x":1795391100000,"y":1009},{"x":1795391160000,"y":1009},{"x":1795391220000,"y":1009},{"x":1795391280000,"y":1009},{"x":1795391340000,"y":1009},{"x":1795391400000,"y":1009.1},{"x":1795391460000,"y":1009.1},{"x":1795391520000,"y":1009.2},{"x":1795391580000,"y":1009.2},{"x":1795391640000,"y":1009.2},{"x":1795391700000,"y":1009.2},{"x":1795391760000,"y":1009.2},{"x":1795391820000,"y":1009.2},{"x":1795391880000,"y":1009.2},{"x":1795391940000,"y":1009.2},{"x":1795392000000,"y":1009.2},{"x":1795392060000,"y":1009.2},{"x":1795392120000,"y":1009.1},{"x":1795392180000,"y":1009.2},{"x":1795392240000,"y":1009.2},{"x":1795392300000,"y":1009.2},{"x":1795392360000,"y":1009.2},{"x":1795392420000,"y":1009.2},{"x":1795392480000,"y":1009.3},{"x":1795392540000,"y":1009.3},{"x":1795392600000,"y":1009.4},{"x":1795392660000,"y":1009.4},{"x":1795392720000,"y":1009.4},{"x":1795392780000,"y":1009.4}],"highlightExtremes":true,"unit":" hPa"}], {"yLabel":"hPa"}); }); $(document).ready(function() { buildMeteoChart('chart-wind-canvas', 'chart-wind-reset', [{"label":"Rýchlosť vetra (km\/h)","color":"#002f80","points":[{"x":1795388400000,"y":11.9},{"x":1795388460000,"y":10.8},{"x":1795388520000,"y":10.8},{"x":1795388580000,"y":10.1},{"x":1795388640000,"y":8.3},{"x":1795388700000,"y":8.6},{"x":1795388760000,"y":11.2},{"x":1795388820000,"y":10.8},{"x":1795388880000,"y":9.7},{"x":1795388940000,"y":9.7},{"x":1795389000000,"y":9},{"x":1795389060000,"y":7.6},{"x":1795389120000,"y":9.7},{"x":1795389180000,"y":10.4},{"x":1795389240000,"y":9.7},{"x":1795389300000,"y":8.3},{"x":1795389360000,"y":8.3},{"x":1795389420000,"y":10.8},{"x":1795389480000,"y":11.2},{"x":1795389540000,"y":11.2},{"x":1795389600000,"y":11.2},{"x":1795389660000,"y":9.4},{"x":1795389720000,"y":10.1},{"x":1795389780000,"y":11.2},{"x":1795389840000,"y":9.7},{"x":1795389900000,"y":9},{"x":1795389960000,"y":7.9},{"x":1795390020000,"y":7.6},{"x":1795390080000,"y":8.3},{"x":1795390140000,"y":7.9},{"x":1795390200000,"y":7.6},{"x":1795390260000,"y":5.8},{"x":1795390320000,"y":8.6},{"x":1795390380000,"y":8.6},{"x":1795390440000,"y":7.2},{"x":1795390500000,"y":6.8},{"x":1795390560000,"y":9.4},{"x":1795390620000,"y":10.4},{"x":1795390680000,"y":8.6},{"x":1795390740000,"y":10.8},{"x":1795390800000,"y":10.1},{"x":1795390860000,"y":7.9},{"x":1795390920000,"y":8.6},{"x":1795390980000,"y":9.7},{"x":1795391040000,"y":7.6},{"x":1795391100000,"y":9.7},{"x":1795391160000,"y":8.6},{"x":1795391220000,"y":10.1},{"x":1795391280000,"y":9.7},{"x":1795391340000,"y":9.4},{"x":1795391400000,"y":9.4},{"x":1795391460000,"y":12.2},{"x":1795391520000,"y":10.1},{"x":1795391580000,"y":8.6},{"x":1795391640000,"y":10.4},{"x":1795391700000,"y":10.4},{"x":1795391760000,"y":11.5},{"x":1795391820000,"y":11.9},{"x":1795391880000,"y":9.7},{"x":1795391940000,"y":10.4},{"x":1795392000000,"y":9.7},{"x":1795392060000,"y":9},{"x":1795392120000,"y":8.3},{"x":1795392180000,"y":9.4},{"x":1795392240000,"y":8.3},{"x":1795392300000,"y":8.3},{"x":1795392360000,"y":7.6},{"x":1795392420000,"y":7.9},{"x":1795392480000,"y":7.9},{"x":1795392540000,"y":7.6},{"x":1795392600000,"y":9},{"x":1795392660000,"y":7.6},{"x":1795392720000,"y":7.2},{"x":1795392780000,"y":6.5}],"highlightExtremes":true,"unit":" km\/h"},{"label":"Náraz vetra (km\/h)","color":"#EF9856","points":[{"x":1795388400000,"y":12.6},{"x":1795388460000,"y":11.9},{"x":1795388520000,"y":11.9},{"x":1795388580000,"y":11.5},{"x":1795388640000,"y":11.2},{"x":1795388700000,"y":10.4},{"x":1795388760000,"y":12.2},{"x":1795388820000,"y":12.2},{"x":1795388880000,"y":11.5},{"x":1795388940000,"y":10.8},{"x":1795389000000,"y":10.8},{"x":1795389060000,"y":10.1},{"x":1795389120000,"y":11.9},{"x":1795389180000,"y":12.2},{"x":1795389240000,"y":10.8},{"x":1795389300000,"y":9.7},{"x":1795389360000,"y":9.4},{"x":1795389420000,"y":13.3},{"x":1795389480000,"y":12.6},{"x":1795389540000,"y":14},{"x":1795389600000,"y":12.6},{"x":1795389660000,"y":11.5},{"x":1795389720000,"y":12.6},{"x":1795389780000,"y":14},{"x":1795389840000,"y":11.9},{"x":1795389900000,"y":11.2},{"x":1795389960000,"y":9.7},{"x":1795390020000,"y":9.4},{"x":1795390080000,"y":9.4},{"x":1795390140000,"y":9},{"x":1795390200000,"y":9},{"x":1795390260000,"y":7.2},{"x":1795390320000,"y":10.8},{"x":1795390380000,"y":10.8},{"x":1795390440000,"y":10.1},{"x":1795390500000,"y":9},{"x":1795390560000,"y":11.5},{"x":1795390620000,"y":13},{"x":1795390680000,"y":10.4},{"x":1795390740000,"y":13},{"x":1795390800000,"y":12.2},{"x":1795390860000,"y":9.7},{"x":1795390920000,"y":14},{"x":1795390980000,"y":13},{"x":1795391040000,"y":10.8},{"x":1795391100000,"y":13.7},{"x":1795391160000,"y":12.6},{"x":1795391220000,"y":13.7},{"x":1795391280000,"y":12.2},{"x":1795391340000,"y":11.2},{"x":1795391400000,"y":13.7},{"x":1795391460000,"y":15.1},{"x":1795391520000,"y":13},{"x":1795391580000,"y":10.4},{"x":1795391640000,"y":14.4},{"x":1795391700000,"y":14.4},{"x":1795391760000,"y":16.2},{"x":1795391820000,"y":16.2},{"x":1795391880000,"y":12.6},{"x":1795391940000,"y":11.5},{"x":1795392000000,"y":15.1},{"x":1795392060000,"y":13.7},{"x":1795392120000,"y":10.8},{"x":1795392180000,"y":11.5},{"x":1795392240000,"y":10.8},{"x":1795392300000,"y":10.4},{"x":1795392360000,"y":9},{"x":1795392420000,"y":10.1},{"x":1795392480000,"y":11.5},{"x":1795392540000,"y":10.1},{"x":1795392600000,"y":10.8},{"x":1795392660000,"y":8.6},{"x":1795392720000,"y":8.3},{"x":1795392780000,"y":7.9}],"highlightExtremes":true,"unit":" km\/h","showLine":false,"pointRadius":3}], {"yLabel":"km\/h"}); }); $(document).ready(function() { buildMeteoChart('chart-wind-direction-canvas', 'chart-wind-direction-reset', [{"label":"Smer vetra","color":"#002f80","points":[{"x":1795388400000,"y":44.2},{"x":1795388460000,"y":39.2},{"x":1795388520000,"y":47.2},{"x":1795388580000,"y":49.6},{"x":1795388640000,"y":44.8},{"x":1795388700000,"y":49.9},{"x":1795388760000,"y":53.2},{"x":1795388820000,"y":43.8},{"x":1795388880000,"y":38.9},{"x":1795388940000,"y":45.5},{"x":1795389000000,"y":44.7},{"x":1795389060000,"y":40.4},{"x":1795389120000,"y":36.6},{"x":1795389180000,"y":34.7},{"x":1795389240000,"y":29.4},{"x":1795389300000,"y":40.6},{"x":1795389360000,"y":34},{"x":1795389420000,"y":38.4},{"x":1795389480000,"y":32.6},{"x":1795389540000,"y":37.9},{"x":1795389600000,"y":30.4},{"x":1795389660000,"y":35.9},{"x":1795389720000,"y":43.2},{"x":1795389780000,"y":40.8},{"x":1795389840000,"y":43.4},{"x":1795389900000,"y":48.9},{"x":1795389960000,"y":55.3},{"x":1795390020000,"y":49.6},{"x":1795390080000,"y":47.4},{"x":1795390140000,"y":48.4},{"x":1795390200000,"y":55.6},{"x":1795390260000,"y":57},{"x":1795390320000,"y":53.1},{"x":1795390380000,"y":50.2},{"x":1795390440000,"y":46.9},{"x":1795390500000,"y":33.6},{"x":1795390560000,"y":39.2},{"x":1795390620000,"y":30.9},{"x":1795390680000,"y":28.8},{"x":1795390740000,"y":28.6},{"x":1795390800000,"y":28.7},{"x":1795390860000,"y":29.8},{"x":1795390920000,"y":24.8},{"x":1795390980000,"y":23},{"x":1795391040000,"y":27.2},{"x":1795391100000,"y":31.6},{"x":1795391160000,"y":35.8},{"x":1795391220000,"y":30.8},{"x":1795391280000,"y":33.5},{"x":1795391340000,"y":36.5},{"x":1795391400000,"y":22.1},{"x":1795391460000,"y":25.1},{"x":1795391520000,"y":27.8},{"x":1795391580000,"y":33.2},{"x":1795391640000,"y":24},{"x":1795391700000,"y":12.4},{"x":1795391760000,"y":15.3},{"x":1795391820000,"y":20.4},{"x":1795391880000,"y":30},{"x":1795391940000,"y":27.5},{"x":1795392000000,"y":25.8},{"x":1795392060000,"y":36.8},{"x":1795392120000,"y":67.8},{"x":1795392180000,"y":67.6},{"x":1795392240000,"y":66.7},{"x":1795392300000,"y":66.9},{"x":1795392360000,"y":74},{"x":1795392420000,"y":78},{"x":1795392480000,"y":71.5},{"x":1795392540000,"y":67.2},{"x":1795392600000,"y":64.6},{"x":1795392660000,"y":58.2},{"x":1795392720000,"y":66.7},{"x":1795392780000,"y":52.5}],"highlightExtremes":false,"showLine":false,"pointRadius":3,"tooltipMode":"windDirection"}], {"yMode":"compass"}); }); $(document).ready(function() { buildMeteoChart('chart-rain-canvas', 'chart-rain-reset', [{"label":"Zrážky (mm)","color":"#008fbf","points":[{"x":1795388460000,"y":0},{"x":1795388520000,"y":0},{"x":1795388580000,"y":0},{"x":1795388640000,"y":0},{"x":1795388700000,"y":0},{"x":1795388760000,"y":0},{"x":1795388820000,"y":0},{"x":1795388880000,"y":0},{"x":1795388940000,"y":0},{"x":1795389000000,"y":0},{"x":1795389060000,"y":0},{"x":1795389120000,"y":0},{"x":1795389180000,"y":0},{"x":1795389240000,"y":0},{"x":1795389300000,"y":0},{"x":1795389360000,"y":0},{"x":1795389420000,"y":0},{"x":1795389480000,"y":0},{"x":1795389540000,"y":0},{"x":1795389600000,"y":0},{"x":1795389660000,"y":0},{"x":1795389720000,"y":0},{"x":1795389780000,"y":0},{"x":1795389840000,"y":0},{"x":1795389900000,"y":0},{"x":1795389960000,"y":0},{"x":1795390020000,"y":0},{"x":1795390080000,"y":0},{"x":1795390140000,"y":0},{"x":1795390200000,"y":0},{"x":1795390260000,"y":0},{"x":1795390320000,"y":0},{"x":1795390380000,"y":0},{"x":1795390440000,"y":0},{"x":1795390500000,"y":0},{"x":1795390560000,"y":0},{"x":1795390620000,"y":0},{"x":1795390680000,"y":0},{"x":1795390740000,"y":0},{"x":1795390800000,"y":0},{"x":1795390860000,"y":0},{"x":1795390920000,"y":0},{"x":1795390980000,"y":0},{"x":1795391040000,"y":0},{"x":1795391100000,"y":0},{"x":1795391160000,"y":0},{"x":1795391220000,"y":0},{"x":1795391280000,"y":0},{"x":1795391340000,"y":0},{"x":1795391400000,"y":0},{"x":1795391460000,"y":0},{"x":1795391520000,"y":0},{"x":1795391580000,"y":0},{"x":1795391640000,"y":0},{"x":1795391700000,"y":0},{"x":1795391760000,"y":0},{"x":1795391820000,"y":0},{"x":1795391880000,"y":0},{"x":1795391940000,"y":0},{"x":1795392000000,"y":0},{"x":1795392060000,"y":0},{"x":1795392120000,"y":0},{"x":1795392180000,"y":0},{"x":1795392240000,"y":0},{"x":1795392300000,"y":0},{"x":1795392360000,"y":0},{"x":1795392420000,"y":0},{"x":1795392480000,"y":0},{"x":1795392540000,"y":0},{"x":1795392600000,"y":0},{"x":1795392660000,"y":0},{"x":1795392720000,"y":0},{"x":1795392780000,"y":0}],"highlightExtremes":false,"unit":" mm"}], {"yLabel":"mm","yMin":0}); }); $('.modal').on('hide.bs.modal', function() { var memory = $(this).html(); $(this).html(memory); }); function meteo_wind_direction_name(wind_direction) { if (wind_direction >= 0.00 && wind_direction <= 11.25) { ret = 'S'; } else if (wind_direction > 11.25 && wind_direction <= 33.75) { ret = 'SSV'; } else if (wind_direction > 33.75 && wind_direction <= 56.25) { ret = 'SV'; } else if (wind_direction > 56.25 && wind_direction <= 78.75) { // 67.5 ret = 'VSV'; } else if (wind_direction > 78.75 && wind_direction <= 101.25) { // 90 ret = 'V'; } else if (wind_direction > 101.25 && wind_direction <= 123.75) { //112.5 ret = 'VJV'; } else if (wind_direction > 123.75 && wind_direction <= 146.25) { // 135 ret = 'JV'; } else if (wind_direction > 146.25 && wind_direction <= 168.75) { // 157.5 ret = 'JJV'; } else if (wind_direction > 168.75 && wind_direction <= 191.25) { // 180 ret = 'J'; } else if (wind_direction > 191.25 && wind_direction <= 213.75) { // 202.5 ret = 'JJZ'; } else if (wind_direction > 213.75 && wind_direction <= 236.25) { // 225 ret = 'JZ'; } else if (wind_direction > 236.25 && wind_direction <= 258.75) { // 247.5 ret = 'ZJZ'; } else if (wind_direction > 258.75 && wind_direction <= 281.25) { // 270 ret = 'Z'; } else if (wind_direction > 281.25 && wind_direction <= 303.75) { // 292.5 ret = 'ZSZ'; } else if (wind_direction > 303.75 && wind_direction <= 326.25) { // 315 ret = 'SZ'; } else if (wind_direction > 326.25 && wind_direction <= 348.75) { // 337.5 ret = 'SSZ'; } else if (wind_direction > 348.75 && wind_direction <= 360.0) { // 337.5 ret = 'S'; } else { return ''; } return ret; }