From: SourceForge.net <no...@so...> - 2006-11-21 14:24:47
|
Bugs item #1600446, was opened at 2006-11-21 15:24 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1600446&group_id=15494 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: m.hilpert (mhilpert) Assigned to: Nobody/Anonymous (nobody) Summary: Item labels get cut (out of margin) Initial Comment: If you have a chart that shows percentages, you obviously have a range axis 0% to 100% => range min value = 0.0, range max value = 100.0. For this reason we also don't want to have auto calculated range-axes but a fixed range 0.0 - 100.0 because the axes line shouldn't go higher than the 100 % max value. If you now have a category value of e.g. 99.5% and switch on the item labels, this label gets cut of at the top border. (Of course also depending on the font). The item labels should be drawn independently of the inner plot border, so that such labels don't get cut but are drawn over the borders of the inner plot. Test chart: ----------------------------- /** * This test shows that a bar label gets cut by the plots top border if a fixed range is used without margins and the bar is "too high" for the label. * (E.g. for percenatge charts 0% to 100% you don't want margins but an exact range axis from 0% to 100% and not wider.) * * @return JFreeChart. */ private JFreeChart testBarLabelCut() { JFreeChart result = null; DefaultCategoryDataset cd = new DefaultCategoryDataset(); cd.addValue(50.3, "Series1", "Category1"); cd.addValue(99.99, "Series1", "Category2"); result = ChartFactory.createBarChart("Bar Chart", "Categories", "Values", cd, PlotOrientation.VERTICAL, false, false, false); CategoryPlot plot = result.getCategoryPlot(); plot.getRangeAxis().setUpperMargin(0.0); CategoryItemRenderer renderer = plot.getRenderer(); CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator("{2} %", NumberFormat.getInstance()); renderer.setItemLabelGenerator(generator); renderer.setItemLabelsVisible(true); renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER, TextAnchor.CENTER, 0)); return result; }//testBarLabelCut() ------------------------------------- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1600446&group_id=15494 |