hiding year on date format
Posted: Fri Nov 23, 2018 2:24 am
I wish to fix it like following pictures.
1 . Year format is displayed only first time or when next year
How to fix it like this picture?
Steema Software - Customer Support Forums
https://407832.verdetrade-hk.tech/support/
https://407832.verdetrade-hk.tech/support/viewtopic.php?f=18&t=17071
Code: Select all
var Chart1;
function draw() {
Chart1 = new Tee.Chart("canvas1");
Chart1.legend.visible = false;
Chart1.axes.bottom.labels.dateFormat = "yyyy-mm-dd hh:MM:ss";
var drawingLabels = false;
var yearsDrawn;
Chart1.axes.bottom.oldDrawLabels = Chart1.axes.bottom.drawLabels;
Chart1.axes.bottom.drawLabels = function(){
drawingLabels = true;
yearsDrawn = [];
this.oldDrawLabels();
drawingLabels = false;
console.log(yearsDrawn);
}
Chart1.axes.bottom.labels.ongetlabel = function(value, text) {
if (drawingLabels) {
console.log(text);
var year = text.substr(0, 4);
if (yearsDrawn.indexOf(year) === -1) {
yearsDrawn.push(year);
}
else {
text = text.substr(5);
}
}
return text;
}
var series1 = Chart1.addSeries(new Tee.Line()).addRandom(500);
var msecsInADay=86400000; //24*60*60*1000
series1.data.x=new Array(series1.count());
var now=new Date();
for (var t=0; t<series1.count(); t++) {
series1.data.x[t] = new Date(now.getTime() + t * msecsInADay);
}
Chart1.draw();
}