List of usage examples for org.jfree.chart.axis LogarithmicAxis LogarithmicAxis
public LogarithmicAxis(String label)
From source file:org.jfree.chart.demo.LogarithmicAxisDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createScatterPlot("Logarithmic Axis Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); LogarithmicAxis logarithmicaxis = new LogarithmicAxis("X"); LogarithmicAxis logarithmicaxis1 = new LogarithmicAxis("Y"); xyplot.setDomainAxis(logarithmicaxis); xyplot.setRangeAxis(logarithmicaxis1); return jfreechart; }
From source file:org.jfree.chart.demo.LogarithmicAxisDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createScatterPlot("Logarithmic Axis Demo 2", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); LogarithmicAxis logarithmicaxis = new LogarithmicAxis("X"); logarithmicaxis.setExpTickLabelsFlag(true); logarithmicaxis.setStrictValuesFlag(false); LogarithmicAxis logarithmicaxis1 = new LogarithmicAxis("Y"); logarithmicaxis1.setAllowNegativesFlag(true); logarithmicaxis1.setLog10TickLabelsFlag(true); xyplot.setDomainAxis(logarithmicaxis); xyplot.setRangeAxis(logarithmicaxis1); return jfreechart; }
From source file:net.bioclipse.jasper.charCustomizers.DoseResponseChartCustomizer.java
@Override public void customize(JFreeChart chart, JRChart jasperchart) { ValueAxis domainAxis = new LogarithmicAxis("Concentration"); ValueAxis rangeAxis = new NumberAxis("SI%"); domainAxis.setTickLabelFont(small);//from w w w . java2s . c o m rangeAxis.setTickLabelFont(small); domainAxis.setLabelFont(normalsize); rangeAxis.setLabelFont(normalsize); rangeAxis.setRange(0, 110); chart.getXYPlot().setDomainAxis(domainAxis); chart.getXYPlot().setRangeAxis(rangeAxis); chart.getXYPlot().setDomainGridlinesVisible(false); chart.getXYPlot().getRenderer().setSeriesShape(0, new Ellipse2D.Double(-1, -1, 2, 2)); }
From source file:grafix.graficos.eixos.EixoCandles.java
@Override protected NumberAxis definirEixoVertical() { if (!Controle.getConfiguracoesVolateis().isLog()) { return new NumberAxis(); } else {/* www . ja va 2 s . c o m*/ NumberAxis n = new LogarithmicAxis("Eixo logartmico"); return n; } }
From source file:org.nbheaven.sqe.codedefects.dashboard.controlcenter.panels.Statistics.java
private static JFreeChart createOverviewPanel(DefaultCategoryDataset dataSet) { JFreeChart overview = org.jfree.chart.ChartFactory.createStackedBarChart(null, null, "CodeDefects", dataSet, PlotOrientation.HORIZONTAL, false, true, false); overview.setBorderVisible(false);//from w ww . j av a 2 s. co m overview.setBackgroundPaint(Color.WHITE); overview.setAntiAlias(true); overview.setNotify(true); CategoryPlot overviewPlot = overview.getCategoryPlot(); overviewPlot.setRangeGridlinePaint(Color.BLACK); overviewPlot.setDomainGridlinePaint(Color.BLACK); overviewPlot.setBackgroundPaint(Color.WHITE); overviewPlot.setForegroundAlpha(0.7f); overviewPlot.setRangeAxisLocation(AxisLocation.getOpposite(overviewPlot.getRangeAxisLocation())); CategoryAxis domainAxis = overviewPlot.getDomainAxis(); domainAxis.setVisible(true); LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects"); rangeAxis.setLabel(null); rangeAxis.setStrictValuesFlag(false); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); overviewPlot.setRangeAxis(rangeAxis); CategoryItemRenderer categoryItemRenderer = new StackedBarRenderer(); //3D(); // categoryItemRenderers[0].setPaint(Color.RED); categoryItemRenderer.setSeriesPaint(0, Color.RED); categoryItemRenderer.setSeriesPaint(1, Color.ORANGE); categoryItemRenderer.setSeriesPaint(2, Color.YELLOW); categoryItemRenderer.setBaseItemLabelsVisible(true); overviewPlot.setRenderer(categoryItemRenderer); return overview; }
From source file:org.ujmp.jfreechart.MatrixChartPanel.java
public synchronized void redraw() { Dataset dataset = null;/*from ww w .j a v a2s . c o m*/ dataset = new XYSeriesCollectionWrapper(getMatrix()); // dataset = new CategoryDatasetWrapper(getMatrix()); String title = getMatrix().getLabel(); String xLabel = StringUtil.format(getMatrix().getMatrix().getDimensionLabel(Matrix.ROW)); String yLabel = null; // setChart(ChartFactory.createLineChart(title, xLabel, yLabel, // (CategoryDataset) dataset, PlotOrientation.VERTICAL, true, // true, false)); setChart(ChartFactory.createXYLineChart(title, xLabel, yLabel, (XYDataset) dataset, PlotOrientation.VERTICAL, true, true, false)); XYPlot plot = getChart().getXYPlot(); if (getConfig().isLogScaleDomain()) { try { NumberAxis axis = new LogarithmicAxis(null); plot.setDomainAxis(axis); } catch (Exception e) { NumberAxis axis = new NumberAxis(); plot.setDomainAxis(axis); } } else { NumberAxis axis = new NumberAxis(); plot.setDomainAxis(axis); } if (getConfig().isLogScaleRange()) { try { NumberAxis axis = new LogarithmicAxis(null); plot.setRangeAxis(axis); } catch (Exception e) { NumberAxis axis = new NumberAxis(); plot.setRangeAxis(axis); } } else { NumberAxis axis = new NumberAxis(); plot.setRangeAxis(axis); } getChart().setTitle((String) null); getChart().setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseShapesVisible(false); renderer.setDrawSeriesLineAsPath(true); for (int i = 0; i < getMatrix().getColumnCount(); i++) { renderer.setSeriesStroke(i, new BasicStroke(3)); plot.setRenderer(i, renderer); } plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.getRangeAxis().setAutoRange(true); plot.getDomainAxis().setAutoRange(true); plot.getDomainAxis().setUpperMargin(0); setMouseZoomable(false); }
From source file:com.choicemaker.cm.modelmaker.gui.utils.HistoChartPanel.java
public HistoChartPanel(final JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips, final ModelMaker modelMaker) { super(chart, properties, save, print, zoom, tooltips); this.modelMaker = modelMaker; // horizontal zoom doesn't work, by setting false we don't get bogus menu item // setHorizontalZoom(false); // setVerticalZoom(true); final JCheckBoxMenuItem logYScale = new JCheckBoxMenuItem( ChoiceMakerCoreMessages.m.formatMessage("train.gui.modelmaker.panel.test.logscale.y")); logYScale.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { CategoryPlot p = (CategoryPlot) chart.getPlot(); Axis oldAxis = p.getRangeAxis(); if (logYScale.isSelected()) { LogarithmicAxis yAxis = new LogarithmicAxis(ChoiceMakerCoreMessages.m .formatMessage("train.gui.modelmaker.panel.histogram.cm.numpairs")); yAxis.setStrictValuesFlag(false); p.setRangeAxis(yAxis);/*from w w w.java 2s . c o m*/ } else { p.setRangeAxis(new NumberAxis(ChoiceMakerCoreMessages.m .formatMessage("train.gui.modelmaker.panel.histogram.cm.numpairs"))); } oldAxis.setPlot(null); chartChanged(new ChartChangeEvent(this)); } }); JPopupMenu popup = getPopupMenu(); popup.addSeparator(); popup.add(logYScale); popup.addSeparator(); select = new JMenu("Select"); final JMenuItem all = new JMenuItem("All"); select.add(all); final JMenuItem cmDiffer = new JMenuItem("Human marked differ"); select.add(cmDiffer); final JMenuItem cmHold = new JMenuItem("Human marked hold"); select.add(cmHold); final JMenuItem cmMatch = new JMenuItem("Human marked match"); select.add(cmMatch); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent ev) { ListeningMarkedRecordPairFilter filter = modelMaker.getFilter(); filter.reset(); filter.setFromPercentage(rangeFrom); filter.setToPercentage(rangeTo); Object src = ev.getSource(); if (src != all) { boolean[] b = new boolean[Decision.NUM_DECISIONS]; if (src == cmDiffer) { b[Decision.DIFFER.toInt()] = true; } else if (src == cmHold) { b[Decision.HOLD.toInt()] = true; } else if (src == cmMatch) { b[Decision.MATCH.toInt()] = true; } filter.setHumanDecision(b); } modelMaker.filterMarkedRecordPairList(); } }; all.addActionListener(l); cmDiffer.addActionListener(l); cmHold.addActionListener(l); cmMatch.addActionListener(l); popup.add(select); addChartMouseListener(new ChartMouseListener() { public void chartMouseClicked(ChartMouseEvent evt) { ChartEntity e = evt.getEntity(); if (e instanceof CategoryItemEntity) { CategoryItemEntity c = (CategoryItemEntity) e; int cat = c.getCategoryIndex(); HistoCategoryDataset data = (HistoCategoryDataset) ((CategoryPlot) getChart().getPlot()) .getDataset(); int len = data.getColumnCount(); float step = 1f / len; rangeFrom = cat * step; rangeTo = rangeFrom + step; ListeningMarkedRecordPairFilter filter = modelMaker.getFilter(); filter.reset(); filter.setFromPercentage(rangeFrom); filter.setToPercentage(rangeTo); boolean[] b = new boolean[Decision.NUM_DECISIONS]; int series = c.getSeries(); if (data.isIncludeHolds() && series != 0) { if (series == 1) { series = 2; } else { series = 1; } } b[series] = true; filter.setHumanDecision(b); modelMaker.filterMarkedRecordPairList(); } } public void chartMouseMoved(ChartMouseEvent arg0) { } }); }
From source file:jmbench.plots.OperationsVersusSizePlot.java
public void setLogScale(boolean range, boolean domain) { if (domain) { NumberAxis axis = (NumberAxis) plot.getDomainAxis(); axis = new LogarithmicAxis(axis.getLabel()); plot.setDomainAxis(axis);//www . j a va 2 s . com } if (range) { NumberAxis axis = (NumberAxis) plot.getRangeAxis(); axis = new LogarithmicAxis(axis.getLabel()); plot.setRangeAxis(axis); } }
From source file:org.matsim.core.utils.charts.XYScatterChart.java
private JFreeChart createChart(final String title, final String categoryAxisLabel, final String valueAxisLabel, final XYSeriesCollection dataset) { JFreeChart c = ChartFactory.createScatterPlot(title, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, true, // legend? false, // tooltips? false // URLs? );//from w w w.j ava 2 s . c o m if (this.isLogarithmicAxis) { XYPlot p = (XYPlot) c.getPlot(); LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel); LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); p.setDomainAxis(axis_x); p.setRangeAxis(axis_y); } return c; }
From source file:org.matsim.core.utils.charts.XYLineChart.java
private JFreeChart createChart(final String title, final String categoryAxisLabel, final String valueAxisLabel, final XYSeriesCollection dataset) { JFreeChart c = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, true, // legend? false, // tooltips? false // URLs? );// ww w.j a v a 2 s . c om if (this.isLogarithmicAxis) { XYPlot p = (XYPlot) c.getPlot(); LogarithmicAxis axis_x = new LogarithmicAxis(this.xAxisLabel); LogarithmicAxis axis_y = new LogarithmicAxis(this.yAxisLabel); axis_x.setAllowNegativesFlag(false); axis_y.setAllowNegativesFlag(false); p.setDomainAxis(axis_x); p.setRangeAxis(axis_y); } return c; }