List of usage examples for org.jfree.chart.plot XYPlot getRangeAxisCount
public int getRangeAxisCount()
From source file:com.rapidminer.gui.new_plotter.gui.dialog.AddParallelLineDialog.java
/** * Sets the current {@link PlotConfiguration} for this dialog. * //from ww w . jav a 2s .c o m * @param plotConfig */ private void setPlotConfiguration(PlotConfiguration plotConfig) { if (plotConfig == null) { throw new IllegalArgumentException("plotConfig must not be null!"); } this.plotConfig = plotConfig; Vector<RangeAxisConfig> rangeConfigsVector = new Vector<RangeAxisConfig>(); String selectedItem = String.valueOf(rangeAxisSelectionCombobox.getSelectedItem()); for (RangeAxisConfig config : this.plotConfig.getRangeAxisConfigs()) { rangeConfigsVector.add(config); } rangeAxisSelectionCombobox.setModel(new DefaultComboBoxModel(rangeConfigsVector)); // reselect the previously selected RangeAxisConfig (if it is still there) if (selectedItem != null) { for (int i = 0; i < rangeAxisSelectionCombobox.getItemCount(); i++) { if (String.valueOf(rangeAxisSelectionCombobox.getItemAt(i)).equals(selectedItem)) { rangeAxisSelectionCombobox.setSelectedIndex(i); break; } } } // calculate preselected x/y values if (mousePosition != null) { Rectangle2D plotArea = engine.getChartPanel().getScreenDataArea(); if (engine.getChartPanel().getChart().getPlot() instanceof XYPlot) { XYPlot plot = (XYPlot) engine.getChartPanel().getChart().getPlot(); // calculate x value double chartX = plot.getDomainAxis().java2DToValue(mousePosition.getX(), plotArea, plot.getDomainAxisEdge()); xField.setText(String.valueOf(chartX)); // calculate y value for (int i = 0; i < plot.getRangeAxisCount(); i++) { ValueAxis config = plot.getRangeAxis(i); if (config != null && config.getLabel() != null) { if (config.getLabel() .equals(String.valueOf(rangeAxisSelectionCombobox.getSelectedItem()))) { double chartY = config.java2DToValue(mousePosition.getY(), plotArea, plot.getRangeAxisEdge()); yField.setText(String.valueOf(chartY)); } } } } } }
From source file:mil.tatrc.physiology.utilities.csv.plots.RespiratoryPFTPlotter.java
public void formatRPFTPlot(PlotJob job, JFreeChart chart) { XYPlot plot = (XYPlot) chart.getPlot(); //For Scientific notation NumberFormat formatter = new DecimalFormat("0.######E0"); for (int i = 0; i < plot.getDomainAxisCount(); i++) { plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); }/* w w w. j av a 2 s .c o m*/ for (int i = 0; i < plot.getRangeAxisCount(); i++) { plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i); rangeAxis.setNumberFormatOverride(formatter); } //White background outside of plottable area chart.setBackgroundPaint(job.bgColor); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15)); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black); }
From source file:mil.tatrc.physiology.utilities.csv.plots.MultiPlotter.java
protected void formatMultiPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1, XYSeriesCollection dataSet2) {// ww w . ja v a2s . c om Color[] blueColors = { Color.blue, Color.cyan, new Color(0, 160, 255), new Color(0, 100, 255), new Color(0, 160, 255), new Color(14, 0, 145), new Color(70, 105, 150) }; Color[] redColors = { Color.red, Color.magenta, new Color(255, 0, 100), new Color(255, 0, 160), Color.pink, new Color(145, 0, 0), new Color(132, 58, 58) }; Color[] variedColors = { Color.red, Color.blue, Color.green, Color.orange, Color.magenta, Color.cyan, Color.gray, new Color(255, 165, 0), new Color(42, 183, 136), new Color(87, 158, 186) }; XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer(); BasicStroke wideLine = new BasicStroke(2.0f); //For Scientific notation NumberFormat formatter = new DecimalFormat("0.######E0"); for (int i = 0; i < plot.getDomainAxisCount(); i++) { plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); } for (int i = 0; i < plot.getRangeAxisCount(); i++) { plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i); rangeAxis.setNumberFormatOverride(formatter); } //White background outside of plottable area chart.setBackgroundPaint(job.bgColor); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15)); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black); //If there is only one Y axis, we just need to color the data series differently if (job.Y2headers == null || job.Y2headers.isEmpty()) { for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) { renderer1.setSeriesStroke(i, wideLine); renderer1.setBaseShapesVisible(false); if (cIndex > 9) cIndex = 0; renderer1.setSeriesFillPaint(i, variedColors[cIndex]); renderer1.setSeriesPaint(i, variedColors[cIndex]); } } //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing else { StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); plot.setRenderer(1, renderer2); for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) { renderer1.setSeriesStroke(i, wideLine); renderer1.setBaseShapesVisible(false); if (cIndex > 6) cIndex = 0; renderer1.setSeriesFillPaint(i, redColors[cIndex]); renderer1.setSeriesPaint(i, redColors[cIndex]); } for (int i = 0, cIndex = 0; i < dataSet2.getSeriesCount(); i++, cIndex++) { renderer2.setSeriesStroke(i, wideLine); renderer2.setBaseShapesVisible(false); if (cIndex > 6) cIndex = 0; renderer2.setSeriesFillPaint(i, blueColors[cIndex]); renderer2.setSeriesPaint(i, blueColors[cIndex]); } plot.getRangeAxis(0).setLabelPaint(redColors[0]); plot.getRangeAxis(0).setTickLabelPaint(redColors[0]); plot.getRangeAxis(1).setLabelPaint(blueColors[0]); plot.getRangeAxis(1).setTickLabelPaint(blueColors[0]); } }
From source file:mil.tatrc.physiology.utilities.csv.plots.ConvexHullPlotter.java
protected void formatConvexHullPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1, XYSeriesCollection dataSet2) {// w w w . j a v a 2s . c o m XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer(); BasicStroke wideLine = new BasicStroke(2.0f); //For Scientific notation NumberFormat formatter = new DecimalFormat("0.######E0"); for (int i = 0; i < plot.getDomainAxisCount(); i++) { plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); } for (int i = 0; i < plot.getRangeAxisCount(); i++) { plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i); rangeAxis.setNumberFormatOverride(formatter); } //White background outside of plottable area chart.setBackgroundPaint(job.bgColor); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15)); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black); //If there is only one Y axis, color all datasets red (so top, bottom, left, and right will be the same) if (job.Y2headers == null || job.Y2headers.isEmpty()) { for (int i = 0; i < dataSet1.getSeriesCount(); i++) { renderer1.setSeriesStroke(i, wideLine); renderer1.setBaseShapesVisible(false); renderer1.setSeriesFillPaint(i, Color.red); renderer1.setSeriesPaint(i, Color.red); if (dataSet1.getSeries(i).getKey() != null && dataSet1.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE")) renderer1.setSeriesVisibleInLegend(i, false); } } //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing else { StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); plot.setRenderer(1, renderer2); for (int i = 0; i < dataSet1.getSeriesCount(); i++) { renderer1.setSeriesStroke(i, wideLine); renderer1.setBaseShapesVisible(false); renderer1.setSeriesFillPaint(i, Color.red); renderer1.setSeriesPaint(i, Color.red); if (dataSet1.getSeries(i).getKey() != null && dataSet1.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE")) renderer1.setSeriesVisibleInLegend(i, false); } for (int i = 0; i < dataSet2.getSeriesCount(); i++) { renderer2.setSeriesStroke(i, wideLine); renderer2.setBaseShapesVisible(false); renderer2.setSeriesFillPaint(i, Color.blue); renderer2.setSeriesPaint(i, Color.blue); if (dataSet2.getSeries(i).getKey() != null && dataSet2.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE")) renderer2.setSeriesVisibleInLegend(i, false); } plot.getRangeAxis(0).setLabelPaint(Color.red); plot.getRangeAxis(0).setTickLabelPaint(Color.red); plot.getRangeAxis(1).setLabelPaint(Color.blue); plot.getRangeAxis(1).setTickLabelPaint(Color.blue); } }
From source file:mil.tatrc.physiology.utilities.csv.plots.ActionEventPlotter.java
public void formatAEPlot(PlotJob job, JFreeChart chart) { XYPlot plot = (XYPlot) chart.getPlot(); //For Scientific notation NumberFormat formatter = new DecimalFormat("0.######E0"); for (int i = 0; i < plot.getDomainAxisCount(); i++) { plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); }/*w w w. j a v a 2s .c o m*/ for (int i = 0; i < plot.getRangeAxisCount(); i++) { plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15)); plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i); rangeAxis.setNumberFormatOverride(formatter); } //White background outside of plottable area chart.setBackgroundPaint(job.bgColor); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.black); plot.setRangeGridlinePaint(Color.black); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15)); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize)); chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black); }
From source file:org.trade.ui.chart.CandlestickChart.java
/** * A demonstration application showing a candlestick chart. * /* w w w . j av a2 s .c o m*/ * @param title * the frame title. * @param strategyData * StrategyData */ public CandlestickChart(final String title, StrategyData strategyData, Tradingday tradingday) { this.strategyData = strategyData; this.setLayout(new BorderLayout()); // Used to mark the current price stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 10, 3 }, 0); valueMarker = new ValueMarker(0.00, Color.black, stroke); this.chart = createChart(this.strategyData, title, tradingday); BlockContainer container = new BlockContainer(new BorderArrangement()); container.add(titleLegend1, RectangleEdge.LEFT); container.add(titleLegend2, RectangleEdge.RIGHT); container.add(new EmptyBlock(2000, 0)); CompositeTitle legends = new CompositeTitle(container); legends.setPosition(RectangleEdge.BOTTOM); this.chart.addSubtitle(legends); final ChartPanel chartPanel = new ChartPanel(this.chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseZoomable(true, true); chartPanel.setRefreshBuffer(true); chartPanel.setDoubleBuffered(true); chartPanel.setVerticalAxisTrace(true); chartPanel.setHorizontalAxisTrace(true); chartPanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseMoved(ChartMouseEvent e) { } public void chartMouseClicked(final ChartMouseEvent e) { CombinedDomainXYPlot combinedXYplot = (CombinedDomainXYPlot) e.getChart().getPlot(); @SuppressWarnings("unchecked") List<XYPlot> subplots = combinedXYplot.getSubplots(); if (e.getTrigger().getClickCount() == 2) { double xItem = 0; double yItem = 0; if (e.getEntity() instanceof XYItemEntity) { XYItemEntity xYItemEntity = ((XYItemEntity) e.getEntity()); xItem = xYItemEntity.getDataset().getXValue(xYItemEntity.getSeriesIndex(), xYItemEntity.getItem()); yItem = xYItemEntity.getDataset().getYValue(xYItemEntity.getSeriesIndex(), xYItemEntity.getItem()); } else { PlotEntity plotEntity = ((PlotEntity) e.getEntity()); XYPlot plot = (XYPlot) plotEntity.getPlot(); xItem = plot.getDomainCrosshairValue(); yItem = plot.getRangeCrosshairValue(); } for (XYPlot xyplot : subplots) { double x = xyplot.getDomainCrosshairValue(); double y = xyplot.getRangeCrosshairValue(); /* * If the cross hair is from a right-hand y axis we need * to convert this to a left-hand y axis. */ String rightAxisName = ", Price: "; double rangeLowerLeft = 0; double rangeUpperLeft = 0; double rangeLowerRight = 0; double rangeUpperRight = 0; double yRightLocation = 0; for (int index = 0; index < xyplot.getRangeAxisCount(); index++) { AxisLocation axisLocation = xyplot.getRangeAxisLocation(index); Range range = xyplot.getRangeAxis(index).getRange(); if (axisLocation.equals(AxisLocation.BOTTOM_OR_LEFT) || axisLocation.equals(AxisLocation.TOP_OR_LEFT)) { rangeLowerLeft = range.getLowerBound(); rangeUpperLeft = range.getUpperBound(); rightAxisName = ", " + xyplot.getRangeAxis(index).getLabel() + ": "; } if (y >= range.getLowerBound() && y <= range.getUpperBound() && (axisLocation.equals(AxisLocation.BOTTOM_OR_RIGHT) || axisLocation.equals(AxisLocation.TOP_OR_RIGHT))) { rangeUpperRight = range.getUpperBound(); rangeLowerRight = range.getLowerBound(); } } if ((rangeUpperRight - rangeLowerRight) > 0) { yRightLocation = rangeLowerLeft + ((rangeUpperLeft - rangeLowerLeft) * ((y - rangeLowerRight) / (rangeUpperRight - rangeLowerRight))); } else { yRightLocation = y; } String text = " Time: " + dateFormatShort.format(new Date((long) (x))) + rightAxisName + new Money(y); if (x == xItem && y == yItem) { titleLegend1.setText(text); if (null == clickCrossHairs) { clickCrossHairs = new XYTextAnnotation(text, x, yRightLocation); clickCrossHairs.setTextAnchor(TextAnchor.BOTTOM_LEFT); xyplot.addAnnotation(clickCrossHairs); } else { clickCrossHairs.setText(text); clickCrossHairs.setX(x); clickCrossHairs.setY(yRightLocation); } } } } else if (e.getTrigger().getClickCount() == 1 && null != clickCrossHairs) { for (XYPlot xyplot : subplots) { if (xyplot.removeAnnotation(clickCrossHairs)) { clickCrossHairs = null; titleLegend1.setText(" Time: 0, Price :0.0"); break; } } } } }); this.add(chartPanel, null); this.strategyData.getCandleDataset().getSeries(0).addChangeListener(this); }
From source file:OAT.ui.BarChartFrame.java
public void addDataset(ChartDataset dataset) { if (dataset == null || dataset.getSeriesCount() == 0) { return;//from ww w . j av a 2s . c o m } XYPlot plot = getChart().getXYPlot(); int i = plot.getDatasetCount(); for (int j = 0; j < i; j++) { if (plot.getDataset(j).equals(dataset)) { // System.out.println("eq " + i // + " " + ((ChartDataset) plot.getDataset(j)).getTitle() // + " " + dataset.getTitle()); return; } } plot.setDataset(i, dataset); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); Double[] range = dataset.getAxisRange(); //axis int axisId = 0; if (range != null) { // if (range == null || range.length < 2) { // plot.mapDatasetToRangeAxis(i, 0); // } else { //scan for equal axis range, reuse if found boolean hasSameRange = false; if (range.length > 1) { for (int j = 1; j < plot.getRangeAxisCount(); j++) { Range otherRange = plot.getRangeAxis(j).getRange(); if (otherRange != null && otherRange.getLowerBound() == range[0] && otherRange.getUpperBound() == range[1]) { axisId = j; hasSameRange = true; break; } } } if (!hasSameRange) { NumberAxis newAxis = new NumberAxis(); if (range.length > 1) { newAxis.setAutoRange(false); newAxis.setRange(range[0], range[1]); } if (range.length > 2) { newAxis.setAutoTickUnitSelection(false, false); newAxis.setTickUnit(new NumberTickUnit(range[2])); } newAxis.setNumberFormatOverride(TextUtil.SIMPLE_FORMATTER); // newAxis.setAxisLinePaint(new Color(100, 0, 0)); // newAxis.setLabelPaint(paints[i][0]); // newAxis.setTickLabelPaint(paints[i][0]); // newAxis.setTickMarkPaint(paints[i][0]); // newAxis.setTickLabelsVisible(true); axisId = plot.getRangeAxisCount(); plot.setRangeAxis(axisId, newAxis, false); plot.setRangeAxisLocation(axisId, AxisLocation.BOTTOM_OR_LEFT, false); } // plot.mapDatasetToRangeAxis(i, newAxisId); } plot.mapDatasetToRangeAxis(i, axisId); // //renderer XYLineAndShapeRenderer renderer; if (dataset instanceof TradeDataset) { renderer = new TradeRenderer(); for (int j = 0; j < dataset.getSeriesCount(); j++) { renderer.setSeriesLinesVisible(j, false); } } else { Shape shape = Main.defaultShape; Paint[][] seriesPaints; Stroke stroke; if (dataset.getSource() instanceof Stopper && !(dataset.getSource() instanceof Calculator)) { seriesPaints = Main.greyPaints; stroke = Main.dottedStoke; } else { seriesPaints = Main.defaultPaints; stroke = Main.defaultStoke; } renderer = new IndicatorRenderer(seriesPaints[(i - 1) % seriesPaints.length], shape, stroke); } plot.setRenderer(i, renderer, false); }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.JFreeChartPlotEngine.java
private void setAxesFont(Font axesFont) { JFreeChart chart = getCurrentChart(); if (chart != null) { Plot plot = chart.getPlot();// w ww. j a va 2 s . c o m if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; // first change range axes font int rangeAxisCount = categoryPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis valueAxis = categoryPlot.getRangeAxis(i); if (valueAxis != null) { valueAxis.setLabelFont(axesFont); valueAxis.setTickLabelFont(axesFont); } } // then set domain axis font CategoryAxis domainAxis = categoryPlot.getDomainAxis(); if (domainAxis != null) { domainAxis.setLabelFont(axesFont); domainAxis.setTickLabelFont(axesFont); } } else { XYPlot xyPlot = (XYPlot) plot; // first change range axes font int rangeAxisCount = xyPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis rangeAxis = xyPlot.getRangeAxis(i); if (rangeAxis != null) { rangeAxis.setLabelFont(axesFont); rangeAxis.setTickLabelFont(axesFont); } } // then set domain axis font ValueAxis domainAxis = xyPlot.getDomainAxis(); if (domainAxis != null) { domainAxis.setLabelFont(axesFont); domainAxis.setTickLabelFont(axesFont); } } } }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.JFreeChartPlotEngine.java
private void axisLineColorChanged(Color lineColor) { JFreeChart chart = getCurrentChart(); if (chart != null) { Plot plot = chart.getPlot();/*w ww. ja v a2 s . c o m*/ if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; ChartAxisFactory.formatAxis(plotInstance.getCurrentPlotConfigurationClone(), categoryPlot.getDomainAxis()); int rangeAxisCount = categoryPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis valueAxis = categoryPlot.getRangeAxis(i); if (valueAxis != null) { ChartAxisFactory.formatAxis(plotInstance.getCurrentPlotConfigurationClone(), valueAxis); } } } else if (plot instanceof XYPlot) { XYPlot xyPlot = (XYPlot) plot; ChartAxisFactory.formatAxis(plotInstance.getCurrentPlotConfigurationClone(), xyPlot.getDomainAxis()); int rangeAxisCount = xyPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis valueAxis = xyPlot.getRangeAxis(i); valueAxis.setAxisLinePaint(lineColor); if (valueAxis != null) { ChartAxisFactory.formatAxis(plotInstance.getCurrentPlotConfigurationClone(), valueAxis); } } } } }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.JFreeChartPlotEngine.java
private void axisLineWidthChanged(Float lineWidth) { JFreeChart chart = getCurrentChart(); if (chart != null) { Plot plot = chart.getPlot();//from w w w . j a v a2 s. com BasicStroke stroke = new BasicStroke(lineWidth); if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; CategoryAxis domainAxis = categoryPlot.getDomainAxis(); if (domainAxis != null) { domainAxis.setAxisLineStroke(stroke); } int rangeAxisCount = categoryPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis valueAxis = categoryPlot.getRangeAxis(i); if (valueAxis != null) { valueAxis.setAxisLineStroke(stroke); } } } else if (plot instanceof XYPlot) { XYPlot xyPlot = (XYPlot) plot; ValueAxis domainAxis = xyPlot.getDomainAxis(); if (domainAxis != null) { domainAxis.setAxisLineStroke(stroke); } int rangeAxisCount = xyPlot.getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; ++i) { ValueAxis valueAxis = xyPlot.getRangeAxis(i); if (valueAxis != null) { valueAxis.setAxisLineStroke(stroke); } } } } }