List of usage examples for org.jfree.chart.axis AxisLocation BOTTOM_OR_RIGHT
AxisLocation BOTTOM_OR_RIGHT
To view the source code for org.jfree.chart.axis AxisLocation BOTTOM_OR_RIGHT.
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 ww . j a v a 2s . c om return BOTTOM_OR_RIGHT; }
From source file:org.jfree.chart.demo.XYShapeRendererDemo1.java
private static JFreeChart createChart(XYZDataset xyzdataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setAutoRangeIncludesZero(false); NumberAxis numberaxis1 = new NumberAxis("Y"); numberaxis1.setAutoRangeIncludesZero(false); XYShapeRenderer xyshaperenderer = new XYShapeRenderer(); LookupPaintScale lookuppaintscale = new LookupPaintScale(1.0D, 4D, new Color(0, 0, 255)); lookuppaintscale.add(2D, new Color(100, 100, 255)); lookuppaintscale.add(3D, new Color(200, 200, 255)); xyshaperenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyshaperenderer); xyplot.setDomainPannable(true);//w w w . j a v a 2 s . co m xyplot.setRangePannable(true); JFreeChart jfreechart = new JFreeChart("XYShapeRendererDemo1", xyplot); jfreechart.removeLegend(); NumberAxis numberaxis2 = new NumberAxis("Score"); numberaxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, numberaxis2); paintscalelegend.setPosition(RectangleEdge.RIGHT); paintscalelegend.setMargin(4D, 4D, 40D, 4D); paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); jfreechart.addSubtitle(paintscalelegend); ChartUtilities.applyCurrentTheme(jfreechart); return jfreechart; }
From source file:org.jfree.chart.demo.MultipleAxisDemo4.java
private static JFreeChart createChart() { XYDataset xydataset = createDataset("March 2007", 100D, new Day(1, 3, 2007), 31); JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 4", "Date", "Value", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setOrientation(PlotOrientation.VERTICAL); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setDateFormatOverride(new SimpleDateFormat("d-MMM-yyyy")); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(0, Color.red); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setTickLabelPaint(Color.red); DateAxis dateaxis1 = new DateAxis("Date"); dateaxis1.setDateFormatOverride(new SimpleDateFormat("d-MMM-yyyy")); xyplot.setDomainAxis(1, dateaxis1);//from w ww .j a v a2 s. c o m xyplot.setDomainAxisLocation(1, AxisLocation.TOP_OR_LEFT); NumberAxis numberaxis1 = new NumberAxis("Value"); numberaxis1.setAutoRangeIncludesZero(false); numberaxis1.setTickLabelPaint(Color.blue); xyplot.setRangeAxis(1, numberaxis1); xyplot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); XYDataset xydataset1 = createDataset("July 2007", 1000D, new Day(1, 7, 2007), 31); xyplot.setDataset(1, xydataset1); xyplot.mapDatasetToDomainAxis(1, 1); xyplot.mapDatasetToRangeAxis(1, 1); XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false); xylineandshaperenderer.setSeriesPaint(0, Color.blue); xyplot.setRenderer(1, xylineandshaperenderer); return jfreechart; }
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 v a 2s .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:net.sf.fspdfs.chartthemes.simple.handlers.AxisLocationHandler.java
/** * *//* www.j a v a 2 s .c om*/ 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: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;/* w w w . jav a 2 s . c o m*/ }
From source file:atencionurgencia.evolucion.grafic_sVitales.java
private void graficar() { final TimeSeriesCollection dataset1 = axisTaFC.createDatasetTA(); final JFreeChart chart2 = ChartFactory.createTimeSeriesChart("", // chart title "HORA", // domain axis label "Tensin Arterial - TA (ppm)", // range axis label dataset1, // data true, // include legend true, // tooltips? false // URL generator? Not required... );//from w w w .j ava2 s .co m chart2.setBackgroundPaint(Color.white); final XYPlot plot = chart2.getXYPlot(); plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF)); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } // plot.set // //// final CategoryDataset dataset2 = axisTaFC.createDatasetFC(); //// plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 0); // // final DateAxis domainAxis = (DateAxis) plot.getDomainAxis(); // domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); //// final ValueAxis axis2 = new NumberAxis("Frecuencia Cardiaca - FC (ppm)"); //// plot.setRangeAxis(1, axis2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); // // // final ChartPanel chartPanel = new ChartPanel(chart2); chartPanel.setPreferredSize(new java.awt.Dimension(444, 358));//[598, 358][444, 358] jPanel4.removeAll(); jPanel4.setLayout(new BorderLayout()); jPanel4.add(chartPanel, BorderLayout.NORTH); jPanel4.repaint(); }
From source file:peakmlviewer.dialog.peakinformation.Graph.java
public Graph(Composite parent) { super(parent, SWT.EMBEDDED); setLayout(new FillLayout()); // create the chart linechart = ChartFactory.createLineChart(null, "", "Abundance", dataset_intensity, PlotOrientation.VERTICAL, false, // legend false, // tooltips false // urls );/*from w w w . ja v a 2 s.c om*/ CategoryPlot plot = (CategoryPlot) linechart.getPlot(); // make the labels for the xaxis 45 degrees CategoryAxis xaxis = (CategoryAxis) plot.getDomainAxis(); xaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // add the mass accuracy yaxis NumberAxis yaxis_massacc = new NumberAxis("Mass accuracy (ppm)"); plot.setRangeAxis(1, yaxis_massacc); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); // create the mass accuracy dataset dataset_ppm = new DefaultCategoryDataset(); plot.setDataset(1, dataset_ppm); plot.mapDatasetToRangeAxis(1, 1); // create the renderer for the mass accuracy dataset LineAndShapeRenderer renderer_ppm = new LineAndShapeRenderer(); renderer_ppm.setBaseShapesFilled(true); renderer_ppm.setBaseShapesVisible(true); renderer_ppm.setBaseStroke( new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 1, new float[] { 5, 5 }, 0)); plot.setRenderer(1, renderer_ppm); // setup the renderer for the intensity dataset LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesFilled(true); renderer.setBaseShapesVisible(true); // general properties linechart.setBackgroundPaint(Color.WHITE); linechart.setBorderVisible(false); linechart.setAntiAlias(true); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); // add the components // -------------------------------------------------------------------------------- // This uses the SWT-trick for embedding awt-controls in an SWT-Composit. try { System.setProperty("sun.awt.noerasebackground", "true"); } catch (NoSuchMethodError error) { ; } java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this); // create a new ChartPanel, without the popup-menu (5x false) frame.add(new ChartPanel(linechart, false, false, false, false, false)); // -------------------------------------------------------------------------------- }
From source file:chart.DualAxis.java
/** * Creates a new demo instance.//from w ww . j ava 2 s . c om * * @param title the frame title. */ public DualAxis(final String title, double[] xData, double[] YDataAnalitic, double[] YDataNumerical) { super(title); final CategoryDataset dataset1 = createDataset1(xData, YDataAnalitic); // create the chart... final JFreeChart chart = ChartFactory.createLineChart("", // chart title "x", // domain axis label "y", // range axis label dataset1, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips? false // URL generator? Not required... ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // chart.getLegend().setAnchor(Legend.SOUTH); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF)); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); final CategoryDataset dataset2 = createDataset2(xData, YDataNumerical); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); //final ValueAxis axis2 = new NumberAxis(""); final ValueAxis axis2 = new NumberAxis(" "); plot.setRangeAxis(1, axis2); final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); renderer2.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); // OPTIONAL CUSTOMISATION COMPLETED. // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); // panel.removeAll(); // panel.add(chartPanel); // panel.validate(); }
From source file:playground.artemc.calibration.charts.AddSecondChart.java
public void addChartAndAxis() { //this.plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF)); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); //final CategoryAxis domainAxis = plot.getDomainAxis(); //domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); final ValueAxis axis2 = new NumberAxis(yAxisLabel); axis2.setRange(lowerLimit, upperLimit); plot.setRangeAxis(1, axis2);//from ww w. j av a2 s . c om plot.setDataset(1, dataset); plot.mapDatasetToRangeAxis(1, 1); final LineAndShapeRenderer renderer = new LineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.BLACK); renderer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(1, renderer); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainGridlinesVisible(true); }