Jump to content
We've recently updated our Privacy Statement, available here ×

How to change chart axis range


Recommended Posts

By: chris snow - nadsinoz

How to change chart axis range

2006-03-06 09:22

I have a chart series with values all around 500000. The axis range is 0-to-500000

 

How can I adjust the chart axis range to something more sensible, e.g. 480000-to-520000?

 

 

 

 

By: chris snow - nadsinoz

RE: How to change chart axis range

2006-03-06 13:18

Is it even possible to change the chart axis range values?

 

Many thanks ...

 

 

 

 

By: chris snow - nadsinoz

RE: How to change chart axis range

2006-03-06 19:10

I'm on a tight schedule for my reporting requirements, and I need to make a quick decision whether jasperreports is the right tool for my needs. So any feedback that will help me make that decision will be highly appreciated.

 

I think the answer to my question above is going to be 'NO' but I would like some confirmation from existing jasperreports users.

 

 

 

 

 

 

By: Ionut Nedelcu - ionutned

RE: How to change chart axis range

2006-03-07 01:39

Hello

 

JasperReports is using JFreeChart for chart rendering. Since JFreeChart has a very complex API, we cannot integrate it fully in our JRXML format. So, for users who need advanced chart customization, we created the ChartCustomizer interface, which allows direct access to the JFreeChart objects. As an example you can take a look at the BarChartCustomizer class in the charts sample.

 

Hope this helps

Ionut

 

 

 

 

By: chris snow - nadsinoz

RE: How to change chart axis range

2006-03-07 01:57

Hi Ionut,

 

I've managed to figure out how to change the range using the Customizer class and the JFreeChart docs.

 

I appreciate that development time must be prioritised, but I can't believe that this functionality isn't included in jasperreports. The ability to set the range of a chart is a **basic** requirement for any reporting application using charts. Is this functionality likely to be included in future releases?

 

I took a quick look at BIRT, and although they are still very early in development terms, they DO have the capability to set the chart ranges. However, BIRT doesn't yet appear to be able to produce the complex chart positioning layout I need for my charting requirements.

 

Many thanks for the reply!

 

 

 

 

By: bill - rx7haze

RE: How to change chart axis range

2006-05-31 11:15

Can you explain how you got the customizer class to work?

Thanks.

Link to comment
Share on other sites

  • 5 months later...
  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Hi

This is Atanu. I am very new in ireport and also in java environment. In the ireport I have designed a template .like this.

please look on attach file

size=150C:Documents and SettingsAtanuMy Documentsgraph.jpeg[/img]

Now I want to plot a line graph on the basis of the each data like t1 t2 ---t5 and lcl, ucl, actual value for each row.

That I have done. Now my problem is that I have to change the color of points of t1 t2 ---t5 on the basis of Lcl and Ucl . If the value of t1 ,or t2 or ----t5 are between Ucl and Lcl the color will be blue. And if it out side of Lcl and Ucl then it will be red..

I want the following figure. Where the upper bold line is Ucl and lower bold line isLcl

size=150C:Documents and SettingsAtanuMy Documentsdata.jpeg[/img]

Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it .

 

Code:

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JREmptyDataSource;
import java.util.*;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import javax.sql.*;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.renderer.*;
import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.LevelRenderer;
import org.jfree.chart.renderer.category.LayeredBarRenderer;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.lang.String;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRChartPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.axis.CategoryLabelPositions;


import org.jfree.chart.renderer.category.LineRenderer3D;
import java.awt.*;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;
import org.jfree.chart.JFreeChart;
import net.sf.jasperreports.engine.*;
import java.awt.Color;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import java.lang.Object;



public class LineChartCustomizer extends JRAbstractChartCustomizer {

public void customize(JFreeChart chart, JRChart jasperChart) {

LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer();


renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(4, Color.orange);

chart.setTitle("Setting the title "«»);
}


}

Now this customize class ok running successfully with creating jar files.

Now I want to create a logic to check the value of t1 t2 t3 t5 with respect to UCL and LCL. How can I fetch data from report.

Or is there any other way to do this.

Is there any way to pass value from iReport to customizer class ?

 

What should I do. Please please help me. It’s urget for me.

 

Any help would be greatly appreciated.

Thanks in advance.

[file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file]

Link to comment
Share on other sites

Hi!

 

I think you should have started a NEW topic instead of replying to my post... but nevertheless:

 

The fastest way I would suggest to make your solution work is without a "programmatic" solution.

Just put the same field on identical x/y coordinates that (if you have a very limited and never changing) show the field in different colors (i would call it "overlays").

The are triggered by an expression clause, so only one version will be shown in the corresponding colour.

 

A solution with the customizer I have to look up by try & error ... but it's impossible this week :-).

 

Regards,

 

Thorsten

Link to comment
Share on other sites

Hi

Very very thanks for ur reply.

i have got information from ur reply .

 

Actaually can you please tell me how can I get value of each coloumn for each row in customizer class. Actually I am drawing chart for each row.

I want to check value of t1 t2 t3 t4 t5 with actual value and UCL and LCL. Depending on that I will change color in customizer class and it will effect to ireport.

I am also attaching my xml file and the picture what I want.

 

If you don't understand what I am trying to do please inform me.Its urgent.

Again thank u for ur help.

thanks

 

Atanu [file name=new_dashboard-f3cce1afdf7d92275abd9c7caefd2b42.xml size=15458]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/new_dashboard-f3cce1afdf7d92275abd9c7caefd2b42.xml%5B/file] size=159]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/graph-3bbe8cfd78ac4d9e5d9a78975d548030.JPG

Link to comment
Share on other sites

Hi!

 

Due to the lack of time currently - I really can't help you with Customizing stuff inside Charts the way you want it.

 

Sorry... but it should still be worth looking at the examples and then do a step-by-step adoption.

 

Regards,

 

Thorsten

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

I have a problem with adding some date values. Here below what i have tried.

 

I have created a variable 'parse' with class type java.text.SimpleDateFormat and variable expression new SimpleDateFormat("HH:mm a MMM dd, yy") .

 

Then i created a variable 'dat' with class type java.util.Date and varible expression $V{parse}.parse($F{LAST_COMPUTED}) where $F{LAST_COMPUTED} is a field value (it's a string as example '12:30 am Jan 2nd, 07').

Now i can get this string as a date type varible in $V{dat}.

 

Now i want to add/subtruct some day/month/year/week or hour/minute/second with this $V{dat} varible and want to store in another varible .

That i can't do.Please help me on that. Actually in java, using calender class(using add() and set() method) i can do it. But i want to calculate it in iReport(i am using Ver. 1.3.0).

 

Also in iReport I created another variavle 'calender'with class type java.util.Calendar and value expression Calendar.getInstance(). I know that it shows the current datetime value.. Actually i thought that using calender i can do it . But i am in vein.

If any one can't under stand my requirement please reply.

Please help me to short out this problem.

 

Thanks in advance.

Post edited by: atanupanda, at: 2007/02/20 12:08

Link to comment
Share on other sites

Hi

 

I have a problem with adding some date values. Here below what i have tried.

 

I have created a variable 'parse' with class type java.text.SimpleDateFormat and variable expression new SimpleDateFormat("HH:mm a MMM dd, yy") .

 

Then i created a variable 'dat' with class type java.util.Date and varible expression $V{parse}.parse($F{LAST_COMPUTED}) where $F{LAST_COMPUTED} is a field value (it's a string as example '12:30 am Jan 2nd, 07').

Now i can get this string as a date type varible in $V{dat}.

 

Now i want to add/subtruct some day/month/year/week or hour/minute/second with this $V{dat} varible and want to store in another varible .

That i can't do.Please help me on that. Actually in java, using calender class(using add() and set() method) i can do it. But i want to calculate it in iReport(i am using Ver. 1.3.0).

 

Also in iReport I created another variavle 'calender'with class type java.util.Calendar and value expression Calendar.getInstance(). I know that it shows the current datetime value.. Actually i thought that using calender i can do it . But i am in vein.

If any one can't under stand my requirement please reply.

Please help me to short out this problem.

 

Thanks in advance.

Link to comment
Share on other sites

  • 1 year later...

Hi,

 

I'm using iReport and JasperReports 3.0 and evaluating this tool for our business.

Has this issue been resolved in such a way that non-programmers can manually set the chart range for all types of graphs. I agree that this is a BASIC requirement of any reporting software.

I've looked hard at iReport and the JRXML DTD and cannot see any attributes that allow you to set the chart axes. I've also seen on other threads that someone contributed a patch to version 1.0.X to allow iReport to set the axis range - did this ever get included in future releases. Should I upgrade to 3.1 or 3.2 - will these versions have this functionality?

I would be extremely grateful if someone could shed some light on this as I have an urgent deadline to submit a proposal to recommend this software.

Many many thanks.

Graham

 

 

Link to comment
Share on other sites

2006 IR Open Dicussion
Wrote:

By: chris snow - nadsinoz
RE: How to change chart axis range
2006-03-07 01:57
Hi Ionut,

I've managed to figure out how to change the range using the Customizer class and the JFreeChart docs.

I appreciate that development time must be prioritised, but I can't believe that this functionality isn't included in jasperreports. The ability to set the range of a chart is a **basic** requirement for any reporting application using charts. Is this functionality likely to be included in future releases?

I took a quick look at BIRT, and although they are still very early in development terms, they DO have the capability to set the chart ranges. However, BIRT doesn't yet appear to be able to produce the complex chart positioning layout I need for my charting requirements.

Many thanks for the reply!




By: bill - rx7haze
RE: How to change chart axis range
2006-05-31 11:15
Can you explain how you got the customizer class to work?
Thanks.

Hello. Can you tell me how to change the range by using the customizer class? please.

Thanks in advance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...