var histNoiseSTA function getSTAHistNoise(){ try { $.ajax({ async: true, type: "POST", url: getSTANoiseHistUrl, data: "", }).done(function (histwinddata) { convertdata(histwinddata); console.log(histwinddata) }); function convertdata(histwinddt) { histNoiseSTA = histwinddt; console.log(histNoiseSTA[0]); showgraphNoiseSTA(); } } catch (err) { console.log('-> function gethistWind() failed!\n' + err); } } function showgraphNoiseSTA(){ var i; var datas = [] var datamin = [] var datamax = [] var dataseq = [] // console.log(histNoise.length) var sDay = new Date('1995-12-17T03:24:00'); for (i = 0; i < histNoiseSTA.length; i++) { console.log(i) // console.log(noise_LA_maxnumb) var datestuff = Date.parse(histNoiseSTA[i].phenomenonTime) var valuestuff = histNoiseSTA[i].result // console.log(datestuff.toUTCString()) // if (histNoiseSTA[i].noise == "LAeq"){ datas.push({x: datestuff, y: parseFloat(valuestuff.toFixed(2))}) // } else if (histNoiseSTA[i].noise == "LAmin") { // datamin.push({x: datestuff, y: parseFloat(valuestuff.toFixed(2))}) // } else if (histNoiseSTA[i].noise == "LAmax") { // datamax.push({x: datestuff, y: parseFloat(valuestuff.toFixed(2))}) // } } // console.log(datas) // console.log(dataseq) console.log("--------") // console.log([{ // x: new Date('2018-02-12').getTime(), // y: 76 // }, { // x: new Date('2018-02-12').getTime(), // y: 76 // }]) var options = { chart: { type: "area", height: 300, foreColor: "#999", stacked: false, dropShadow: { enabled: true, enabledSeries: [0], top: -2, left: 2, blur: 5, opacity: 0.06 } }, colors: ['#7F0000','#00E396', '#0090FF'], stroke: { curve: "smooth", width: 3 }, dataLabels: { enabled: false }, series: [{ name: 'Noise_LAeq', data: datas }], markers: { size: 0, strokeColor: "#fff", strokeWidth: 3, strokeOpacity: 1, fillOpacity: 1, hover: { size: 6 } }, xaxis: { type: "datetime", labels: { datetimeUTC: false }, axisBorder: { show: false }, axisTicks: { show: false } }, yaxis: { labels: { offsetX: 14, offsetY: -5 }, tooltip: { enabled: true } }, grid: { padding: { left: -5, right: 5 } }, tooltip: { x: { format: "dd.MM.yyyy HH:mm" }, }, legend: { position: 'top', horizontalAlign: 'left' }, fill: { type: 'gradient', gradient: { shadeIntensity: 1, inverseColors: false, opacityFrom: 0.5, opacityTo: 0, stops: [0, 90, 100] }, } }; document.getElementById("chartNoiseSTA").innerHTML = ""; var chart = new ApexCharts(document.querySelector("#chartNoiseSTA"), options); // document.getElementById("infobtnNoise").classList.add('infobtn'); // document.getElementById("infobtnNoise").classList.remove('loaderN'); console.log("end") chart.render(); }