Java Code Examples for org.jfree.chart.renderer.xy.XYItemRenderer#setBaseItemLabelFont()
The following examples show how to use
org.jfree.chart.renderer.xy.XYItemRenderer#setBaseItemLabelFont() .
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: StandardChartTheme.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { if (renderer == null) { throw new IllegalArgumentException("Null 'renderer' argument."); } if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 2
Source File: StandardChartTheme.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 3
Source File: StandardChartTheme.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 4
Source File: StandardChartTheme.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 5
Source File: StandardChartTheme.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 6
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 7
Source File: StandardChartTheme.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies the settings of this theme to the specified renderer. * * @param renderer the renderer (<code>null</code> not permitted). */ protected void applyToXYItemRenderer(XYItemRenderer renderer) { ParamChecks.nullNotPermitted(renderer, "renderer"); if (renderer instanceof AbstractRenderer) { applyToAbstractRenderer((AbstractRenderer) renderer); } renderer.setBaseItemLabelFont(this.regularFont); renderer.setBaseItemLabelPaint(this.itemLabelPaint); if (renderer instanceof XYBarRenderer) { XYBarRenderer br = (XYBarRenderer) renderer; br.setBarPainter(this.xyBarPainter); br.setShadowVisible(this.shadowVisible); } }
Example 8
Source File: TSNEDemo.java From COMP6237 with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Component getComponent(int width, int height) throws IOException { final JPanel base = new JPanel(); base.setOpaque(false); base.setPreferredSize(new Dimension(width, height)); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false); final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) { private static final long serialVersionUID = 1L; @Override public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) { return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT); } }; final Font font = Font.decode("Helvetica Neue-22"); renderer.setBaseItemLabelFont(font); chart.getXYPlot().setRenderer(renderer); // chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5) chart.getXYPlot().getDomainAxis().setTickLabelFont(font); // chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1)) // chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5) chart.getXYPlot().getRangeAxis().setTickLabelFont(font); // chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1)) chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() { private static final long serialVersionUID = 1L; @Override public String generateLabel(XYDataset ds, int series, int item) { return ((Dataset) ds).getLabel(series, item); }; }); chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true); chartPanel = new ChartPanel(chart); chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255)); chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE); chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY); chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY); chartPanel.setSize(width, height - 50); chartPanel.setPreferredSize(chartPanel.getSize()); base.add(chartPanel); final JPanel controls = new JPanel(); controls.setPreferredSize(new Dimension(width, 50)); controls.setMaximumSize(new Dimension(width, 50)); controls.setSize(new Dimension(width, 50)); controls.add(new JSeparator(SwingConstants.VERTICAL)); runBtn = new JButton("Run t-SNE"); runBtn.setActionCommand("button.run"); runBtn.addActionListener(this); controls.add(runBtn); controls.add(new JSeparator(SwingConstants.VERTICAL)); cnclBtn = new JButton("Cancel"); cnclBtn.setEnabled(false); cnclBtn.setActionCommand("button.cancel"); cnclBtn.addActionListener(this); controls.add(cnclBtn); base.add(controls); controls.add(new JSeparator(SwingConstants.VERTICAL)); iterLabel = new JLabel(" "); final Dimension size = iterLabel.getPreferredSize(); iterLabel.setMinimumSize(size); iterLabel.setPreferredSize(size); controls.add(iterLabel); updateImage(); return base; }
Example 9
Source File: MDSDemo.java From COMP6237 with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Component getComponent(int width, int height) throws IOException { final JPanel base = new JPanel(); base.setOpaque(false); base.setPreferredSize(new Dimension(width, height)); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false); final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) { private static final long serialVersionUID = 1L; @Override public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) { return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT); } }; final Font font = Font.decode("Helvetica Neue-22"); renderer.setBaseItemLabelFont(font); chart.getXYPlot().setRenderer(renderer); // chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5) chart.getXYPlot().getDomainAxis().setTickLabelFont(font); // chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1)) // chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5) chart.getXYPlot().getRangeAxis().setTickLabelFont(font); // chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1)) chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() { private static final long serialVersionUID = 1L; @Override public String generateLabel(XYDataset ds, int series, int item) { return ((Dataset) ds).getLabel(series, item); }; }); chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true); chartPanel = new ChartPanel(chart); chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255)); chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE); chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY); chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY); chartPanel.setSize(width, height - 50); chartPanel.setPreferredSize(chartPanel.getSize()); base.add(chartPanel); final JPanel controls = new JPanel(); controls.setPreferredSize(new Dimension(width, 50)); controls.setMaximumSize(new Dimension(width, 50)); controls.setSize(new Dimension(width, 50)); controls.add(new JSeparator(SwingConstants.VERTICAL)); controls.add(new JLabel("Distance:")); distCombo = new JComboBox<String>(); distCombo.addItem("Euclidean"); distCombo.addItem("1-Pearson"); distCombo.addItem("1-Cosine"); controls.add(distCombo); controls.add(new JSeparator(SwingConstants.VERTICAL)); runBtn = new JButton("Run MDS"); runBtn.setActionCommand("button.run"); runBtn.addActionListener(this); controls.add(runBtn); controls.add(new JSeparator(SwingConstants.VERTICAL)); cnclBtn = new JButton("Cancel"); cnclBtn.setEnabled(false); cnclBtn.setActionCommand("button.cancel"); cnclBtn.addActionListener(this); controls.add(cnclBtn); base.add(controls); controls.add(new JSeparator(SwingConstants.VERTICAL)); iterLabel = new JLabel(" "); final Dimension size = iterLabel.getPreferredSize(); iterLabel.setMinimumSize(size); iterLabel.setPreferredSize(size); controls.add(iterLabel); updateImage(); return base; }