var meteoCharts = {}; var meteoCompassLabels = {0: 'S', 90: 'V', 180: 'J', 270: 'Z', 360: 'S'}; var meteoRangeMin = 1795474800000; var meteoRangeMax = 1795484123000; 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":1795474800000,"y":-18.9},{"x":1795474860000,"y":-18.9},{"x":1795474920000,"y":-18.9},{"x":1795474980000,"y":-18.9},{"x":1795475040000,"y":-18.9},{"x":1795475100000,"y":-18.9},{"x":1795475160000,"y":-18.9},{"x":1795475220000,"y":-18.9},{"x":1795475280000,"y":-18.9},{"x":1795475340000,"y":-18.9},{"x":1795475400000,"y":-18.9},{"x":1795475460000,"y":-18.9},{"x":1795475520000,"y":-18.9},{"x":1795475580000,"y":-18.9},{"x":1795475640000,"y":-18.8},{"x":1795475700000,"y":-18.8},{"x":1795475760000,"y":-18.8},{"x":1795475820000,"y":-18.8},{"x":1795475880000,"y":-18.8},{"x":1795475940000,"y":-18.8},{"x":1795476000000,"y":-18.8},{"x":1795476060000,"y":-18.8},{"x":1795476120000,"y":-18.8},{"x":1795476180000,"y":-18.8},{"x":1795476240000,"y":-18.8},{"x":1795476300000,"y":-18.8},{"x":1795476360000,"y":-18.8},{"x":1795476420000,"y":-18.8},{"x":1795476480000,"y":-18.8},{"x":1795476540000,"y":-18.8},{"x":1795476600000,"y":-18.8},{"x":1795476660000,"y":-18.8},{"x":1795476720000,"y":-18.8},{"x":1795476780000,"y":-18.8},{"x":1795476840000,"y":-18.8},{"x":1795476900000,"y":-18.8},{"x":1795476960000,"y":-18.8},{"x":1795477020000,"y":-18.8},{"x":1795477080000,"y":-18.8},{"x":1795477140000,"y":-18.8},{"x":1795477200000,"y":-18.8},{"x":1795477260000,"y":-18.8},{"x":1795477320000,"y":-18.8},{"x":1795477380000,"y":-18.8},{"x":1795477440000,"y":-18.8},{"x":1795477500000,"y":-18.8},{"x":1795477560000,"y":-18.8},{"x":1795477620000,"y":-18.8},{"x":1795477680000,"y":-18.8},{"x":1795477740000,"y":-18.8},{"x":1795477800000,"y":-18.8},{"x":1795477860000,"y":-18.8},{"x":1795477920000,"y":-18.8},{"x":1795477980000,"y":-18.8},{"x":1795478040000,"y":-18.8},{"x":1795478100000,"y":-18.8},{"x":1795478160000,"y":-18.8},{"x":1795478220000,"y":-18.8},{"x":1795478280000,"y":-18.8},{"x":1795478340000,"y":-18.8},{"x":1795478400000,"y":-18.8},{"x":1795478460000,"y":-18.8},{"x":1795478520000,"y":-18.8},{"x":1795478580000,"y":-18.8},{"x":1795478640000,"y":-18.7},{"x":1795478700000,"y":-18.7},{"x":1795478760000,"y":-18.7},{"x":1795478820000,"y":-18.7},{"x":1795478880000,"y":-18.7},{"x":1795478940000,"y":-18.7},{"x":1795479000000,"y":-18.7},{"x":1795479060000,"y":-18.7},{"x":1795479120000,"y":-18.7},{"x":1795479180000,"y":-18.7},{"x":1795479240000,"y":-18.7},{"x":1795479300000,"y":-18.7},{"x":1795479360000,"y":-18.7},{"x":1795479420000,"y":-18.7},{"x":1795479480000,"y":-18.7},{"x":1795479540000,"y":-18.7},{"x":1795479600000,"y":-18.7},{"x":1795479660000,"y":-18.7},{"x":1795479720000,"y":-18.7},{"x":1795479780000,"y":-18.8},{"x":1795479840000,"y":-18.8},{"x":1795479900000,"y":-18.8},{"x":1795479960000,"y":-18.8},{"x":1795480020000,"y":-18.8},{"x":1795480080000,"y":-18.8},{"x":1795480140000,"y":-18.8},{"x":1795480200000,"y":-18.8},{"x":1795480260000,"y":-18.8},{"x":1795480320000,"y":-18.8},{"x":1795480380000,"y":-18.8},{"x":1795480440000,"y":-18.8},{"x":1795480500000,"y":-18.8},{"x":1795480560000,"y":-18.8},{"x":1795480620000,"y":-18.8},{"x":1795480680000,"y":-18.8}],"highlightExtremes":true,"unit":" °C"},{"label":"Rosný bod (°C)","color":"#5b9f4a","points":[{"x":1795474800000,"y":-22.1},{"x":1795474860000,"y":-22.1},{"x":1795474920000,"y":-22.1},{"x":1795474980000,"y":-22.1},{"x":1795475040000,"y":-22.1},{"x":1795475100000,"y":-22.1},{"x":1795475160000,"y":-22.1},{"x":1795475220000,"y":-22.1},{"x":1795475280000,"y":-22.1},{"x":1795475340000,"y":-22.1},{"x":1795475400000,"y":-22.1},{"x":1795475460000,"y":-22.1},{"x":1795475520000,"y":-22.1},{"x":1795475580000,"y":-22.1},{"x":1795475640000,"y":-22},{"x":1795475700000,"y":-22},{"x":1795475760000,"y":-22},{"x":1795475820000,"y":-22},{"x":1795475880000,"y":-22},{"x":1795475940000,"y":-22},{"x":1795476000000,"y":-22},{"x":1795476060000,"y":-22},{"x":1795476120000,"y":-22},{"x":1795476180000,"y":-22},{"x":1795476240000,"y":-22},{"x":1795476300000,"y":-22},{"x":1795476360000,"y":-22},{"x":1795476420000,"y":-22},{"x":1795476480000,"y":-22},{"x":1795476540000,"y":-22},{"x":1795476600000,"y":-22},{"x":1795476660000,"y":-22},{"x":1795476720000,"y":-22},{"x":1795476780000,"y":-22},{"x":1795476840000,"y":-22},{"x":1795476900000,"y":-22},{"x":1795476960000,"y":-22},{"x":1795477020000,"y":-22},{"x":1795477080000,"y":-22},{"x":1795477140000,"y":-22},{"x":1795477200000,"y":-22},{"x":1795477260000,"y":-22},{"x":1795477320000,"y":-22},{"x":1795477380000,"y":-22},{"x":1795477440000,"y":-22},{"x":1795477500000,"y":-22},{"x":1795477560000,"y":-22},{"x":1795477620000,"y":-22},{"x":1795477680000,"y":-22},{"x":1795477740000,"y":-22},{"x":1795477800000,"y":-22},{"x":1795477860000,"y":-22},{"x":1795477920000,"y":-22},{"x":1795477980000,"y":-22},{"x":1795478040000,"y":-22},{"x":1795478100000,"y":-22},{"x":1795478160000,"y":-22},{"x":1795478220000,"y":-22},{"x":1795478280000,"y":-22},{"x":1795478340000,"y":-22},{"x":1795478400000,"y":-22},{"x":1795478460000,"y":-22},{"x":1795478520000,"y":-22},{"x":1795478580000,"y":-22},{"x":1795478640000,"y":-21.9},{"x":1795478700000,"y":-21.9},{"x":1795478760000,"y":-21.9},{"x":1795478820000,"y":-21.9},{"x":1795478880000,"y":-21.9},{"x":1795478940000,"y":-21.9},{"x":1795479000000,"y":-21.9},{"x":1795479060000,"y":-21.9},{"x":1795479120000,"y":-21.9},{"x":1795479180000,"y":-21.9},{"x":1795479240000,"y":-21.9},{"x":1795479300000,"y":-21.9},{"x":1795479360000,"y":-21.9},{"x":1795479420000,"y":-21.9},{"x":1795479480000,"y":-21.9},{"x":1795479540000,"y":-21.9},{"x":1795479600000,"y":-21.9},{"x":1795479660000,"y":-21.9},{"x":1795479720000,"y":-21.9},{"x":1795479780000,"y":-22},{"x":1795479840000,"y":-22},{"x":1795479900000,"y":-22},{"x":1795479960000,"y":-22},{"x":1795480020000,"y":-22},{"x":1795480080000,"y":-22},{"x":1795480140000,"y":-22},{"x":1795480200000,"y":-22},{"x":1795480260000,"y":-22},{"x":1795480320000,"y":-22},{"x":1795480380000,"y":-22},{"x":1795480440000,"y":-22},{"x":1795480500000,"y":-22},{"x":1795480560000,"y":-22},{"x":1795480620000,"y":-22},{"x":1795480680000,"y":-22}],"highlightExtremes":false,"unit":" °C"}], {"yLabel":"\u00b0C"}); }); $(document).ready(function() { buildMeteoChart('chart-humidity-canvas', 'chart-humidity-reset', [{"label":"Vlhkosť (%)","color":"#ff9000","points":[{"x":1795474800000,"y":75.7},{"x":1795474860000,"y":75.8},{"x":1795474920000,"y":75.8},{"x":1795474980000,"y":75.9},{"x":1795475040000,"y":75.9},{"x":1795475100000,"y":75.9},{"x":1795475160000,"y":75.9},{"x":1795475220000,"y":75.9},{"x":1795475280000,"y":75.9},{"x":1795475340000,"y":76},{"x":1795475400000,"y":76},{"x":1795475460000,"y":76.2},{"x":1795475520000,"y":76.2},{"x":1795475580000,"y":76.1},{"x":1795475640000,"y":76.2},{"x":1795475700000,"y":76.2},{"x":1795475760000,"y":76.2},{"x":1795475820000,"y":76.2},{"x":1795475880000,"y":76.2},{"x":1795475940000,"y":76.2},{"x":1795476000000,"y":76.2},{"x":1795476060000,"y":76.2},{"x":1795476120000,"y":76.2},{"x":1795476180000,"y":76.1},{"x":1795476240000,"y":76.1},{"x":1795476300000,"y":76.2},{"x":1795476360000,"y":76.1},{"x":1795476420000,"y":76.2},{"x":1795476480000,"y":76.1},{"x":1795476540000,"y":76.1},{"x":1795476600000,"y":76.1},{"x":1795476660000,"y":76.1},{"x":1795476720000,"y":76.1},{"x":1795476780000,"y":76.1},{"x":1795476840000,"y":76.1},{"x":1795476900000,"y":76.1},{"x":1795476960000,"y":76.1},{"x":1795477020000,"y":76.1},{"x":1795477080000,"y":76.1},{"x":1795477140000,"y":76.1},{"x":1795477200000,"y":76.1},{"x":1795477260000,"y":76.1},{"x":1795477320000,"y":76},{"x":1795477380000,"y":76},{"x":1795477440000,"y":75.9},{"x":1795477500000,"y":75.9},{"x":1795477560000,"y":76},{"x":1795477620000,"y":76},{"x":1795477680000,"y":75.9},{"x":1795477740000,"y":75.9},{"x":1795477800000,"y":76},{"x":1795477860000,"y":76},{"x":1795477920000,"y":76},{"x":1795477980000,"y":76},{"x":1795478040000,"y":76},{"x":1795478100000,"y":76},{"x":1795478160000,"y":76},{"x":1795478220000,"y":76},{"x":1795478280000,"y":76.1},{"x":1795478340000,"y":76.1},{"x":1795478400000,"y":76.1},{"x":1795478460000,"y":76.1},{"x":1795478520000,"y":76.2},{"x":1795478580000,"y":76.2},{"x":1795478640000,"y":76.3},{"x":1795478700000,"y":76.2},{"x":1795478760000,"y":76.3},{"x":1795478820000,"y":76.2},{"x":1795478880000,"y":76.2},{"x":1795478940000,"y":76.2},{"x":1795479000000,"y":76.2},{"x":1795479060000,"y":76.2},{"x":1795479120000,"y":76.2},{"x":1795479180000,"y":76.2},{"x":1795479240000,"y":76.2},{"x":1795479300000,"y":76.1},{"x":1795479360000,"y":76},{"x":1795479420000,"y":76},{"x":1795479480000,"y":76},{"x":1795479540000,"y":76},{"x":1795479600000,"y":76.1},{"x":1795479660000,"y":76},{"x":1795479720000,"y":75.9},{"x":1795479780000,"y":75.8},{"x":1795479840000,"y":75.9},{"x":1795479900000,"y":75.9},{"x":1795479960000,"y":76},{"x":1795480020000,"y":76},{"x":1795480080000,"y":75.9},{"x":1795480140000,"y":75.9},{"x":1795480200000,"y":75.9},{"x":1795480260000,"y":75.9},{"x":1795480320000,"y":76},{"x":1795480380000,"y":76},{"x":1795480440000,"y":75.9},{"x":1795480500000,"y":75.9},{"x":1795480560000,"y":76},{"x":1795480620000,"y":76},{"x":1795480680000,"y":76}],"highlightExtremes":true,"unit":" %"}], {"yLabel":"%"}); }); $(document).ready(function() { buildMeteoChart('chart-wind-canvas', 'chart-wind-reset', [{"label":"Rýchlosť vetra (km\/h)","color":"#002f80","points":[{"x":1795474800000,"y":61.2},{"x":1795474860000,"y":65.2},{"x":1795474920000,"y":74.2},{"x":1795474980000,"y":62.6},{"x":1795475040000,"y":61.9},{"x":1795475100000,"y":64.4},{"x":1795475160000,"y":61.2},{"x":1795475220000,"y":63.4},{"x":1795475280000,"y":69.5},{"x":1795475340000,"y":72.7},{"x":1795475400000,"y":74.2},{"x":1795475460000,"y":79.6},{"x":1795475520000,"y":69.1},{"x":1795475580000,"y":65.2},{"x":1795475640000,"y":69.1},{"x":1795475700000,"y":64.4},{"x":1795475760000,"y":68},{"x":1795475820000,"y":68.8},{"x":1795475880000,"y":67.7},{"x":1795475940000,"y":62.6},{"x":1795476000000,"y":71.3},{"x":1795476060000,"y":72},{"x":1795476120000,"y":69.5},{"x":1795476180000,"y":69.5},{"x":1795476240000,"y":67.7},{"x":1795476300000,"y":68.4},{"x":1795476360000,"y":61.2},{"x":1795476420000,"y":70.6},{"x":1795476480000,"y":69.8},{"x":1795476540000,"y":68.4},{"x":1795476600000,"y":72},{"x":1795476660000,"y":75.6},{"x":1795476720000,"y":73.4},{"x":1795476780000,"y":70.6},{"x":1795476840000,"y":72.4},{"x":1795476900000,"y":74.2},{"x":1795476960000,"y":74.9},{"x":1795477020000,"y":70.6},{"x":1795477080000,"y":66.2},{"x":1795477140000,"y":62.6},{"x":1795477200000,"y":68},{"x":1795477260000,"y":69.5},{"x":1795477320000,"y":67},{"x":1795477380000,"y":65.2},{"x":1795477440000,"y":64.4},{"x":1795477500000,"y":63},{"x":1795477560000,"y":54.7},{"x":1795477620000,"y":62.6},{"x":1795477680000,"y":63},{"x":1795477740000,"y":64.1},{"x":1795477800000,"y":64.4},{"x":1795477860000,"y":68.8},{"x":1795477920000,"y":65.9},{"x":1795477980000,"y":65.9},{"x":1795478040000,"y":65.5},{"x":1795478100000,"y":61.2},{"x":1795478160000,"y":61.6},{"x":1795478220000,"y":49},{"x":1795478280000,"y":61.6},{"x":1795478340000,"y":62.6},{"x":1795478400000,"y":63},{"x":1795478460000,"y":54.4},{"x":1795478520000,"y":58.3},{"x":1795478580000,"y":63},{"x":1795478640000,"y":60.1},{"x":1795478700000,"y":57.6},{"x":1795478760000,"y":63},{"x":1795478820000,"y":63.4},{"x":1795478880000,"y":66.2},{"x":1795478940000,"y":60.1},{"x":1795479000000,"y":56.5},{"x":1795479060000,"y":51.8},{"x":1795479120000,"y":66.2},{"x":1795479180000,"y":43.2},{"x":1795479240000,"y":47.9},{"x":1795479300000,"y":61.6},{"x":1795479360000,"y":57.2},{"x":1795479420000,"y":43.9},{"x":1795479480000,"y":58.3},{"x":1795479540000,"y":57.6},{"x":1795479600000,"y":52.9},{"x":1795479660000,"y":56.2},{"x":1795479720000,"y":56.2},{"x":1795479780000,"y":55.4},{"x":1795479840000,"y":48.2},{"x":1795479900000,"y":50},{"x":1795479960000,"y":53.6},{"x":1795480020000,"y":54},{"x":1795480080000,"y":51.1},{"x":1795480140000,"y":44.6},{"x":1795480200000,"y":50.4},{"x":1795480260000,"y":54.7},{"x":1795480320000,"y":56.9},{"x":1795480380000,"y":46.8},{"x":1795480440000,"y":48.6},{"x":1795480500000,"y":34.2},{"x":1795480560000,"y":43.6},{"x":1795480620000,"y":52.6},{"x":1795480680000,"y":50}],"highlightExtremes":true,"unit":" km\/h"},{"label":"Náraz vetra (km\/h)","color":"#EF9856","points":[{"x":1795474800000,"y":73.1},{"x":1795474860000,"y":80.6},{"x":1795474920000,"y":84.6},{"x":1795474980000,"y":79.2},{"x":1795475040000,"y":72},{"x":1795475100000,"y":73.4},{"x":1795475160000,"y":80.6},{"x":1795475220000,"y":72},{"x":1795475280000,"y":79.9},{"x":1795475340000,"y":79.2},{"x":1795475400000,"y":81.4},{"x":1795475460000,"y":87.8},{"x":1795475520000,"y":79.9},{"x":1795475580000,"y":76.7},{"x":1795475640000,"y":86.4},{"x":1795475700000,"y":79.9},{"x":1795475760000,"y":79.6},{"x":1795475820000,"y":73.4},{"x":1795475880000,"y":78.1},{"x":1795475940000,"y":90.7},{"x":1795476000000,"y":74.9},{"x":1795476060000,"y":79.9},{"x":1795476120000,"y":73.8},{"x":1795476180000,"y":73.8},{"x":1795476240000,"y":73.8},{"x":1795476300000,"y":70.6},{"x":1795476360000,"y":72.7},{"x":1795476420000,"y":74.9},{"x":1795476480000,"y":72},{"x":1795476540000,"y":73.4},{"x":1795476600000,"y":76.3},{"x":1795476660000,"y":78.1},{"x":1795476720000,"y":76.3},{"x":1795476780000,"y":77.4},{"x":1795476840000,"y":77.4},{"x":1795476900000,"y":77},{"x":1795476960000,"y":77},{"x":1795477020000,"y":75.6},{"x":1795477080000,"y":71.3},{"x":1795477140000,"y":69.5},{"x":1795477200000,"y":74.9},{"x":1795477260000,"y":77},{"x":1795477320000,"y":70.9},{"x":1795477380000,"y":70.2},{"x":1795477440000,"y":68.4},{"x":1795477500000,"y":72.4},{"x":1795477560000,"y":65.2},{"x":1795477620000,"y":68.4},{"x":1795477680000,"y":67},{"x":1795477740000,"y":67},{"x":1795477800000,"y":74.2},{"x":1795477860000,"y":75.2},{"x":1795477920000,"y":69.1},{"x":1795477980000,"y":69.5},{"x":1795478040000,"y":67.3},{"x":1795478100000,"y":67.3},{"x":1795478160000,"y":65.9},{"x":1795478220000,"y":61.6},{"x":1795478280000,"y":70.6},{"x":1795478340000,"y":74.2},{"x":1795478400000,"y":67.7},{"x":1795478460000,"y":64.4},{"x":1795478520000,"y":67},{"x":1795478580000,"y":69.8},{"x":1795478640000,"y":67},{"x":1795478700000,"y":68},{"x":1795478760000,"y":71.6},{"x":1795478820000,"y":69.8},{"x":1795478880000,"y":69.8},{"x":1795478940000,"y":69.1},{"x":1795479000000,"y":65.5},{"x":1795479060000,"y":66.6},{"x":1795479120000,"y":78.8},{"x":1795479180000,"y":78.8},{"x":1795479240000,"y":73.8},{"x":1795479300000,"y":68.4},{"x":1795479360000,"y":73.1},{"x":1795479420000,"y":62.6},{"x":1795479480000,"y":66.2},{"x":1795479540000,"y":72.4},{"x":1795479600000,"y":60.1},{"x":1795479660000,"y":63},{"x":1795479720000,"y":61.6},{"x":1795479780000,"y":60.8},{"x":1795479840000,"y":58.7},{"x":1795479900000,"y":60.1},{"x":1795479960000,"y":61.6},{"x":1795480020000,"y":58.3},{"x":1795480080000,"y":59},{"x":1795480140000,"y":56.2},{"x":1795480200000,"y":61.6},{"x":1795480260000,"y":62.3},{"x":1795480320000,"y":64.4},{"x":1795480380000,"y":63.7},{"x":1795480440000,"y":61.9},{"x":1795480500000,"y":51.5},{"x":1795480560000,"y":52.9},{"x":1795480620000,"y":61.9},{"x":1795480680000,"y":59}],"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":1795474800000,"y":328.3},{"x":1795474860000,"y":316.6},{"x":1795474920000,"y":312.6},{"x":1795474980000,"y":316.4},{"x":1795475040000,"y":317.6},{"x":1795475100000,"y":319.6},{"x":1795475160000,"y":322.4},{"x":1795475220000,"y":324},{"x":1795475280000,"y":320.5},{"x":1795475340000,"y":315.9},{"x":1795475400000,"y":317.5},{"x":1795475460000,"y":313.9},{"x":1795475520000,"y":317.7},{"x":1795475580000,"y":312.6},{"x":1795475640000,"y":321.4},{"x":1795475700000,"y":320},{"x":1795475760000,"y":315.2},{"x":1795475820000,"y":316.4},{"x":1795475880000,"y":318.7},{"x":1795475940000,"y":322.9},{"x":1795476000000,"y":313.9},{"x":1795476060000,"y":315.5},{"x":1795476120000,"y":316.4},{"x":1795476180000,"y":318.2},{"x":1795476240000,"y":320.4},{"x":1795476300000,"y":315.8},{"x":1795476360000,"y":320.5},{"x":1795476420000,"y":318.4},{"x":1795476480000,"y":316.7},{"x":1795476540000,"y":313.1},{"x":1795476600000,"y":316.5},{"x":1795476660000,"y":316.3},{"x":1795476720000,"y":316},{"x":1795476780000,"y":314.7},{"x":1795476840000,"y":315.7},{"x":1795476900000,"y":314.5},{"x":1795476960000,"y":312.9},{"x":1795477020000,"y":313.9},{"x":1795477080000,"y":319.2},{"x":1795477140000,"y":317.7},{"x":1795477200000,"y":317},{"x":1795477260000,"y":316.9},{"x":1795477320000,"y":318.7},{"x":1795477380000,"y":316.9},{"x":1795477440000,"y":315},{"x":1795477500000,"y":320.8},{"x":1795477560000,"y":324.5},{"x":1795477620000,"y":316.3},{"x":1795477680000,"y":315.2},{"x":1795477740000,"y":312.9},{"x":1795477800000,"y":314.1},{"x":1795477860000,"y":314.3},{"x":1795477920000,"y":313.3},{"x":1795477980000,"y":315},{"x":1795478040000,"y":314.5},{"x":1795478100000,"y":317.6},{"x":1795478160000,"y":313.4},{"x":1795478220000,"y":325.9},{"x":1795478280000,"y":315},{"x":1795478340000,"y":312.9},{"x":1795478400000,"y":316.4},{"x":1795478460000,"y":318.9},{"x":1795478520000,"y":314.5},{"x":1795478580000,"y":311},{"x":1795478640000,"y":313.6},{"x":1795478700000,"y":311.1},{"x":1795478760000,"y":312.1},{"x":1795478820000,"y":311.9},{"x":1795478880000,"y":310.1},{"x":1795478940000,"y":315.5},{"x":1795479000000,"y":317.7},{"x":1795479060000,"y":312},{"x":1795479120000,"y":309.2},{"x":1795479180000,"y":324.4},{"x":1795479240000,"y":300.7},{"x":1795479300000,"y":313.2},{"x":1795479360000,"y":317.7},{"x":1795479420000,"y":317.1},{"x":1795479480000,"y":309.6},{"x":1795479540000,"y":311.1},{"x":1795479600000,"y":308.8},{"x":1795479660000,"y":307.6},{"x":1795479720000,"y":316.6},{"x":1795479780000,"y":315},{"x":1795479840000,"y":313.9},{"x":1795479900000,"y":312.4},{"x":1795479960000,"y":314.1},{"x":1795480020000,"y":313.1},{"x":1795480080000,"y":310},{"x":1795480140000,"y":322.3},{"x":1795480200000,"y":315.1},{"x":1795480260000,"y":313.5},{"x":1795480320000,"y":306.4},{"x":1795480380000,"y":323.1},{"x":1795480440000,"y":315.9},{"x":1795480500000,"y":310.7},{"x":1795480560000,"y":320},{"x":1795480620000,"y":306.1},{"x":1795480680000,"y":317}],"highlightExtremes":false,"showLine":false,"pointRadius":3,"tooltipMode":"windDirection"}], {"yMode":"compass"}); }); $('.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; }