hiding year on date format
hiding year on date format
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?
Re: hiding year on date format
Hello,
Find below a simple example:
Find below a simple example:
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();
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |