Adjust Alignment of Label to Right and Fix Label Truncating Issue in Stacked Bar Chart

Posted on by By Satya Gopi, in Business Intelligence, Jaspersoft, Open Source Business Intelligence | 0

Adjust Alignment of Label to Right and Fix Label Truncating Issue in Stacked Bar Chart

Softwares:

Jasper Server 5.6.0
IReport 5.6.0

Now we will see how to work on Labels Alignment and fix truncating in Stacked Bar Chart

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Claim Your 30 Days Free Trail

First create a sample report which includes Stacked Bar Chart

Report Output in Jasper Server as follows

OriginalOutputt

Expected Output in Jasper Server as follows

ExpectedOutput

In order to achieve Expected Output, write custom code in java and include below lines of code:

For Label Alignment include below line

 plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

For avoid truncating Labels include below line

  categoryAxis.setMaximumCategoryLabelWidthRatio(3.0F);

Create jar file of the java code and add it in chart customiser property of chart in the format: ‘packagename.classname’ as follows:-
Refer the screenshot:

ChartCustomzeer

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Grab The 30 Days Free Trail

Publish the Report,and add the Jar for the Report which had published
Right Click on the Report –>Edit

EditJaar

Control Resources –>Add Resource–>Upload Jar

UploadJar

Give a valid name and then Submit

Execute the Report and output as follows

ExpectedResult

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

Thanks,
Satya Gopi,
BI Developer

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments