wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes cewolf charts 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 charts" Watch "cewolf charts" New topic
Author

cewolf charts

phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Is it possible to generate a clustered bar charts using cewolf. I am uisng

verticalbar3d. Can anyone tell me that verticalbar3d is same as clustered bar charts or do you have other charts to display clusterd bar charts.


Please someone suggest me in this case.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Can you post a link to an example of what you consider a "clustered bar charts" to be? I don't think it's a term that everybody understands to mean the same thing.


Ping & DNS - my free Android networking tools app
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
I mean column charts type which we use in excel sheets.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
I guess I don't understand the question. You can simply create a chart in Excel, and create the same one using cewolf, and see for your self if they're similar enough for your purposes, can't you? Am I missing something?

Here are examples of what verticalbar3d and stackedverticalbar3d cewolf images look like:



phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Thanks for posting the charts. Yes I am looking for the first one verticalbar3D.

Do you have any sample code for the first chart ie verticalbar3D?


Thanks a lot.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
The easiest way is probably to download this cewolf distribution (which, ahem, I maintain), and install the cewolfexamples web application that comes with it. That shows many of the supported chart types in action; this particular one is part of the "Cewolf Set". Its code is part of cewolfset.jsp.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
I have one question suppose, if I want to change in the first example verticalbar3d chart yaxis to millons. How would I do it? Also I want to change the colors of the bars. Is it possible?


Thanks a lot for your help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
if I want to change in the first example verticalbar3d chart yaxis to millons. How would I do it?

The values on the axis are calculated based on the actual data. If that's in the order of millions, then so will be the axis values.

Also I want to change the colors of the bars. Is it possible?

The easiest way would be to use a ChartPostProcessor. The web app has a class called DataColorPostprocessor that does exactly this; it is demonstrated with the StackedHorizontalBar example, and could just as well be used with the verticalbarchart3d example.
[ April 04, 2008: Message edited by: Ulf Dittmer ]
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
What about yaxis Data Unit to milloins?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Isn't that exactly the same question you asked before (which I answered) ?
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,
I am using the verticalbar3d charts. I hava a question, here is my code for the verticalbar3d chart.Using the below code I am getting the values from the database to the resultset.using the below query I am getting the values for ADD_COLL, CHANGE_FEE and Total.I need to develop a verticalbar3d chart with add-coll, change-fee and total like the above example as you posted for apple, pies, bananas,oranges.


ResultSet rs = wds.getData(String Category, int Month, intYear)


StringBuffer query = new StringBuffer("SELECT SUM(AMT), SUM(ADD_COLL), SUM(CHANGE-FEE), SUM(TOTALS) FROM "Constants.ALLSTATS" WHERE CAT
='").append(Category). append("' AND YEAR(DATE)=").append(year);

Could you please give me some ideas to send as array of add-coll, change-fee and totals.Because to develop a verticalchart I need send it as an arrray like below right.
Suppose if I say
String[] s = {addcollect, change-fee, total)
dataset.addvalue =(yaxis, s[], years)


Thanks a lot for your help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Have you looked at the verticalbarchart3d example in the cewolfset.jsp example? The data is held in the "categoryData" variable. You could start out by taking that and changing that so it suits your needs.

I would strongly urge you to do that in a servlet or backing bean, though. Keeping code like in a JSP is bad practice - it's only done here because it's an example.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
I am doing that in plain java class not in jsp.I have looked in the example, but didn't have nay values form the database.

My problem is, how can I put the values of add_coll, change_fee and total ie rs.getint(3), rs.getInt(4) and rs.getInt(5)together as a array add it to dataset to build the chart.
I just need some ideas for doing this.

I hope You understood my problem.

Thanks
[ April 07, 2008: Message edited by: lakshmi manepally ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
If this is not a web app then cewolf won't be of any help - it's a JSP tag library.

Creating the charts has nothing to do with where the data is coming from, the process is the same: you need a DatasetProducer that has the same Integer[][] and String[] arrays as in that example. You can create those from a ResultSet if that's what you have.

This JFreeChart example shows how to create the value arrays dynamically. Just comment out the section dealing with XY charts, and remove the comments around the category chart section.
[ April 07, 2008: Message edited by: Ulf Dittmer ]
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
How do I create integer[] and string[] using the resultset for ADD_COLL, CHANGE_FEE and Total values? Could you please give me one hint.


Thanks a lot for your help
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Did you look at the JFreeChart example I pointed you to? Did you get it to run, and do you understand what it's doing? If not, tell us where you're stuck with it. Once you have that, it's not hard to switch to a 3D chart type.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
yes, I understood, Here is my code . everything is working fine .but I am not getting the chart for addcoll, changefee and total.I have done below in the DefaultCategoryDataset



Could you please help me, what was wrong in my code?

[ April 07, 2008: Message edited by: lakshmi manepally ]

[ April 07, 2008: Message edited by: lakshmi manepally ]

[ April 07, 2008: Message edited by: lakshmi manepally ]

[ April 07, 2008: Message edited by: lakshmi manepally ]
[ April 07, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
I don't fully understand the code (e.g., the "for (int series...)" loop looks very strange), but I think you're looking for something like this:



Strings are compared using the equals method, not using the "==" operator.

As an aside, you don't seem to be using the startValues and endValues arrays. Not sure if that's intentional, just wanted to mention it.

Also, instead of Double.toString(rs.getDouble(5)) and Integer.toString(rs.getInt(1)) you can just use rs.getString(5) and rs.getString(1).
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hello UlfDittmer,

I did like the below . It worked.



Thanks a lot for your help.
[ April 08, 2008: Message edited by: Ulf Dittmer ]
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

I have one more question. Is it possible to generate a tool tip for the chart?

thanks a lot.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Is it possible to generate a tool tip for the chart?

Yes, some of the ChartFactory.createXYZChart methods have a boolean parameter that you can use to enable tooltips.

Check the classes in the org.jfree.chart.labels package for the classes/interfaces that are appropriate for your chart type.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

I have looked into the examples of cewolfset.jsp. For my chart I need
CategoryToolTipGenerator.

Could you please let me know, what should I put in the below method to generate tool tip



for




thanks for your help.

[ April 09, 2008: Message edited by: lakshmi manepally ]
[ April 09, 2008: Message edited by: lakshmi manepally ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
You'd have it return whatever the tooltip should be. Maybe something like this:
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
thanks for your reply. Do I have to add anything in the jsp like



But I got this error:

/Chart.jsp(302,7) Attribute id invalid for tag map according to TLD

Let me know what was wrong in the above code?

thanks
[ April 10, 2008: Message edited by: lakshmi manepally ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
map does not take an "id" attribute (so the error message is right on target). It can take both a "linkgeneratorid" and a "tooltipgeneratorid"; they can be identical if links and tooltips are created by the same object/class. Both are optional.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Is the below code is correct;

<cewolf:img chartid='verticalbar3d' renderer='/cewolf' width='1100' height='800'> <cewolf:map tooltipgeneratorid ="chartViewsQuarter"/></cewolf:img>

or

<cewolf:img chartid='verticalbar3d' renderer='/cewolf' width='1100' height='800'> <cewolf:map tooltipgeneratorid ="tooltipgenerator"/></cewolf:img>

And also the below code is saying that the method should return type String

[CODE]public String generateToolTip(CategoryDataset arg0, int series, int arg2)
{
if (series == 0)
return "ADD_COLLECT " + sDate;
else if (series == 1)
return "CHANGE_FEE " + sDate;
else if (series == 2)
return "TOTAL " + sDate; }
CODE]

Could you please help me? Thanks
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

I have done like the below

CategoryToolTipGenerator tooltipGenerator = new

Also added in the jsp page like below.



Still I am not getting the tool tip

Could you please correct where I was wrong.

thanks a lot.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
That's hard to say without seeing all the code. Have a look at the tutorial.jsp page in the cewolfexample web app; it shows both tooltips and links in action.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

here is my code for jsp page



Here is the code for javabean:





hope You can understand the code. It is the same code I posted earlier for the charts
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Did you look at the tutorial.jsp page? Your code doesn't seem to have the equivalent of its <jsp:useBean> tag.
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi,

I changed the code according to the tutorial.jsp

here is my code for jsp page



if(category.equals("ALL")){ %>
<%System.out.println("Enter into loop"); %>
<cewolf:chart
id='verticalbar3d'
title='Results'
type='verticalbar3d'
xaxislabel='Quarter'
yaxislabel='Revenue in Millions'>
<cewolf ata>
<cewolf roducer id='chartViewsQuarter'/>

Here is the code of javabean


</cewolf ata>
</cewolf:chart>
<p>
<cewolf:img
chartid='verticalbar3d' renderer='/cewolf' width='1100' height='600'>
<cewolf:map linkgeneratorid="chartViewsQuarter" tooltipgeneratorid ='chartViewsQuarter'/>
</cewolf:img>
</P>


<% } %>[/CODE]

Here is the code for java:



After changing also I don't see the tooltip on my charts


thanks
[ April 10, 2008: Message edited by: lakshmi manepally ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Is the generateToolTip method ever being called?
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
yes, it is calling, but it is not showing the tooltip if I say below.




I think it works properly if I say below, but it is giving error as the method should return String type.




How would I return the value ?
[ April 10, 2008: Message edited by: lakshmi manepally ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Try to start easy with returning some constant value, just to make sure that it works at all. Then you can start to worry about what to return.

And please, do us a favor: never just write "It is showing error" - always tell us what the error is is.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

don't want to disrupt the thread, but cewolf charts are really cool.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Originally posted by Pat Farrell:
don't want to disrupt the thread, but cewolf charts are really cool.

If you like it, be sure to check out the distribution I maintain on my web site. It fixes a number of bugs (like the serialization problem with classes put in the session) and adds a few new features (like more chart types and additional postprocessors).
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Hi Dittmer,

I have one quick question on charts. For the below code, How would display the lables


Thanks a lot
[ April 14, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
I'm not sure I understand the question. If you want "2002" instead of sDate, why don't you pass that to the addValue method instead of sDate?
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Is there any way we can labels, suppose in the above example for the vertical bar chart (apples, pies, bananas, oranges) Is it possible to show the labels for apples like(02q1,02q2,02q3,02q4)and pies(03q1,03q2,03q3,03q4) etc.

I hope you understand my question. I want lables on the xaxis ie(rowkey)


Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Ah, sorry, somehow I thought you were still talking about tooltips, not labels.

Have a look at the cewolfset.jsp page - the "categoryData" DatasetProducer shows how to do that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cewolf charts