This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Rotated Axis Labels

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there experts,

I've got a line chart with that has many x-axis labels (about 20) with relatively long names and have been frantically trying to get these to display verically so that my chart is readable as follows:

<jsp:useBean id="labelRotation" class="de.laures.cewolf.cpp.RotatedAxisLabels" />


<cewolf:chart id="useCase" type="line"
title=" " showlegend="false" yaxislabel="Hits" plotbackgroundcolor="#FFFFFF" plotbordervisible="false">
<cewolf:data>
<cewolf:producer id="datasourceBottom" />
</cewolf:data>
<cewolf:colorpaint color="#FFFFFF" />

<chart:chartpostprocessor id="labelRotation">
<chart:param name="rotate_at" value="1"/>
<chart:param name="remove_at" value="50"/>
</chart:chartpostprocessor>
</cewolf:chart>
<cewolf:img chartid="usageReportRight" renderer="cewolf" border="0"
width="450" height="350">
<cewolf:map linkgeneratorid="treCategoryChartViewToolTips" tooltipgeneratorid="treCategoryChartViewToolTips"/>

</cewolf:img>




<cewolf:legend id="usageReportRight" renderer="/cewolf" width="450" height="150" />




I have also tried creating my own post processor by implementing de.laures.cewolf.ChartPostProcessorr interface, and within the processChart method

I added the following lines :

CategoryAxis domainAxis = categoryplot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0));

Please advise on the best practical method to get all my x-axis labels to display fully. Thanks

 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What actually happens if you run the code posted above?
 
Levi Raymond
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, my x-axis labels remain cramped up, and can't tell which is which from the whole lot. It seems it has no effect on my chart.
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the "cewolf" prefix for the chartpostprocessor tag, like you're using for the other tags. As it is, the chartpostprocessor tag probably gets rendered into the HTML.
 
Levi Raymond
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:You need to use the "cewolf" prefix for the chartpostprocessor tag, like you're using for the other tags. As it is, the chartpostprocessor tag probably gets rendered into the HTML.



I took your advice and boom!! Everything worked superbly. Just one point of note, the java docs for cewolf use the "chart" prefix for de.laures.cewolf.cpp.RotatedAxisLabels in the usage section. The changes probably need to be cacaded there as well.
Thanks a lot Ulf.
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Just one point of note, the java docs for cewolf use the "chart" prefix for de.laures.cewolf.cpp.RotatedAxisLabels in the usage section. The changes probably need to be cacaded there as well.


It all depends on what prefix is chosen in the "<%@taglib ... %>" directive - neither "cewolf" nor "chart" is inherently more correct than the other.
 
Run away! Run away! Here, take this tiny ad with you:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!