// chart_type = line, bar var drawChart = function (data_inputx, data_inputy, chart_type, chart_id) { if (typeof chart == "object") { chart.destroy(); } var xaxis_type = 'datetime' var x_tooltip_format = 'dd MMM yy HH:mm' var options = { series: data_inputy, chart: { type: chart_type, height: 350, // foreColor: '#ccc', foreColor: '#000', }, // theme: { // mode: 'dark', // }, background: '#141619', dataLabels: { enabled: false, }, stroke: { // curve: 'smooth', width: 1.5 }, responsive: [{ breakpoint: 480, options: { legend: { position: 'bottom', // offsetX: -10, offsetY: 0 } } }], tooltip: { theme: 'dark', // format: 'dd.MM.yy HH:mm', // datetimeFormatter: { // year: 'yyyy', // month: 'MMM yy', // day: 'dd.MM.yy', // hour: 'HH:mm dd.MM' // } x: { show: true, format: x_tooltip_format, // formatter: undefined, }, }, // grid: { // borderColor: "#535A6C", // xaxis: { // lines: { // show: true // } // } // }, xaxis: { categories: data_inputx, labels: { // style: { // fontSize: '15px', // fontWeight: 800, // }, datetimeFormatter: { year: 'yyyy', month: 'MM.yy', day: "dd.MM.yy", hour: 'dd.MM.yy HH:mm' } }, type: xaxis_type, } }; chart = new ApexCharts(document.querySelector(chart_id), options); chart.render(); }