File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Cewolf:  How to handle the values on y axis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Cewolf:  How to handle the values on y axis" Watch "Cewolf:  How to handle the values on y axis" New topic
Author

Cewolf: How to handle the values on y axis

shafiullah shaik
Greenhorn

Joined: Dec 01, 2008
Posts: 8
hi,
Im facing a problem in charts that
1. I want to divide the intervals on y-axis but in cewolf it is dividing by itself accordingly and it is not showing the value at the highest point as shown in the second image where the value of bar graph exceeds 40 but the intervals on y-axis is still showing as 40 ,i just want to display one more value above 40.
2.And how i can remove decimal points coming on y-axis as i dont want it in my charts as in case where i have taken days as count on y-axis and days may not be 1.3 ,2.6 etc i just want to control the values as per the requirement
please help me out if you have any idea about this
thanks





[BPS: Added project name to subject line]
[ December 01, 2008: Message edited by: Ben Souther ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Welcome to JavaRanch.

As to #1, you can write a ChartPostProcessor that sets the range on the axis to whatever values you see fit.

As to #2, are you using the cewolf distribution from SourceForge, or the one I distribute from the URL shown in my signature? If you're using my version (and you should), then the chart tag has a boolean axisinteger attribute you can use to achieve this. If you're using the official distribution then you need to write a ChartPostProcessor that sets integer tick units as the standard tick units.

The code for the post processors would look something like this:


Ping & DNS - my free Android networking tools app
shafiullah shaik
Greenhorn

Joined: Dec 01, 2008
Posts: 8
Thanks for your reply
This is the code which i have used for my charts.
Here i can able to give colors to my lines but how can i manage to set the values on y-axis as we are getting values from database(any values we can expect),the code which you have sent is hard coded to a particular range(0,50),here i dont know the range excatly what i want is to get complete values upto which the graph line reaches


<%
ChartPostProcessor dataColor = new ChartPostProcessor() {

public void processChart(Object chart, Map params) {
CategoryPlot plot = (CategoryPlot) ((JFreeChart) chart).getPlot();
for (int i = 0; i < params.size(); i++) {
String colorStr = (String) params.get(String.valueOf(i));
plot.getRenderer().setSeriesPaint(i, java.awt.Color.decode(colorStr));
}
}
};
pageContext.setAttribute("dataColor", dataColor);
%>

Displaying in the jsp using chartpostprocessor:
------------------------------------------------
<cewolf:chartpostprocessor id="dataColor">
<cewolf aram name="0" value='<%= "#000000" %>'/>
<cewolf aram name="1" value='<%= "#00FF00" %>'/>
<cewolf aram name="2" value='<%= "#990066" %>'/>
<cewolf aram name="3" value='<%= "#00FFFF" %>'/>
<cewolf aram name="4" value='<%= "#FF00FF" %>'/>
<cewolf aram name="5" value='<%= "#6600FF" %>'/>
<cewolf aram name="6" value='<%= "#990000" %>'/>
<cewolf aram name="7" value='<%= "#996600" %>'/>
<cewolf aram name="8" value='<%= "#99CC00" %>'/> </cewolf:chartpostprocessor>
could you please provide me any specified method if it is there to handle the values dynamically
find the image here:
----------------------


Please observe the above chart, if you didn't find the image open the url you will find an example chart
In the above chart first line in blue color exceeds the highest value shown in the graph ie 1500 ,how can i get the complete scale in order to cover the complete range.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
I agree that this would be a nice feature for cewolf to have (or at least as an option), but it's not trivial. I'll look into it when I get a chance.
shafiullah shaik
Greenhorn

Joined: Dec 01, 2008
Posts: 8
Iam using jfree charts but iam facing a problem in highlighting the point on the chart,as it is showing only the
line connecting points without highlighting the points

please help me regarding the same

see the difference between these charts one is showing simple line connecting the points but the other is highlighting the points

suggest me the code for highlighting those points

Iam using the following code:;
<cewolf:chart id="line" title="${title}"
type="line" showlegend="true" legendanchor="south"
xaxislabel="Months" yaxislabel="Associate Count" background="#FF030D" >
<cewolf:gradientpaint>
<cewolf:point color="#FF0000" y="200" x="2000"/>

</cewolf:gradientpaint>
<!--cewolf:colorpaint color="#B0C4DE"/-->

<cewolf:data>
<cewolf:producer id="pageViews" usecache="" />

</cewolf:data>

<cewolf:chartpostprocessor id="dataColor" >
<cewolf:param name="0" value='<%= "#000000" %>' />
<cewolf:param name="1" value='<%= "#00FF00" %>'/>
<cewolf:param name="2" value='<%= "#990066" %>'/>
<cewolf:param name="3" value='<%= "#00FFFF" %>'/>
<cewolf:param name="4" value='<%= "#FF00FF" %>'/>
<cewolf:param name="5" value='<%= "#6600FF" %>'/>
<cewolf:param name="6" value='<%= "#990000" %>'/>
<cewolf:param name="7" value='<%= "#996600" %>'/>
<cewolf:param name="8" value='<%= "#99CC00" %>'/>
</cewolf:chartpostprocessor>
</cewolf:chart>


<cewolf:img chartid="line" renderer="/cewolf" width="1046" height="700"
alt="">
<cewolf:map tooltipgeneratorid="pageViews" />
</cewolf:img>





waiting for your reply
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
The cewolf distribution linked in my signature has a ChartPostProcessor that can be used to control the appearance of data points in category plots and XY plots. It's the de.laures.cewolf.cpp.LineRendererProcessor class.
shafiullah shaik
Greenhorn

Joined: Dec 01, 2008
Posts: 8
Thank you very much sir for your suggestion,I got succeded in developing the charts with data points.

In my current Application I am taking the count of number of projects on Y- axis but the intervals on Y-axis is divided by the API accordingly as Decimal values in few charts which I need to be a real value without decimal points.

Note:values are not predictable,it may be any value retreving from database.

Please suggest me for the same
Ana vincy
Greenhorn

Joined: Apr 13, 2010
Posts: 4
hi,

I have used the code in your signature to dispaly integer values on X and Y axis for a stacked bar chart. Thanks for that, its working fine when deployed on weblogic server. But the same gives as error when deployed on Tomcat server (classnotfound Exception - as all classes, say dial pointer are not existing in the jar). Any help on how to resolve his issue?

Thanks,
Ana
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Did you add all jar files that come with the example web app to your web app's WEB-INF/lib directory?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

And welcome to Javaranch Ana!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ana vincy
Greenhorn

Joined: Apr 13, 2010
Posts: 4
Thank you very much. I replaced all the jars once again and its working.

Could you even please suggest how to dispaly the values on a stacked bar chart
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Could you even please suggest how to dispaly the values on a stacked bar chart

The "Cewolf Set" example page of the sample web app that comes with cewolf contains examples of horizontal and vertical, 2D and 3D, stacked bar charts.
Ana vincy
Greenhorn

Joined: Apr 13, 2010
Posts: 4
Current stackedVerticalBar chart appears as shown in your example. But I would like to display the corresponding data point on the bar as shown below



[Thumbnail for samplegraph.JPG]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41865
    
  63
Ana,
I've updated the cewolf distribution with an enhanced BarRenderer postprocessor that can be used to show item labels on (stacked) bar charts. That should address this issue.
Ana vincy
Greenhorn

Joined: Apr 13, 2010
Posts: 4
Oh! Thats great. Thanks a lot
HarryGill Gill
Greenhorn

Joined: Jul 06, 2010
Posts: 1
Thanks to every one !! I am new to cewolf. This forum was of a great help. Once again Thanks a lot !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cewolf: How to handle the values on y axis