Dual Charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
vr3624
Posts: 1
Joined: Fri Jun 09, 2006 1:34 am

Dual Charts

Post by vr3624 » Fri Jun 09, 2006 1:39 am

I succesfully created dual axis chart.

Say I have Y axis on the left and another on right.

The values listed on the left are listed on the grid lines. BUT the values on the right Y axis are not on the grid lines. (you can check out in the demo web start)

Can anybody tell how to get the values on both the (left and right) axis to be on the grid lines.

Thanks
- vr3624

sylvie
Posts: 4
Joined: Tue Jun 06, 2006 9:43 pm

Post by sylvie » Mon Jun 12, 2006 1:51 pm

would you like to share how you create dual axis?

thanks a million.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Dual Charts

Post by david.gilbert » Tue Jun 13, 2006 5:02 pm

vr3624 wrote:Can anybody tell how to get the values on both the (left and right) axis to be on the grid lines.
There isn't a way to do that in JFreeChart as yet. It would be a nice feature though.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

vairamuthum
Posts: 9
Joined: Tue Jul 11, 2006 8:10 am
Location: Delhi
Contact:

I too want to create dual chart

Post by vairamuthum » Tue Aug 01, 2006 12:20 pm

Hi Dave and all,
I want to create dual axis chart using the data retrived from database in a jsp file.I just enclose the bar chart i have created and i wanted this to be changed to dual axis chart.

if i got the solution i will be thankful to you.

String seriesNames = "Billing Details";
Color bgColor = new Color(205,211,214);
//Line Parameters
String line1="Outstandings";
String line2="Billed Amount";

//Row Names
// String[] monthsname=new string[] {"April","May","June","July"};
String month1="Mar,06";
String month2="Apr,06";
String month3="May,06";
String month4="June,06";


// creating Dataset
DefaultCategoryDataset dataset = new DefaultCategoryDataset();

dataset.addValue(14000, line1, month1);
dataset.addValue(16000, line1, month2);
dataset.addValue(12000, line1, month3);
dataset.addValue(10000, line1, month4);

dataset.addValue(25000, line2, month1);
dataset.addValue(20000, line2, month2);
dataset.addValue(18000, line2, month3);
dataset.addValue(15000, line2, month4);


//PlotOrientation plot = new PlotOrientation("VERTICAL");
JFreeChart jfc = ChartFactory.createLineChart
("Billing Details turnkey Project", // Title
"Monthly", // X-Axis label
"Amount ", // Y-Axis label
dataset, // Dataset
PlotOrientation.VERTICAL, //Plot
true, // Show legend
true, // Show legend
true
);
jfc.setBackgroundPaint(bgColor);
final CategoryPlot plot = jfc.getCategoryPlot();

ChartUtilities.saveChartAsJPEG(new File("C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/board/chart.jpg"), jfc, 1024, 768);


Regards,
Vairamuthu M

Locked