Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Other Open Source Projects
Scales on Dual Axis Chart
Steve Dyke
Ranch Hand
Posts: 2206
2
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I cannot understand why in this
test
code the scale on left and right are not the same.
private JFreeChart createChart(final CategoryDataset dataset, final CategoryDataset dataset2) { // create the chart... // set the background color for the chart... final CategoryAxis domainAxis = new CategoryAxis("Date"); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final NumberAxis rangeAxis = new NumberAxis("# Scrap Parts/Cost(* 1000)"); final ValueAxis rangeAxis2 = new NumberAxis("Cost(* 1000)"); final CategoryPlot plot = new CategoryPlot(); plot.setDomainAxis(domainAxis); plot.setRangeAxis(0,rangeAxis); plot.setRangeAxis(1,rangeAxis2); final JFreeChart chart = new JFreeChart(this.chartTitle, plot); plot.setDataset(0, dataset); plot.setDataset(1, dataset); final BarRenderer renderer = new BarRenderer() { //public boolean isItemLabelVisible(int row, int column) { //double value = getPlot().getDataset(0).getValue(row, column).doubleValue(); //if (value == 0) //return false; //return super.isItemLabelVisible(row, column); //} }; //final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer() { //public boolean isItemLabelVisible(int row, int column) { // double value = getPlot().getDataset(1).getValue(row, column).doubleValue(); //if (value == 0) //return false; //return super.isItemLabelVisible(row, column); //} //}; chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); plot.setRenderer(0,renderer); //plot.mapDatasetToDomainAxis(1, 0); //plot.setRenderer(1,renderer2); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); for(int x = 0;x<8;x++){ renderer.setSeriesItemLabelFont(x, new Font("Times New Roman",Font.PLAIN,10)); renderer.setSeriesPositiveItemLabelPosition(x, new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, TextAnchor.CENTER, -Math.PI/2)); } return chart; }
Ulf Dittmer
Rancher
Posts: 43081
77
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please post an
SSCCE
so that we can take a look.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Displaying scalable vector graphics on ibm aix
Checking for No Value
Item Labels are Not Rotating in My jFreeChart
JFreechart Item Data Labels are Not Rotating
jfreechart bar chart - show item value
More...