List of usage examples for org.jfree.chart.axis AxisLocation BOTTOM_OR_LEFT
AxisLocation BOTTOM_OR_LEFT
To view the source code for org.jfree.chart.axis AxisLocation BOTTOM_OR_LEFT.
Click Source Link
From source file:com.jaspersoft.studio.components.chart.model.enums.JFreeChartAxisLocationEnum.java
public static JFreeChartAxisLocationEnum getValue(AxisLocation ha) { if (ha != null) { if (ha.equals(AxisLocation.TOP_OR_LEFT)) return TOP_OR_LEFT; if (ha.equals(AxisLocation.TOP_OR_RIGHT)) return TOP_OR_RIGHT; if (ha.equals(AxisLocation.BOTTOM_OR_LEFT)) return BOTTOM_OR_LEFT; if (ha.equals(AxisLocation.BOTTOM_OR_RIGHT)) return BOTTOM_OR_RIGHT; }/*from w w w . j a v a 2 s . co m*/ return BOTTOM_OR_RIGHT; }
From source file:net.sf.jasperreports.chartthemes.simple.handlers.AxisLocationHandler.java
@Override public Object convertUponSet(Object value) { if (value == null) { return null; }/*from w ww.j a va 2 s . c o m*/ return AxisLocation.BOTTOM_OR_LEFT.toString().equals(value) ? AxisLocation.BOTTOM_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT.toString().equals(value) ? AxisLocation.BOTTOM_OR_RIGHT : AxisLocation.TOP_OR_LEFT.toString().equals(value) ? AxisLocation.TOP_OR_LEFT : AxisLocation.TOP_OR_RIGHT.toString().equals(value) ? AxisLocation.TOP_OR_RIGHT : null; }
From source file:soap.ui.stats.OverLaidBarChartFactory.java
public static JFreeChart createDualBarAndLineDiagram(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset barDiagramDataset, LinkedList lineDiagramDatasets) { CategoryPlot plot = new CategoryPlot(); int inc = 0;//from w w w.j a v a 2 s . com BarRenderer barRenderer = null; if (barDiagramDataset != null) { plot.setDataset(barDiagramDataset); barRenderer = new BarRenderer3D(); barRenderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(barRenderer); inc = 1; plot.setDomainAxis(new CategoryAxis3D(categoryAxisLabel)); plot.setRangeAxis(new NumberAxis3D(valueAxisLabel)); } else { plot.setDomainAxis(new CategoryAxis(categoryAxisLabel)); plot.setRangeAxis(new NumberAxis(valueAxisLabel)); } plot.mapDatasetToRangeAxis(0, 0); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT); plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); CategoryItemRenderer renderers[] = new LineAndShapeRenderer[lineDiagramDatasets.size()]; for (int i = 0; i < lineDiagramDatasets.size(); i++) { CategoryDataset lineDiagramDataset = (CategoryDataset) lineDiagramDatasets.get(i); plot.setDataset(i + inc, lineDiagramDataset); plot.mapDatasetToRangeAxis(i + inc, 0); if (barDiagramDataset != null && i < barDiagramDataset.getRowCount()) { renderers[i] = new LineAndShapeRendererMapToBar(barRenderer, i); } else { renderers[i] = new LineAndShapeRenderer(); } renderers[i].setToolTipGenerator(new StandardCategoryToolTipGenerator()); renderers[i].setSeriesStroke(0, new BasicStroke(1.5f)); renderers[i].setSeriesStroke(1, new BasicStroke(1.5f)); plot.setRenderer(i + inc, renderers[i]); } CategoryDataset dataset; if (lineDiagramDatasets.size() > 0) dataset = (CategoryDataset) lineDiagramDatasets.get(0); else dataset = barDiagramDataset; for (int i = 0; i < dataset.getColumnCount(); i++) plot.getDomainAxis().addCategoryLabelToolTip(dataset.getColumnKey(i), (String) dataset.getColumnKey(i)); plot.setRangeGridlinePaint(Color.black); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); JFreeChart chart = new JFreeChart(plot); chart.setTitle(title); chart.setLegend(new StandardLegend()); return chart; }
From source file:net.sf.fspdfs.chartthemes.simple.handlers.AxisLocationHandler.java
/** * *//* ww w .j a v a 2s . c o m*/ public Object convertUponSet(Object value) { if (value == null) { return null; } return AxisLocation.BOTTOM_OR_LEFT.toString().equals(value) ? AxisLocation.BOTTOM_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT.toString().equals(value) ? AxisLocation.BOTTOM_OR_RIGHT : AxisLocation.TOP_OR_LEFT.toString().equals(value) ? AxisLocation.TOP_OR_LEFT : AxisLocation.TOP_OR_RIGHT.toString().equals(value) ? AxisLocation.TOP_OR_RIGHT : null; }
From source file:org.jfree.chart.demo.XYBlockChartDemo1.java
private static JFreeChart createChart(XYZDataset xyzdataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setLowerMargin(0.0D);/*from w w w . ja va2s. com*/ numberaxis.setUpperMargin(0.0D); numberaxis.setAxisLinePaint(Color.white); numberaxis.setTickMarkPaint(Color.white); NumberAxis numberaxis1 = new NumberAxis("Y"); numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis1.setLowerMargin(0.0D); numberaxis1.setUpperMargin(0.0D); numberaxis1.setAxisLinePaint(Color.white); numberaxis1.setTickMarkPaint(Color.white); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); GrayPaintScale graypaintscale = new GrayPaintScale(-2D, 1.0D); xyblockrenderer.setPaintScale(graypaintscale); XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinesVisible(false); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setOutlinePaint(Color.blue); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo1", xyplot); jfreechart.removeLegend(); NumberAxis numberaxis2 = new NumberAxis("Scale"); numberaxis2.setAxisLinePaint(Color.white); numberaxis2.setTickMarkPaint(Color.white); numberaxis2.setTickLabelFont(new Font("Dialog", 0, 7)); PaintScaleLegend paintscalelegend = new PaintScaleLegend(new GrayPaintScale(), numberaxis2); paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); paintscalelegend.setAxisOffset(5D); paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D)); paintscalelegend.setFrame(new BlockBorder(Color.red)); paintscalelegend.setPadding(new RectangleInsets(10D, 10D, 10D, 10D)); paintscalelegend.setStripWidth(10D); paintscalelegend.setPosition(RectangleEdge.RIGHT); paintscalelegend.setBackgroundPaint(new Color(120, 120, 180)); jfreechart.addSubtitle(paintscalelegend); jfreechart.setBackgroundPaint(new Color(180, 180, 250)); return jfreechart; }
From source file:de.fub.maps.gpx.analysis.ui.charts.LineChart.java
/** * Creates new form LineChart/*from w ww . j ava 2 s. c o m*/ */ public LineChart() { initComponents(); chart = ChartFactory.createXYLineChart(null, NbBundle.getMessage(LineChart.class, "LineChart.Domain.Name"), NbBundle.getMessage(LineChart.class, "LineCHart.Value.Name"), dataset, PlotOrientation.VERTICAL, false, true, true); plot = chart.getXYPlot(); plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT); plot.setBackgroundPaint(Color.white); plot.getRenderer(0).setSeriesPaint(0, Color.BLUE); plot.getRenderer(0).setSeriesShape(0, new Ellipse2D.Double(0, 0, 2, 2)); plot.getRenderer(0).setBaseShape(new Ellipse2D.Double(0, 0, 2, 2)); chartPanel = new ChartPanel(chart, false); add(chartPanel, BorderLayout.CENTER); }
From source file:com.jaspersoft.studio.components.chart.model.enums.JFreeChartAxisLocationEnum.java
public AxisLocation getJFreeChartValue() { if (value == 0) return AxisLocation.TOP_OR_LEFT; if (value == 1) return AxisLocation.TOP_OR_RIGHT; if (value == 2) return AxisLocation.BOTTOM_OR_LEFT; if (value == 3) return AxisLocation.BOTTOM_OR_RIGHT; return null;/*from ww w . ja v a 2s . c om*/ }
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);// w ww .jav a2s. 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:no.ntnu.mmfplanner.ui.graph.SaNpvChart.java
/** * Creates the chart//from w w w . ja v a 2s. c o m */ private void createChart() { JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title "Period", // x axis label "Discounted Cash", // y axis label null, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setUpperMargin(0.0); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); setChart(chart); setMouseZoomable(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLegendLine(new Rectangle2D.Double(0.0, 0.0, 6.0, 0.0)); renderer.setUseFillPaint(true); // the x=0 line renderer.setSeriesPaint(0, Color.GRAY); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesVisibleInLegend(0, new Boolean(false)); plot.setRenderer(renderer); }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.BarChartRenderer.java
public void createChart() { CategoryDataset categorydataset = (CategoryDataset) this.datasetStrategy.getDataset(); report = ChartFactory.createBarChart(this.datasetStrategy.getTitle(), this.datasetStrategy.getYAxisLabel(), this.datasetStrategy.getXAxisLabel(), categorydataset, PlotOrientation.HORIZONTAL, true, true, false);//from w w w . j ava2 s .c o m // report.setBackgroundPaint( Color.lightGray ); report.setPadding(new RectangleInsets(5.0d, 5.0d, 5.0d, 5.0d)); CategoryPlot categoryplot = (CategoryPlot) report.getPlot(); categoryplot.setBackgroundPaint(Color.white); categoryplot.setRangeGridlinePaint(Color.lightGray); categoryplot.setDomainGridlinePaint(Color.lightGray); categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); if (datasetStrategy instanceof CoberturaBarChartStrategy || datasetStrategy instanceof CloverBarChartStrategy || datasetStrategy instanceof MultiCloverBarChartStrategy) { numberaxis.setRange(0.0D, BarChartRenderer.NUMBER_AXIS_RANGE); numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance()); } else { numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } numberaxis.setLowerMargin(0.0D); CategoryAxis axis = categoryplot.getDomainAxis(); axis.setLowerMargin(0.02); // two percent axis.setCategoryMargin(0.10); // ten percent axis.setUpperMargin(0.02); // two percent BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setItemMargin(0.10); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelsVisible(true); if (datasetStrategy instanceof CoberturaBarChartStrategy || datasetStrategy instanceof CloverBarChartStrategy || datasetStrategy instanceof MultiCloverBarChartStrategy) { barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getPercentInstance(Locale.getDefault()))); } else { barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); } int height = (categorydataset.getColumnCount() * ChartUtils.STANDARD_BARCHART_ENTRY_HEIGHT * categorydataset.getRowCount()); if (height > ChartUtils.MINIMUM_HEIGHT) { super.setHeight(height); } else { super.setHeight(ChartUtils.MINIMUM_HEIGHT); } Paint[] paints = this.datasetStrategy.getPaintColor(); for (int i = 0; i < categorydataset.getRowCount() && i < paints.length; i++) { barrenderer.setSeriesPaint(i, paints[i]); } }