Dear Dave and all,
This is the coding i used for making dual axis chart and the chart i got is comprising of four bars.I want only two bars to be shown but there are four bars and overlapping also.I have posted two more forums regarding this one and axis range to be set.But i didn't get any reply?
String seriesNames = "Months";
Color bgColor = new Color(205,211,214);
//Line Parameters
String line1="Total No.of Milestones";
String line2="Total Unbilled 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(85, line1,month1);
dataset.addValue(100, line1,month2);
dataset.addValue(125, line1,month3);
dataset.addValue(110, line1, month4);
dataset.addValue(1000,line2,month1);
dataset.addValue(800, line2,month2);
dataset.addValue(600, line2,month3);
dataset.addValue(400, line2, month4);
//PlotOrientation plot = new PlotOrientation("VERTICAL");
JFreeChart jfc = ChartFactory.createBarChart
("Unbilled Milestones Dual Axis chart", // Title
"Month ", // X-Axis label
"No.of.Milestones", // Y-Axis label
dataset, // Dataset
PlotOrientation.VERTICAL, //Plot
true, // Show legend
true, // Show legend
true
);
jfc.setBackgroundPaint(bgColor);
final CategoryPlot plot = jfc.getCategoryPlot();
plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
plot.setDataset(1, dataset);
plot.mapDatasetToRangeAxis(1, 1);
final ValueAxis axis2 = new NumberAxis("Unbilled Amount");
plot.setRangeAxis(1, axis2);
plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
final BarRenderer renderer2 = new BarRenderer();
plot.setRenderer(1, renderer2);
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setTickUnit(new NumberTickUnit(100));
rangeAxis.setLowerBound(0);
rangeAxis.setUpperBound(1500);
what i have to change to get two bars with two different axis values.
Awaiting for ur reply......
Regards,
Vairamuthu M
dual axis chart with both axis values set by user
-
- Posts: 9
- Joined: Tue Jul 11, 2006 8:10 am
- Location: Delhi
- Contact:
-
- Posts: 9
- Joined: Tue Jul 11, 2006 8:10 am
- Location: Delhi
- Contact:
Reply for the avove
Hi,
That is correct but did u find any overlapping there and both axis range changed based on the dataset values.That is my problem
Regards,
Vairamuthu M
That is correct but did u find any overlapping there and both axis range changed based on the dataset values.That is my problem
Regards,
Vairamuthu M
Re: Reply for the avove
Not quite sure what you mean about overlapping - I get a chart like the following:vairamuthum wrote:Hi,
That is correct but did u find any overlapping there
Code: Select all
+--+
| |
| |
| |
| | +--+
| | | |
+--+ | |
| | | |
| | +--+
| | | |
| | | |
+--+ | | +--+ | |
| | | | | | | |
+--+ | | +--+ | |
| | | | | | | |
| | | | | | | |
+--+ +--+ +--+ +--+
Once again, not quite sure what you mean - from my point of view, the ranges will change if the data changes...... and both axis range changed based on the dataset values.
-
- Posts: 9
- Joined: Tue Jul 11, 2006 8:10 am
- Location: Delhi
- Contact:
How do u change x-axis and y-axis labels size and font type?
Dear Dave and all,
I have created the bar chart but axis values ans labels are not looking good.I want to change the size of labels,axis values,their corresponding font sizes,types.
And one more i want to create dual axis chart using jsp implementing jfree.Just give me some suggestions to achieve this.........!
Awaiting for ur reply.......
Regards,
Vairamuthu M
I have created the bar chart but axis values ans labels are not looking good.I want to change the size of labels,axis values,their corresponding font sizes,types.
And one more i want to create dual axis chart using jsp implementing jfree.Just give me some suggestions to achieve this.........!
Awaiting for ur reply.......
Regards,
Vairamuthu M
For
have you tried http://cewolf.sourceforge.net/And one more i want to create dual axis chart using jsp implementing jfree.Just give me some suggestions to achieve this.........!