関数 checkDatabase の日付を xaxis の日付と比較しようとしています。それらを Date() で変換し、エポックから作成された日付オブジェクトから getDate() だけを比較しようとしました。
基本的に、データベースからの日付を xaxis の日付と比較し、一致する場合は if 条件を実行する必要があります。これについて何か助けていただければ幸いです
ありがとう
jsfiddle _
$(function () {
var chart;
chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
global: {
useUTC: false
},
xAxis: {
type: 'datetime',
labels: {
useHTML: true,
formatter: function () {
var d = new Date(parseInt(this.value));
return d.getDate();
//return this.value;
if (checkDatabase(this.value)) {
return 'test';
} else {
return 'else';
}
}
}
},
series: [{
data: [
[1147651200000, 40],
[1147737600000, 25]
]
}]
});
});
function checkDatabase(nd) {
//return val = '1147651200000';
var nd = new Date(parseInt(1147651200000));
return nd.getDate();
}