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
Dual Charts
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Dual Charts
There isn't a way to do that in JFreeChart as yet. It would be a nice feature though.vr3624 wrote:Can anybody tell how to get the values on both the (left and right) axis to be on the grid lines.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 9
- Joined: Tue Jul 11, 2006 8:10 am
- Location: Delhi
- Contact:
I too want to create dual chart
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
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