org.jfree.chart.block.BlockBorder Java Examples
The following examples show how to use
org.jfree.chart.block.BlockBorder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BarChartDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #2
Source File: BarChartFXDemo1.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #3
Source File: BarChartDemo1.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #4
Source File: BarChartDemo1.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #5
Source File: BarChartFXDemo1.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #6
Source File: BarChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #7
Source File: ROCChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
public void paintDeviationChart(Graphics graphics, int width, int height) { prepareData(); JFreeChart chart = createChart(this.dataset); // set the background color for the chart... chart.setBackgroundPaint(Color.white); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); } Rectangle2D drawRect = new Rectangle2D.Double(0, 0, width, height); chart.draw((Graphics2D) graphics, drawRect); }
Example #8
Source File: BarChartFXDemo1.java From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set transparent background paint, so the background color of the parent is used // java.awt.Color transparent = new java.awt.Color(1.0f, 1.0f, 1.0f, 0f); // chart.setBackgroundPaint(transparent); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #9
Source File: BarChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #10
Source File: BarChartDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #11
Source File: BarChartFXDemo1.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #12
Source File: BarChartDemo1.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #13
Source File: BarChartFXDemo1.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #14
Source File: BarChartDemo1.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #15
Source File: CompositeTitleTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // frame t1.setFrame(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setFrame(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); }
Example #16
Source File: CompositeTitleTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // border t1.setBorder(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setBorder(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #17
Source File: CompositeTitleTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // border t1.setBorder(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setBorder(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #18
Source File: CompositeTitleTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // frame t1.setFrame(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setFrame(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #19
Source File: JFreeChartPlotEngine.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D. * Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same * {@link DimensionConfig} s. */ private List<LegendTitle> createLegendTitles() { List<LegendTitle> legendTitles = new LinkedList<LegendTitle>(); LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration(); LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2)); legendTitle.setItemPaint(legendConfiguration.getLegendFontColor()); RectangleEdge position = legendConfiguration.getLegendPosition().getPosition(); if (position == null) { return legendTitles; } legendTitle.setPosition(position); if (legendConfiguration.isShowLegendFrame()) { legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor())); } ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor()); wrapper.add(legendTitle.getItemContainer()); wrapper.setPadding(3, 3, 3, 3); legendTitle.setWrapper(wrapper); legendTitles.add(legendTitle); return legendTitles; }
Example #20
Source File: SpectrumTopComponent.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private void setPlotMessage(String messageText) { chart.getXYPlot().clearAnnotations(); TextTitle tt = new TextTitle(messageText); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 50)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation message = new XYTitleAnnotation(0.5, 0.5, tt, RectangleAnchor.CENTER); chart.getXYPlot().addAnnotation(message); }
Example #21
Source File: CompositeTitleTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // border t1.setBorder(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setBorder(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #22
Source File: CompositeTitleTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // border t1.setBorder(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setBorder(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #23
Source File: TICPanel.java From PDV with GNU General Public License v3.0 | 5 votes |
/** * Update panel * @param nameToKeyToRtAndInt File name to spectrum key to RT and intensity * @param mode Mode */ public void updatePanel(HashMap<String, HashMap<String, ArrayList<float[]>>> nameToKeyToRtAndInt, Integer mode, Integer topNum){ XYDataset xyDataset = creatMultiXYDataset(nameToKeyToRtAndInt, mode, topNum); JFreeChart chart = ChartFactory.createXYLineChart("TIC","Elution Time","Intensity (10^" + (topNum.toString().length() - 1) +")", xyDataset, PlotOrientation.VERTICAL,true,false,false); ChartUtils.setAntiAlias(chart); ChartUtils.setLineRender(chart.getXYPlot()); chart.getLegend().setFrame(new BlockBorder(Color.WHITE)); viewJPanel.removeAll(); chartPanel = new LineChart(msDataDisplay, chart); GroupLayout viewJPanelLayout = new GroupLayout(viewJPanel); viewJPanel.setLayout(viewJPanelLayout); viewJPanelLayout.setHorizontalGroup( viewJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(viewJPanelLayout.createSequentialGroup() .addComponent(chartPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ) ); viewJPanelLayout.setVerticalGroup( viewJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(viewJPanelLayout.createSequentialGroup() .addComponent(chartPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ) ); viewJPanel.revalidate(); viewJPanel.repaint(); }
Example #24
Source File: TICPanel.java From PDV with GNU General Public License v3.0 | 5 votes |
/** * Process data * @param mode Mode */ private void processData(Integer mode, Integer topNum){ XYDataset xyDataset = creatXYDataset(keyToRtAndInt, mode, topNum); JFreeChart chart = ChartFactory.createXYLineChart("TIC","Elution Time","Intensity (10^" + (topNum.toString().length() - 1) + ")", xyDataset, PlotOrientation.VERTICAL,true,false,false); ChartUtils.setAntiAlias(chart); ChartUtils.setLineRender(chart.getXYPlot()); chart.getLegend().setFrame(new BlockBorder(Color.WHITE)); viewJPanel.removeAll(); ChartPanel chartPanel = new LineChart(msDataDisplay, chart); GroupLayout viewJPanelLayout = new GroupLayout(viewJPanel); viewJPanel.setLayout(viewJPanelLayout); viewJPanelLayout.setHorizontalGroup( viewJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(viewJPanelLayout.createSequentialGroup() .addComponent(chartPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ) ); viewJPanelLayout.setVerticalGroup( viewJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(viewJPanelLayout.createSequentialGroup() .addComponent(chartPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ) ); viewJPanel.revalidate(); viewJPanel.repaint(); }
Example #25
Source File: ChartImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
public void drawLegend(JFreeChart chart){ //remove ipotetical other legend chart.removeLegend(); BlockContainer wrapper = new BlockContainer(new BorderArrangement()); wrapper.setFrame(new BlockBorder(1.0, 1.0, 1.0, 1.0)); /*LabelBlock titleBlock = new LabelBlock("Legend Items:", new Font("SansSerif", Font.BOLD, 12)); titleBlock.setPadding(5, 5, 5, 5); wrapper.add(titleBlock, RectangleEdge.TOP);*/ LegendTitle legend = new LegendTitle(chart.getPlot()); BlockContainer items = legend.getItemContainer(); if(styleLegend!=null && styleLegend.getFont()!=null){ legend.setItemFont(new Font(styleLegend.getFontName(), Font.BOLD, styleLegend.getSize())); } items.setPadding(2, 5, 5, 2); wrapper.add(items); legend.setWrapper(wrapper); if(legendPosition.equalsIgnoreCase("bottom")) legend.setPosition(RectangleEdge.BOTTOM); else if(legendPosition.equalsIgnoreCase("left")) legend.setPosition(RectangleEdge.LEFT); else if(legendPosition.equalsIgnoreCase("right")) legend.setPosition(RectangleEdge.RIGHT); else if(legendPosition.equalsIgnoreCase("top")) legend.setPosition(RectangleEdge.TOP); else legend.setPosition(RectangleEdge.BOTTOM); legend.setHorizontalAlignment(HorizontalAlignment.CENTER); chart.addSubtitle(legend); }
Example #26
Source File: CompositeTitleTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ @Test public void testEquals() { CompositeTitle t1 = new CompositeTitle(new BlockContainer()); CompositeTitle t2 = new CompositeTitle(new BlockContainer()); assertEquals(t1, t2); assertEquals(t2, t1); // margin t1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // border t1.setBorder(new BlockBorder(Color.red)); assertFalse(t1.equals(t2)); t2.setBorder(new BlockBorder(Color.red)); assertTrue(t1.equals(t2)); // padding t1.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(t1.equals(t2)); t2.setPadding(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(t1.equals(t2)); // contained titles t1.getContainer().add(new TextTitle("T1")); assertFalse(t1.equals(t2)); t2.getContainer().add(new TextTitle("T1")); assertTrue(t1.equals(t2)); t1.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertFalse(t1.equals(t2)); t2.setBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); assertTrue(t1.equals(t2)); }
Example #27
Source File: TimeSeriesChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Creates a chart. * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart( "International Coffee Organisation : Coffee Prices", // title null, // x-axis label "US cents/lb", // y-axis label dataset); String fontName = "Palatino"; chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18)); chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf", new Font(fontName, Font.PLAIN, 14))); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainPannable(true); plot.setRangePannable(true); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14)); plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12)); chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14)); chart.getLegend().setFrame(BlockBorder.NONE); chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(false); renderer.setDrawSeriesLineAsPath(true); // set the default stroke for all series renderer.setAutoPopulateSeriesStroke(false); renderer.setBaseStroke(new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL), false); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, new Color(24, 123, 58)); renderer.setSeriesPaint(2, new Color(149, 201, 136)); renderer.setSeriesPaint(3, new Color(1, 62, 29)); renderer.setSeriesPaint(4, new Color(81, 176, 86)); renderer.setSeriesPaint(5, new Color(0, 55, 122)); renderer.setSeriesPaint(6, new Color(0, 92, 165)); } return chart; }
Example #28
Source File: JFreeChart.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * Creates a new chart with the given title and plot. The * <code>createLegend</code> argument specifies whether or not a legend * should be added to the chart. * <br><br> * Note that the {@link ChartFactory} class contains a range * of static methods that will return ready-made charts, and often this * is a more convenient way to create charts than using this constructor. * * @param title the chart title (<code>null</code> permitted). * @param titleFont the font for displaying the chart title * (<code>null</code> permitted). * @param plot controller of the visual representation of the data * (<code>null</code> not permitted). * @param createLegend a flag indicating whether or not a legend should * be created for the chart. */ public JFreeChart(String title, Font titleFont, Plot plot, boolean createLegend) { if (plot == null) { throw new NullPointerException("Null 'plot' argument."); } // create storage for listeners... this.progressListeners = new EventListenerList(); this.changeListeners = new EventListenerList(); this.notify = true; // default is to notify listeners when the // chart changes this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); this.borderVisible = false; this.borderStroke = new BasicStroke(1.0f); this.borderPaint = Color.black; this.padding = RectangleInsets.ZERO_INSETS; this.plot = plot; plot.addChangeListener(this); this.subtitles = new ArrayList(); // create a legend, if requested... if (createLegend) { LegendTitle legend = new LegendTitle(this.plot); legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); legend.setBorder(new BlockBorder()); legend.setBackgroundPaint(Color.white); legend.setPosition(RectangleEdge.BOTTOM); this.subtitles.add(legend); } // add the chart title, if one has been specified... if (title != null) { if (titleFont == null) { titleFont = DEFAULT_TITLE_FONT; } this.title = new TextTitle(title, titleFont); this.title.addChangeListener(this); } this.backgroundPaint = DEFAULT_BACKGROUND_PAINT; this.backgroundImage = DEFAULT_BACKGROUND_IMAGE; this.backgroundImageAlignment = DEFAULT_BACKGROUND_IMAGE_ALIGNMENT; this.backgroundImageAlpha = DEFAULT_BACKGROUND_IMAGE_ALPHA; }
Example #29
Source File: ScatterPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void computeCoefficientOfDetermination() { int numberOfItems = scatterpointsDataset.getSeries(0).getItemCount(); double arithmeticMeanOfX = 0; //arithmetic mean of X double arithmeticMeanOfY = 0; //arithmetic mean of Y double varX = 0; //variance of X double varY = 0; //variance of Y double coVarXY = 0; //covariance of X and Y; //compute arithmetic means for (int i = 0; i < numberOfItems; i++) { arithmeticMeanOfX += scatterpointsDataset.getXValue(0, i); arithmeticMeanOfY += scatterpointsDataset.getYValue(0, i); } arithmeticMeanOfX /= numberOfItems; arithmeticMeanOfY /= numberOfItems; //compute variances and covariance for (int i = 0; i < numberOfItems; i++) { varX += Math.pow(scatterpointsDataset.getXValue(0, i) - arithmeticMeanOfX, 2); varY += Math.pow(scatterpointsDataset.getYValue(0, i) - arithmeticMeanOfY, 2); coVarXY += (scatterpointsDataset.getXValue(0, i) - arithmeticMeanOfX) * (scatterpointsDataset.getYValue(0, i) - arithmeticMeanOfY); } //computation of coefficient of determination double r2 = Math.pow(coVarXY, 2) / (varX * varY); r2 = MathUtils.round(r2, Math.pow(10.0, 5)); final double[] coefficients = Regression.getOLSRegression(scatterpointsDataset, 0); final double intercept = coefficients[0]; final double slope = coefficients[1]; final String linearEquation; if (intercept >= 0) { linearEquation = "y = " + (float) slope + "x + " + (float) intercept; } else { linearEquation = "y = " + (float) slope + "x - " + Math.abs((float) intercept); } TextTitle tt = new TextTitle(linearEquation + "\nRĀ² = " + r2); tt.setTextAlignment(HorizontalAlignment.RIGHT); tt.setFont(chart.getLegend().getItemFont()); tt.setBackgroundPaint(new Color(200, 200, 255, 100)); tt.setFrame(new BlockBorder(Color.white)); tt.setPosition(RectangleEdge.BOTTOM); r2Annotation = new XYTitleAnnotation(0.98, 0.02, tt, RectangleAnchor.BOTTOM_RIGHT); r2Annotation.setMaxWidth(0.48); getPlot().addAnnotation(r2Annotation); }
Example #30
Source File: AbstractBlockTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Confirm that the equals() method can distinguish all the required fields. */ public void testEquals() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); EmptyBlock b2 = new EmptyBlock(1.0, 2.0); assertTrue(b1.equals(b2)); assertTrue(b2.equals(b2)); b1.setID("Test"); assertFalse(b1.equals(b2)); b2.setID("Test"); assertTrue(b1.equals(b2)); b1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(b1.equals(b2)); b2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertTrue(b1.equals(b2)); b1.setFrame(new BlockBorder(Color.red)); assertFalse(b1.equals(b2)); b2.setFrame(new BlockBorder(Color.red)); assertTrue(b1.equals(b2)); b1.setPadding(new RectangleInsets(2.0, 4.0, 6.0, 8.0)); assertFalse(b1.equals(b2)); b2.setPadding(new RectangleInsets(2.0, 4.0, 6.0, 8.0)); assertTrue(b1.equals(b2)); b1.setWidth(1.23); assertFalse(b1.equals(b2)); b2.setWidth(1.23); assertTrue(b1.equals(b2)); b1.setHeight(4.56); assertFalse(b1.equals(b2)); b2.setHeight(4.56); assertTrue(b1.equals(b2)); b1.setBounds(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(b1.equals(b2)); b2.setBounds(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertTrue(b1.equals(b2)); b1 = new EmptyBlock(1.1, 2.0); assertFalse(b1.equals(b2)); b2 = new EmptyBlock(1.1, 2.0); assertTrue(b1.equals(b2)); b1 = new EmptyBlock(1.1, 2.2); assertFalse(b1.equals(b2)); b2 = new EmptyBlock(1.1, 2.2); assertTrue(b1.equals(b2)); }