Page 1 of 1

bottom axis ticks/labels only at values

Posted: Mon Jul 30, 2012 9:00 pm
by 16461616
Is it possible to have the bottom axis draw ticks and labels only at actual X values? For instance, I'm plotting values for the last day of each month and using Date values as my X values. Necessarily, this means that the X-values are not at regular intervals. I want the axis labels to align with X-values and only draw month-end dates. In the VCL product, I might just use integer values in the X-axis and the OnGetAxisLabel event. I don't immediately see anything like that available for the HTML5 TChart, but maybe I'm missing something. I tried both Line and PointXY series types to see if that made a difference, but I'm only getting ticks at regular intervals.

Thanks,
Rob Cooke

Re: bottom axis ticks/labels only at values

Posted: Fri Aug 10, 2012 7:26 am
by yeray
Hi Rob,

Excuse us for the delayed reply here.
I'm afraid you are right and the Javascript version doesn't still have the OnGetAxisLabel event. We've added it to the wish list.

Re: bottom axis ticks/labels only at values

Posted: Wed Sep 26, 2012 10:44 am
by yeray
Hi,

We've just implemented the OnGetLabel event in the Javascript version so this should be possible with the next maintenance release.
Ie:

Code: Select all

  Chart1.axes.bottom.labels.ongetlabel=function(value,s) {
    if (value==4) {
       this.format.font.fill="lime";
       this.format.font.style="14px Verdana";
       return "Four";
    }
    else
    {
       this.format.font.fill="black";
       this.format.font.style="11px Tahoma";
       return s;
    }
  }

  Chart1.axes.left.labels.ongetlabel=function(value,s) {
    if (value==6) {
       this.format.font.fill="red";
       this.format.font.style="14px Verdana";
       return "Six";
    }
    else
    {
       this.format.font.fill="black";
       this.format.font.style="11px Tahoma";
       return s;
    }
  }