Home
Analytics
Changing x-axis labels only
cypherdj
Hi there,<br />
<br />
I have implemented the following beforeDrawAxisPoint method, but this currently updates labels on both x and y axis. However, I only want to change the x axis labels and cannot figure out how to:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawAxisLabel(axis, label, icsc)
{
importPackage(Packages.org.eclipse.birt.core.script);
reportDate = icsc.getExternalContext().getScriptable().getParameterValue("reportDate");
value = label.getCaption().getValue();
if (value == 0){
label.getCaption().setValue("Overdue");
} else if (value == 1){
label.getCaption().setValue("Due " + reportDate);
} else if (value == 2){
label.getCaption().setValue("Due " + DateTimeSpan.addDate(reportDate, 0, 0, 7));
} else if (value == 3){
label.getCaption().setValue("Due " + DateTimeSpan.addDate(reportDate, 0, 0, 14));
} else if (value == 4){
label.getCaption().setValue("Due " + DateTimeSpan.addDate(reportDate, 0, 0, 21));
} else if (value == 5){
label.getCaption().setValue("Due " + DateTimeSpan.addDate(reportDate, 0, 0, 28));
} else {
label.getCaption().setValue("");
}
}
</pre>
<br />
I guess it has something to do with axis.getType() but if I test this against axis.BASE, the transformation does not apply to any axis, and if I remove that test, it then applies to both.<br />
<br />
Any suggestions?<br />
<br />
Regards,<br />
Cedric
Find more posts tagged with
Comments
cypherdj
Problem solved, this seemed to do the trick:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (axis.getOrientation() == Orientation.HORIZONTAL_LITERAL){
</pre>