@GRO24

Вывод даты и времени line chart?

Столкнулся с болью
Строю график с live chart
Пытаюсь вывести дату и время при наведении, но отображается только дата, время пишет 00:00:00

Дату беру с ответа json
пример json
{"status":"success","response":[{"date":"2019-08-04 18:28:13","price":"220.934228322"},{"date":"2019-08-04 19:11:09","price":"221.483932155"},{"date":"2019-08-04 19:12:01","price":"221.483932155"},{"date":"2019-08-04 19:15:01","price":"221.418862947"},{"date":"2019-08-04 19:18:01","price":"221.495813665"},{"date":"2019-08-04 19:21:01","price":"221.611565311"},{"date":"2019-08-04 19:24:01","price":"221.381930221"},{"date":"2019-08-04 19:27:01","price":"221.445902558"},{"date":"2019-08-04 19:30:01","price":"221.470737388"},{"date":"2019-08-04 19:33:01","price":"221.563388283"},{"date":"2019-08-04 19:36:01","price":"221.548670752"},{"date":"2019-08-04 19:39:01","price":"221.596490504"},{"date":"2019-08-04 19:42:01","price":"221.767601175"},{"date":"2019-08-04 19:45:01","price":"221.780754144"},{"date":"2019-08-04 19:48:01","price":"221.688589541"},{"date":"2019-08-04 19:51:01","price":"221.773438091"},{"date":"2019-08-04 19:54:01","price":"221.457241679"},{"date":"2019-08-04 19:57:01","price":"221.323482816"}]}

Код line chart
$(function() {
	if (document.getElementById("lineChart")) {
		var t = document.getElementById("lineChart").getContext("2d"),
			e = t.createLinearGradient(0, 0, 0, 244);
		e.addColorStop(0, "rgba(255, 77, 0, .41)"), e.addColorStop(1, "rgba(255, 77, 0, 0)");
		var i = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
		microexchange.lineChart = new Chart(t, {
			type: "line",
			data: {
				labels: [],
				datasets: [{
					data: [],
					backgroundColor: e,
					borderColor: ["#FF4D00"],
					pointBackgroundColor: "transparent",
					pointBorderColor: "transparent",
					borderWidth: 1
				}]
			},
			options: {
				responsive: !0,
				maintainAspectRatio: !1,
				legend: !1,
				tooltips: {
					displayColors: !1,
					mode: "x-axis",
					callbacks: {
						title: function(t, e) {
							return c(e.labels[t[0].index], !0)
						}
					}
				},
				scales: {
					yAxes: [{
						gridLines: {
							display: !1,
							drawBorder: !1
						},
						ticks: {
							maxTicksLimit: 10,
							padding: 10,
							fontStyle: 1,
							fontSize: 12,
							fontColor: "#939daa",
							fontFamily: "Roboto, sans-serif",
							beginAtZero: !1,
							maxRotation: 10,
							callback: function(t, e, a) {
								return "$" + t
							}
						}
					}],
					xAxes: [{
						gridLines: {
							display: !1,
							drawBorder: !1
						},
						ticks: {
							autoSkip: !1,
							maxTicksLimit: 7,
							padding: 6,
							fontStyle: 300,
							fontSize: 12,
							fontColor: "#939daa",
							fontFamily: "Roboto, sans-serif",
							callback: function(t, e, a) {
								//return n = t, o = e, r = a, i = new Date(n), l = i.getDate(), d = i.getMonth(), s = c(n), 0 != o && new Date(r[o - 1]).getMonth() == d && (s = ""), 10 < l && (s = ""), s;
								var n, o, r, i, l, d, s
							}
						}
					}]
				},
				elements: {
					line: {
						tension: 0
					}
				}
			}
		})
	}

	function c(t, e) {
		var a = new Date(t),
			n = a.getDate(),
			o = a.getMonth(),
			date2 = new Date(t).toISOString().substr(0, 19).replace('T', ' ');
			r = !1;
		return date2
	console.log(n);
	}
});


Может кто сталкивался?
  • Вопрос задан
  • 44 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы