Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Display X - axis labels as bi-yearly
jain
<p>Hi All,</p><p>I'm using Actuate BIRT Designer professional 11.0.4, currently I'm working on line chart in that I'm displaying the X - axis date labels as monthly, quarterly, yearly up to end date.
And its working fine, but I've another requirement that I want to display bi-yearly also. For that I'm using below code:</p><p> </p><p>xAxis.getScale().setUnit(ScaleUnitType.YEARS_LITERAL);
xAxis.getScale().setStep(2.0);</p><p> </p><p>This is also working fine, but in some scenarios skipping 1 date interval at the end. for eg.(here my end date is 12/31/2010):
X axis labels: 12/31/2001, 12/31/2003, 12/31/2005, 12/31/2007,12/31/2010.
So in the above time periods it skipps the 12/31/2009.
I want to display like below
X axis labels: 12/31/2001, 12/31/2003, 12/31/2005, 12/31/2007, 12/31/2009, 12/31/2010.</p><p> </p><p> </p><p>Any help would be appreciated. Thanks in advance.</p><p>Any updates?</p>
Find more posts tagged with
Comments
GLO_FR
<p>Hi jain,</p><p> </p><p>just one question, do you have at least one value for year 2009 ?</p>
jain
<p>Hi Glo_FR,</p><p>thanks for replay, yes, I've data in the table for year 2009. Can you please tell me the possible solutions?</p>
GLO_FR
<p>Hi</p><p> </p><p>can you upload your design or the entire script.</p><p>I've made some tries and my (very simple) design works fine</p><p> </p><p> </p>
jain
Hi,
here is my script, here monthDiff is number of months that I'm passing dynamically,
if(monthDiff <=15) //set Months
{
xAxis.getScale().setUnit(ScaleUnitType.MONTHS_LITERAL);
xAxis.getScale().setStep(1.0);
}
else if(monthDiff>15 && monthDiff<=45) //set quarters
{
xAxis.getScale().setUnit(ScaleUnitType.QUARTERS_LITERAL);
xAxis.getScale().setStep(1.0);
}
else if(monthDiff>45 && monthDiff<=180) //set years
{
xAxis.getScale().setUnit(ScaleUnitType.YEARS_LITERAL);
xAxis.getScale().setStep(1.0);
}
else if(monthDiff >180)//set Bi-yearly
{
xAxis.getScale().setUnit(ScaleUnitType.YEARS_LITERAL);
xAxis.getScale().setStep(2.0);
}
GLO_FR
<p>Hi again,</p><p> </p><p>other example with your code (still works with me) with a modification of the grouping unit.</p><p>Maybe it's your data ?</p><p>(month looks very bad, but U can filter the dataset).</p>
rk1981
Hi Glo_FR,
I'm working with Jain to fix this issue. I attached the sample report which is having the issue. Also attached the excel sheet as data source. Please change to this excel sheet to ".csv" format and use as data source.
And see the report by clicking on View report in Web Viewer.
Thanks in Advance.
GLO_FR
<p>Hi guys,</p><p> </p><p>I think I found it.</p><p>On the X-axis, go in scale and check "auto expand".</p><p>Your report show now 2009.</p><p> </p><p>You've probably to test with other scale (month, week....) but for this case and this data, it looks good.</p>
rk1981
<p>Thanks a lot <span>Glo_FR for your solution</span>. But two things here.</p><p> </p><p>1. Now the X axis labels are displaying/starting from previous two years data points and also ending next to the data points. But I want to display exact starting and ending data points.(Bcz, I want to display maximum 15 X axis labels. For this I used filter condition on chart.)</p><p>2. I want to display last X axis label as end date. In our report end date is 8/31/2010 instead of 01/31/2011. </p><p>Any idea on this would be helpful for me. Thanks once again.</p>
GLO_FR
<p>Hi,</p><p> </p><p>so one solution can be to specify the min value of your X axis and to keep the "auto expand " checked. So it will always start on the exact point.</p><p>And on the marker line on the right side of your X axis, put a label with the ending date.</p><p> </p><p>I've not the correct script right now but, for the min value, it's must be like</p><pre class="_prettyXprint _lang-js">xAxis.setMin(DateTimeDataElementImpl.create(startDate));</pre><p>and for the label on the marker line</p><pre class="_prettyXprint _lang-js">top_ml_xAxis.getLabel().getCaption().setValue(" Situation at " + RefDate);</pre><p>For the moment I don't see any other solution.</p><p>Maybe with some tricky script ?</p><p> </p><p>I also don't understand why I can't upload any file
!!</p>
rk1981
<p>Thanks Glo_FR, even I got the same idea, but still I'm having the X axis end date label issue. Please let me know if you found any other solution for this.</p>