List of usage examples for org.jfree.chart.axis CategoryLabelPositions DOWN_90
CategoryLabelPositions DOWN_90
To view the source code for org.jfree.chart.axis CategoryLabelPositions DOWN_90.
Click Source Link
From source file:com.xpn.xwiki.plugin.charts.params.CategoryLabelPositionsChartParam.java
@Override protected void init() { addChoice("down_45", CategoryLabelPositions.DOWN_45); addChoice("down_90", CategoryLabelPositions.DOWN_90); addChoice("standard", CategoryLabelPositions.STANDARD); addChoice("up_45", CategoryLabelPositions.UP_45); addChoice("up_90", CategoryLabelPositions.UP_90); }
From source file:edu.emory.library.tast.database.graphs.GraphTypeBar.java
public JFreeChart createChart(Object[] data) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); JFreeChart chart = ChartFactory.createBarChart(null, getSelectedIndependentVariable().getLabel(), TastResource.getText("components_charts_barvalue"), dataset, PlotOrientation.VERTICAL, true, true, false);/*from w w w . ja va 2 s.c om*/ CategoryPlot plot = chart.getCategoryPlot(); plot.getDomainAxis().setMaximumCategoryLabelLines(5); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); chart.setBackgroundPaint(Color.white); Format formatter = getSelectedIndependentVariable().getFormat(); List allDataSeries = getDataSeries(); for (int j = 0; j < allDataSeries.size(); j++) { DataSeries dataSearies = (DataSeries) allDataSeries.get(j); String dataSeriesLabel = dataSearies.formatForDisplay(); for (int i = 0; i < data.length; i++) { Object[] row = (Object[]) data[i]; String cat = formatter == null ? row[0].toString() : formatter.format(row[0]); dataset.addValue((Number) row[j + 1], dataSeriesLabel, cat); } } LegendItemCollection legendItems = chart.getPlot().getLegendItems(); for (int i = 0; i < legendItems.getItemCount(); i++) { LegendItem legendItem = legendItems.get(i); DataSeries dataSearies = (DataSeries) allDataSeries.get(i); if (legendItem.getFillPaint() instanceof Color) { dataSearies.setColor(((Color) legendItem.getFillPaint())); } } return chart; }
From source file:eu.delving.sip.base.ReportChartHelper.java
private static JPanel finishBarChart(JFreeChart chart, Color... colors) { CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangePannable(true);//from w w w .ja v a 2s .c o m if (colors.length > 0) plot.setRenderer(new CustomRenderer(colors)); BarRenderer bar = (BarRenderer) plot.getRenderer(); bar.setItemLabelAnchorOffset(9D); bar.setBaseItemLabelsVisible(true); bar.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); bar.setMaximumBarWidth(0.05); bar.setItemMargin(0.03D); bar.setBasePositiveItemLabelPosition( new ItemLabelPosition(INSIDE12, CENTER_RIGHT, CENTER_RIGHT, -1.5707963267948966D)); bar.setPositiveItemLabelPositionFallback( new ItemLabelPosition(OUTSIDE12, CENTER_LEFT, CENTER_LEFT, -1.5707963267948966D)); CategoryAxis x = plot.getDomainAxis(); x.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); x.setCategoryMargin(0.25D); x.setUpperMargin(0.02D); x.setLowerMargin(0.02D); NumberAxis y = (NumberAxis) plot.getRangeAxis(); y.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); y.setUpperMargin(0.10000000000000001D); ChartUtilities.applyCurrentTheme(chart); return new ChartPanel(chart); }
From source file:com.bdb.weather.display.summary.TemperatureBinSummaryPlot.java
public TemperatureBinSummaryPlot() { plot = new CombinedDomainCategoryPlot(); JFreeChart chart = new JFreeChart(plot); setMaxHeight(10000);/* w ww .j av a 2s . c om*/ setMaxWidth(10000); NumberAxis countAxis = new NumberAxis("Day Count"); countAxis.setUpperMargin(.2); countPlot.setRangeAxis(countAxis); countPlot.setDataset(countDataset); BarRenderer r = new BarRenderer(); r.setBaseItemLabelsVisible(true); r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r.setSeriesPaint(0, Color.BLUE); r.setBasePaint(Color.BLUE); countPlot.setRenderer(r); NumberAxis durationAxis = new NumberAxis("Duration (Hours)"); durationAxis.setUpperMargin(.2); durationPlot.setRangeAxis(durationAxis); durationPlot.setDataset(durationDataset); r = new BarRenderer(); r.setBaseItemLabelsVisible(true); NumberFormat format = DecimalFormat.getNumberInstance(); format.setMaximumFractionDigits(1); format.setMinimumFractionDigits(1); r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, format)); r.setSeriesPaint(0, Color.RED); r.setBasePaint(Color.RED); durationPlot.setRenderer(r); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.add(countPlot); plot.add(durationPlot); chartViewer = new ChartViewer(chart); this.setCenter(chartViewer); }
From source file:org.openfaces.component.chart.impl.PropertiesConverter.java
public static CategoryLabelPositions toCategroryLabelPosition(CategoryAxisLabelPosition position) { if (position == null) return CategoryLabelPositions.STANDARD; if (position.equals(CategoryAxisLabelPosition.UP_45)) return CategoryLabelPositions.UP_45; if (position.equals(CategoryAxisLabelPosition.UP_90)) return CategoryLabelPositions.UP_90; if (position.equals(CategoryAxisLabelPosition.DOWN_45)) return CategoryLabelPositions.DOWN_45; if (position.equals(CategoryAxisLabelPosition.DOWN_90)) return CategoryLabelPositions.DOWN_90; return CategoryLabelPositions.STANDARD; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates an area chart./*w w w .j a v a 2 s .c o m*/ * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @return JfreeChart instance. */ public JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createAreaChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0); domainAxis.setUpperMargin(0); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); AreaRenderer renderer = (AreaRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:com.mergano.core.GraphChart.java
private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart("Revenue", "Monthly", "Amount", dataset, PlotOrientation.VERTICAL, false, true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.15);//from w w w.j a v a 2 s . c o m // disable bar outlines... final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setSeriesItemLabelsVisible(0, Boolean.TRUE); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); return chart; }
From source file:com.sun.japex.report.ChartGenerator.java
static protected void configureLineChart(JFreeChart chart) { CategoryPlot plot = chart.getCategoryPlot(); final DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, // Draw a small diamond new Shape[] { new Polygon(new int[] { 3, 0, -3, 0 }, new int[] { 0, 3, 0, -3 }, 4) }); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDrawingSupplier(supplier);//from ww w . ja va 2 s . c om LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setStroke(new BasicStroke(2.0f)); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); }
From source file:com.greenpepper.confluence.macros.historic.LinearExecutionChartBuilder.java
private void customizeChart(JFreeChart chart) throws IOException { chart.setBackgroundPaint(Color.white); chart.setBorderVisible(settings.isBorder()); TextTitle chartTitle = chart.getTitle(); customizeTitle(chartTitle, DEFAULT_TITLE_FONT); addSubTitle(chart, settings.getSubTitle(), DEFAULT_SUBTITLE_FONT); addSubTitle(chart, settings.getSubTitle2(), DEFAULT_SUBTITLE2_FONT); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(gpUtil.getText("greenpepper.historic.nodata")); CategoryItemRenderer renderer = plot.getRenderer(); int index = 0; renderer.setSeriesPaint(index++, GREEN_COLOR); if (settings.isShowIgnored()) renderer.setSeriesPaint(index++, Color.yellow); renderer.setSeriesPaint(index, Color.red); renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); renderer.setItemURLGenerator(new CategoryURLGenerator() { public String generateURL(CategoryDataset data, int series, int category) { Comparable valueKey = data.getColumnKey(category); ChartLongValue value = (ChartLongValue) valueKey; return "javascript:" + settings.getExecutionUID() + "_showExecutionResult('" + value.getId() + "');"; }//from w w w . j a v a 2 s .c o m }); CategoryAxis domainAxis = plot.getDomainAxis(); customizeAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ValueAxis rangeAxis = plot.getRangeAxis(); customizeAxis(rangeAxis); rangeAxis.setLowerBound(0); if (rangeAxis instanceof NumberAxis) { ((NumberAxis) rangeAxis).setTickUnit(new NumberTickUnit(1)); } plot.setForegroundAlpha(0.8f); }
From source file:info.novatec.testit.livingdoc.confluence.macros.historic.LinearExecutionChartBuilder.java
@SuppressWarnings("deprecation") private void customizeChart(JFreeChart chart) { chart.setBackgroundPaint(Color.white); chart.setBorderVisible(settings.isBorder()); TextTitle chartTitle = chart.getTitle(); customizeTitle(chartTitle, DEFAULT_TITLE_FONT); addSubTitle(chart, settings.getSubTitle(), DEFAULT_SUBTITLE_FONT); addSubTitle(chart, settings.getSubTitle2(), DEFAULT_SUBTITLE2_FONT); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(ldUtil.getText("livingdoc.historic.nodata")); CategoryItemRenderer renderer = plot.getRenderer(); int index = 0; renderer.setSeriesPaint(index++, GREEN_COLOR); if (settings.isShowIgnored()) { renderer.setSeriesPaint(index++, Color.yellow); }/*from www.j av a 2 s. co m*/ renderer.setSeriesPaint(index, Color.red); renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); renderer.setItemURLGenerator(new CategoryURLGenerator() { @Override public String generateURL(CategoryDataset data, int series, int category) { Comparable<?> valueKey = data.getColumnKey(category); ChartLongValue value = (ChartLongValue) valueKey; return "javascript:" + settings.getExecutionUID() + "_showExecutionResult('" + value.getId() + "');"; } }); CategoryAxis domainAxis = plot.getDomainAxis(); customizeAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); ValueAxis rangeAxis = plot.getRangeAxis(); customizeAxis(rangeAxis); rangeAxis.setLowerBound(0); if (rangeAxis instanceof NumberAxis) { ((NumberAxis) rangeAxis).setTickUnit(new NumberTickUnit(1)); } plot.setForegroundAlpha(0.8f); }