List of usage examples for org.jfree.chart ChartPanel setMaximumDrawWidth
public void setMaximumDrawWidth(int width)
From source file:org.jfree.chart.demo.FastScatterPlotDemo.java
/** * Creates a new fast scatter plot demo. * * @param title the frame title./*ww w . j a v a2 s. com*/ */ public FastScatterPlotDemo(final String title) { super(title); populateData(); final NumberAxis domainAxis = new NumberAxis("X"); domainAxis.setAutoRangeIncludesZero(false); final NumberAxis rangeAxis = new NumberAxis("Y"); rangeAxis.setAutoRangeIncludesZero(false); final FastScatterPlot plot = new FastScatterPlot(this.data, domainAxis, rangeAxis); final JFreeChart chart = new JFreeChart("Fast Scatter Plot", plot); // chart.setLegend(null); // force aliasing of the rendered content.. chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final ChartPanel panel = new ChartPanel(chart, true); panel.setPreferredSize(new java.awt.Dimension(500, 270)); // panel.setHorizontalZoom(true); // panel.setVerticalZoom(true); panel.setMinimumDrawHeight(10); panel.setMaximumDrawHeight(2000); panel.setMinimumDrawWidth(20); panel.setMaximumDrawWidth(2000); setContentPane(panel); }
From source file:test.FastScatterDemo.java
/** * Creates a new fast scatter plot demo. * * @param title the frame title.//w ww. ja v a2 s . com */ public FastScatterDemo(final String title) { super(title); populateData(); final NumberAxis domainAxis = new NumberAxis("X"); domainAxis.setAutoRangeIncludesZero(false); final NumberAxis rangeAxis = new NumberAxis("Y"); rangeAxis.setAutoRangeIncludesZero(false); final FastScatterPlot plot = new FastScatterPlot(this.data, domainAxis, rangeAxis); final JFreeChart chart = new JFreeChart("Fast Scatter Plot", plot); // chart.setLegend(null); // force aliasing of the rendered content.. chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final ChartPanel panel = new ChartPanel(chart, true); panel.setPreferredSize(new java.awt.Dimension(500, 270)); // panel.setHorizontalZoom(true); // panel.setVerticalZoom(true); panel.setMinimumDrawHeight(10); panel.setMaximumDrawHeight(2000); panel.setMinimumDrawWidth(20); panel.setMaximumDrawWidth(2000); setContentPane(panel); }
From source file:com.idealista.solrmeter.view.statistic.OperationTimeLineChartPanel.java
private Component createChartPanel() { NumberAxis xaxis = new NumberAxis(I18n.get("statistic.operationTimeLineChartPanel.executionInstant")); NumberAxis yaxis = new NumberAxis(I18n.get("statistic.operationTimeLineChartPanel.qTime")); XYPlot plot = new XYPlot(xyDataset, xaxis, yaxis, new XYLineAndShapeRenderer(true, true)); JFreeChart chart = new JFreeChart(I18n.get("statistic.operationTimeLineChartPanel.title"), null, plot, true);/*from ww w.ja v a2 s. c o m*/ chart.getLegend().setPosition(RectangleEdge.RIGHT); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(CHART_BORDER); chartPanel.setMinimumDrawHeight(0); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); return chartPanel; }
From source file:guineu.modules.visualization.intensityplot.IntensityPlotFrame.java
public IntensityPlotFrame(ParameterSet parameters) { super("", true, true, true, true); String title = "Intensity plot [" + GuineuCore.getDesktop().getSelectedDataFiles()[0].getDatasetName() + "]"; String xAxisLabel = parameters.getParameter(IntensityPlotParameters.xAxisValueSource).getValue().toString(); // create dataset dataset = new IntensityPlotDataset(parameters); // create new JFreeChart logger.finest("Creating new chart instance"); chart = ChartFactory.createLineChart(title, xAxisLabel, "Height", dataset, PlotOrientation.VERTICAL, true, true, false);// ww w. jav a 2s.c om CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set renderer StatisticalLineAndShapeRenderer renderer = new StatisticalLineAndShapeRenderer(false, true); renderer.setBaseStroke(new BasicStroke(2)); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); // set tooltip generator CategoryToolTipGenerator toolTipGenerator = new IntensityPlotTooltipGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); chart.setBackgroundPaint(Color.white); // create chart JPanel ChartPanel chartPanel = new ChartPanel(chart); add(chartPanel, BorderLayout.CENTER); IntensityPlotToolBar toolBar = new IntensityPlotToolBar(this); add(toolBar, BorderLayout.EAST); // disable maximum size (we don't want scaling) chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); // set title properties TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setBorder(0, 0, 0, 0); Plot dplot = chart.getPlot(); // set shape provider IntensityPlotDrawingSupplier shapeSupplier = new IntensityPlotDrawingSupplier(); dplot.setDrawingSupplier(shapeSupplier); // set y axis properties NumberAxis yAxis; yAxis = (NumberAxis) ((CategoryPlot) dplot).getRangeAxis(); NumberFormat yAxisFormat = new DecimalFormat("0.0E0"); yAxis.setNumberFormatOverride(yAxisFormat); setTitle(title); setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); setBackground(Color.white); pack(); }
From source file:lk.ac.mrt.projectx.buildex.complex.FormalVerifier.java
/** * Creates a new fast scatter plot demo. * * @param title the frame title./* ww w.jav a 2 s . c om*/ */ public FormalVerifier(final String title, final String lblx, final String lbly) throws IOException { super(title); populateData(); final NumberAxis domainAxis = new NumberAxis(lblx); domainAxis.setAutoRangeIncludesZero(false); final NumberAxis rangeAxis = new NumberAxis(lbly); rangeAxis.setAutoRangeIncludesZero(false); final FastScatterPlot plot = new FastScatterPlot(this.data, domainAxis, rangeAxis); final JFreeChart chart = new JFreeChart(title, plot); // chart.setLegend(null); // force aliasing of the rendered content.. chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final ChartPanel panel = new ChartPanel(chart, true); panel.setPreferredSize(new java.awt.Dimension(800, 600)); // panel.setHorizontalZoom(true); // panel.setVerticalZoom(true); panel.setMinimumDrawHeight(10); panel.setMaximumDrawHeight(3000); panel.setMinimumDrawWidth(20); panel.setMaximumDrawWidth(3000); setContentPane(panel); //TODO : Print ChartUtilities.saveChartAsJPEG( new File("F:\\FYP2\\FinalP\\graphs\\Twirl" + System.currentTimeMillis() + ".jpg"), chart, 800, 600); }
From source file:net.sf.mzmine.modules.visualization.intensityplot.IntensityPlotFrame.java
public IntensityPlotFrame(ParameterSet parameters) { PeakList peakList = parameters.getParameter(IntensityPlotParameters.peakList).getValue()[0]; String title = "Intensity plot [" + peakList + "]"; String xAxisLabel = parameters.getParameter(IntensityPlotParameters.xAxisValueSource).getValue().toString(); String yAxisLabel = parameters.getParameter(IntensityPlotParameters.yAxisValueSource).getValue().toString(); // create dataset dataset = new IntensityPlotDataset(parameters); // create new JFreeChart logger.finest("Creating new chart instance"); Object xAxisValueSource = parameters.getParameter(IntensityPlotParameters.xAxisValueSource).getValue(); boolean isCombo = (xAxisValueSource instanceof ParameterWrapper) && (((ParameterWrapper) xAxisValueSource).getParameter() instanceof ComboParameter); if ((xAxisValueSource == IntensityPlotParameters.rawDataFilesOption) || isCombo) { chart = ChartFactory.createLineChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false);//from www. j a v a 2 s .co m CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set renderer StatisticalLineAndShapeRenderer renderer = new StatisticalLineAndShapeRenderer(false, true); renderer.setBaseStroke(new BasicStroke(2)); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); // set tooltip generator CategoryToolTipGenerator toolTipGenerator = new IntensityPlotTooltipGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); } else { chart = ChartFactory.createXYLineChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); XYErrorRenderer renderer = new XYErrorRenderer(); renderer.setBaseStroke(new BasicStroke(2)); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); // set tooltip generator XYToolTipGenerator toolTipGenerator = new IntensityPlotTooltipGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); } chart.setBackgroundPaint(Color.white); // create chart JPanel ChartPanel chartPanel = new ChartPanel(chart); add(chartPanel, BorderLayout.CENTER); IntensityPlotToolBar toolBar = new IntensityPlotToolBar(this); add(toolBar, BorderLayout.EAST); // disable maximum size (we don't want scaling) chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); // set title properties TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setBorder(0, 0, 0, 0); Plot plot = chart.getPlot(); // set shape provider IntensityPlotDrawingSupplier shapeSupplier = new IntensityPlotDrawingSupplier(); plot.setDrawingSupplier(shapeSupplier); // set y axis properties NumberAxis yAxis; if (plot instanceof CategoryPlot) yAxis = (NumberAxis) ((CategoryPlot) plot).getRangeAxis(); else yAxis = (NumberAxis) ((XYPlot) plot).getRangeAxis(); NumberFormat yAxisFormat = MZmineCore.getConfiguration().getIntensityFormat(); if (parameters.getParameter(IntensityPlotParameters.yAxisValueSource).getValue() == YAxisValueSource.RT) yAxisFormat = MZmineCore.getConfiguration().getRTFormat(); yAxis.setNumberFormatOverride(yAxisFormat); setTitle(title); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBackground(Color.white); pack(); }
From source file:guineu.modules.visualization.intensityboxplot.IntensityBoxPlotFrame.java
public IntensityBoxPlotFrame(ParameterSet parameters) { super("", true, true, true, true); String title = "Intensity box plot [" + GuineuCore.getDesktop().getSelectedDataFiles()[0].getDatasetName() + "]"; String xAxisLabel = parameters.getParameter(IntensityBoxPlotParameters.xAxisValueSource).getValue() .toString();// w ww . jav a 2 s . c om this.xAxisValueSource = parameters.getParameter(IntensityBoxPlotParameters.xAxisValueSource).getValue(); // create dataset this.selectedFiles = parameters.getParameter(IntensityBoxPlotParameters.dataFiles).getValue(); this.selectedRows = parameters.getParameter(IntensityBoxPlotParameters.selectedRows).getValue(); this.dataset = this.createSampleDataset(); // create new JFreeChart logger.finest("Creating new chart instance"); // chart = ChartFactory.createLineChart(title, xAxisLabel, "Intensity", // dataset, PlotOrientation.VERTICAL, true, true, false); // CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set renderer BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(true); // set tooltip generator renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); // plot.setRenderer(renderer); // plot.setBackgroundPaint(Color.white); // CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); // xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // set y axis properties final CategoryAxis xAxis = new CategoryAxis("Type"); final NumberAxis yAxis = new NumberAxis("Value"); NumberFormat yAxisFormat = new DecimalFormat("0.0E0"); yAxis.setNumberFormatOverride(yAxisFormat); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); final JFreeChart chart = new JFreeChart("Intensity Box plot", new Font("SansSerif", Font.BOLD, 14), plot, true); chart.setBackgroundPaint(Color.white); // create chart JPanel ChartPanel chartPanel = new ChartPanel(chart); add(chartPanel, BorderLayout.CENTER); // IntensityBoxPlotToolBar toolBar = new IntensityBoxPlotToolBar(this); // add(toolBar, BorderLayout.EAST); // disable maximum size (we don't want scaling) chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); // set title properties TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setBorder(0, 0, 0, 0); // set shape provider IntensityBoxPlotDrawingSupplier shapeSupplier = new IntensityBoxPlotDrawingSupplier(); plot.setDrawingSupplier(shapeSupplier); setTitle(title); setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); setBackground(Color.white); pack(); }
From source file:net.sf.mzmine.modules.visualization.intensityplot.IntensityPlotWindow.java
public IntensityPlotWindow(ParameterSet parameters) { PeakList peakList = parameters.getParameter(IntensityPlotParameters.peakList).getValue() .getMatchingPeakLists()[0];//ww w . ja va2 s . co m String title = "Intensity plot [" + peakList + "]"; String xAxisLabel = parameters.getParameter(IntensityPlotParameters.xAxisValueSource).getValue().toString(); String yAxisLabel = parameters.getParameter(IntensityPlotParameters.yAxisValueSource).getValue().toString(); // create dataset dataset = new IntensityPlotDataset(parameters); // create new JFreeChart logger.finest("Creating new chart instance"); Object xAxisValueSource = parameters.getParameter(IntensityPlotParameters.xAxisValueSource).getValue(); boolean isCombo = (xAxisValueSource instanceof ParameterWrapper) && (!(((ParameterWrapper) xAxisValueSource).getParameter() instanceof DoubleParameter)); if ((xAxisValueSource == IntensityPlotParameters.rawDataFilesOption) || isCombo) { chart = ChartFactory.createLineChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set renderer StatisticalLineAndShapeRenderer renderer = new StatisticalLineAndShapeRenderer(false, true); renderer.setBaseStroke(new BasicStroke(2)); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); // set tooltip generator CategoryToolTipGenerator toolTipGenerator = new IntensityPlotTooltipGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); } else { chart = ChartFactory.createXYLineChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); XYErrorRenderer renderer = new XYErrorRenderer(); renderer.setBaseStroke(new BasicStroke(2)); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); // set tooltip generator XYToolTipGenerator toolTipGenerator = new IntensityPlotTooltipGenerator(); renderer.setBaseToolTipGenerator(toolTipGenerator); } chart.setBackgroundPaint(Color.white); // create chart JPanel ChartPanel chartPanel = new ChartPanel(chart); add(chartPanel, BorderLayout.CENTER); IntensityPlotToolBar toolBar = new IntensityPlotToolBar(this); add(toolBar, BorderLayout.EAST); // disable maximum size (we don't want scaling) chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); // set title properties TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); LegendTitle legend = chart.getLegend(); legend.setItemFont(legendFont); legend.setBorder(0, 0, 0, 0); Plot plot = chart.getPlot(); // set shape provider IntensityPlotDrawingSupplier shapeSupplier = new IntensityPlotDrawingSupplier(); plot.setDrawingSupplier(shapeSupplier); // set y axis properties NumberAxis yAxis; if (plot instanceof CategoryPlot) yAxis = (NumberAxis) ((CategoryPlot) plot).getRangeAxis(); else yAxis = (NumberAxis) ((XYPlot) plot).getRangeAxis(); NumberFormat yAxisFormat = MZmineCore.getConfiguration().getIntensityFormat(); if (parameters.getParameter(IntensityPlotParameters.yAxisValueSource).getValue() == YAxisValueSource.RT) yAxisFormat = MZmineCore.getConfiguration().getRTFormat(); yAxis.setNumberFormatOverride(yAxisFormat); setTitle(title); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBackground(Color.white); // Add the Windows menu JMenuBar menuBar = new JMenuBar(); menuBar.add(new WindowsMenu()); setJMenuBar(menuBar); pack(); // get the window settings parameter ParameterSet paramSet = MZmineCore.getConfiguration().getModuleParameters(IntensityPlotModule.class); WindowSettingsParameter settings = paramSet.getParameter(IntensityPlotParameters.windowSettings); // update the window and listen for changes settings.applySettingsToWindow(this); this.addComponentListener(settings); }
From source file:com.idealista.solrmeter.view.statistic.CacheHistoryPanel.java
/** * Creates the chart of this statistic//from w w w. ja v a2 s . c om * @return */ private Component createChartPanel() { NumberAxis xaxis = new NumberAxis(I18n.get(PREFIX + "time")); NumberAxis yaxis = new NumberAxis(I18n.get(PREFIX + "entries")); plot = new XYPlot(xyDataset, xaxis, yaxis, new XYLineAndShapeRenderer(true, true)); chart = new JFreeChart("notitle", null, plot, true); chart.getLegend().setPosition(RectangleEdge.RIGHT); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(CHART_BORDER); chartPanel.setMinimumDrawHeight(0); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); return chartPanel; }
From source file:org.jfree.chart.demo.ContourPlotDemo2.java
/** * Constructs a new demonstration application. * * @param title the frame title.// w w w.j a v a 2 s . c om */ public ContourPlotDemo2(final String title) { super(title); final JFreeChart chart = createContourPlot(); final ChartPanel panel = new ChartPanel(chart, true, true, true, true, true); panel.setPreferredSize(new java.awt.Dimension(1000, 800)); panel.setMaximumDrawHeight(100000); //stop chartpanel from scaling panel.setMaximumDrawWidth(100000); //stop chartpanel from scaling // panel.setHorizontalZoom(true); // panel.setVerticalZoom(true); panel.setFillZoomRectangle(true); setContentPane(panel); }