List of usage examples for org.jfree.chart.axis Axis getLabel
public String getLabel()
From source file:com.bdaum.zoom.report.internal.wizards.ReportComponent.java
private static void saveAxisProperties(Axis axis, String prefix, Map<String, Object> properties) { properties.put(prefix + AXISLABEL, axis.getLabel()); properties.put(prefix + AXISLABELFONT, axis.getLabelFont()); properties.put(prefix + AXISLABELPAINT, axis.getLabelPaint()); properties.put(prefix + TICKMARKSVISIBLE, axis.isTickMarksVisible()); properties.put(prefix + TICKLABELSVISIBLE, axis.isTickLabelsVisible()); properties.put(prefix + TICKLABELFONT, axis.getTickLabelFont()); properties.put(prefix + TICKLABELPAINT, axis.getLabelPaint()); }
From source file:net.sf.dynamicreports.test.jasper.chart.XyAreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//from w w w . j av a 2 s . c o m JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getXYPlot().getDomainAxis(); XYPlot plot = chart.getXYPlot(); Assert.assertEquals("renderer", XYAreaRenderer.class, plot.getRenderer().getClass()); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart2", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:net.sf.dynamicreports.test.jasper.chart.AreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);//w w w . j a v a 2s . c om JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", AreaRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart2", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:net.sf.dynamicreports.test.jasper.chart.StackedAreaChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from www .j a va 2s .c o m*/ JFreeChart chart = getChart("summary.chart1", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", StackedAreaRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart2", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
From source file:org.jfree.experimental.chart.swt.editor.SWTAxisEditor.java
/** * Standard constructor: builds a composite for displaying/editing * the properties of the specified axis. * * @param parent The parent composite.//from ww w. j ava2 s . c om * @param style The SWT style of the SwtAxisEditor. * @param axis the axis whose properties are to be displayed/edited * in the composite. */ public SWTAxisEditor(Composite parent, int style, Axis axis) { super(parent, style); this.labelFont = SWTUtils.toSwtFontData(getDisplay(), axis.getLabelFont(), true); this.labelPaintColor = SWTUtils.toSwtColor(getDisplay(), axis.getLabelPaint()); this.tickLabelFont = SWTUtils.toSwtFontData(getDisplay(), axis.getTickLabelFont(), true); this.tickLabelPaintColor = SWTUtils.toSwtColor(getDisplay(), axis.getTickLabelPaint()); FillLayout layout = new FillLayout(SWT.VERTICAL); layout.marginHeight = layout.marginWidth = 4; this.setLayout(layout); Group general = new Group(this, SWT.NONE); general.setLayout(new GridLayout(3, false)); general.setText(localizationResources.getString("General")); // row 1 new Label(general, SWT.NONE).setText(localizationResources.getString("Label")); this.label = new Text(general, SWT.BORDER); if (axis.getLabel() != null) { this.label.setText(axis.getLabel()); } this.label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(general, SWT.NONE).setText(""); //empty cell // row 2 new Label(general, SWT.NONE).setText(localizationResources.getString("Font")); this.labelFontField = new Text(general, SWT.BORDER); this.labelFontField.setText(this.labelFont.toString()); this.labelFontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button selectFontButton = new Button(general, SWT.PUSH); selectFontButton.setText(localizationResources.getString("Select...")); selectFontButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString("Font_Selection")); dlg.setFontList(new FontData[] { SWTAxisEditor.this.labelFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTAxisEditor.this.font != null) { SWTAxisEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTAxisEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList()); //label.setFont( font ); SWTAxisEditor.this.labelFontField.setText(SWTAxisEditor.this.font.getFontData()[0].toString()); SWTAxisEditor.this.labelFont = SWTAxisEditor.this.font.getFontData()[0]; } } }); // row 3 new Label(general, SWT.NONE).setText(localizationResources.getString("Paint")); // Use a colored text field to show the color final SWTPaintCanvas colorCanvas = new SWTPaintCanvas(general, SWT.NONE, this.labelPaintColor); GridData canvasGridData = new GridData(SWT.FILL, SWT.CENTER, true, false); canvasGridData.heightHint = 20; colorCanvas.setLayoutData(canvasGridData); Button selectColorButton = new Button(general, SWT.PUSH); selectColorButton.setText(localizationResources.getString("Select...")); selectColorButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog ColorDialog dlg = new ColorDialog(getShell()); dlg.setText(localizationResources.getString("Title_Color")); dlg.setRGB(SWTAxisEditor.this.labelPaintColor.getRGB()); RGB rgb = dlg.open(); if (rgb != null) { // create the new color and set it to the // SwtPaintCanvas SWTAxisEditor.this.labelPaintColor = new Color(getDisplay(), rgb); colorCanvas.setColor(SWTAxisEditor.this.labelPaintColor); } } }); Group other = new Group(this, SWT.NONE); FillLayout tabLayout = new FillLayout(); tabLayout.marginHeight = tabLayout.marginWidth = 4; other.setLayout(tabLayout); other.setText(localizationResources.getString("Other")); this.otherTabs = new TabFolder(other, SWT.NONE); TabItem item1 = new TabItem(this.otherTabs, SWT.NONE); item1.setText(" " + localizationResources.getString("Ticks") + " "); Composite ticks = new Composite(this.otherTabs, SWT.NONE); ticks.setLayout(new GridLayout(3, false)); this.showTickLabelsCheckBox = new Button(ticks, SWT.CHECK); this.showTickLabelsCheckBox.setText(localizationResources.getString("Show_tick_labels")); this.showTickLabelsCheckBox.setSelection(axis.isTickLabelsVisible()); this.showTickLabelsCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); new Label(ticks, SWT.NONE).setText(localizationResources.getString("Tick_label_font")); this.tickLabelFontField = new Text(ticks, SWT.BORDER); this.tickLabelFontField.setText(this.tickLabelFont.toString()); //tickLabelFontField.setFont(SwtUtils.toSwtFontData(getDisplay(), // axis.getTickLabelFont())); this.tickLabelFontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button selectTickLabelFontButton = new Button(ticks, SWT.PUSH); selectTickLabelFontButton.setText(localizationResources.getString("Select...")); selectTickLabelFontButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the font-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString("Font_Selection")); dlg.setFontList(new FontData[] { SWTAxisEditor.this.tickLabelFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTAxisEditor.this.font != null) { SWTAxisEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTAxisEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList()); //tickLabelFontField.setFont(font); SWTAxisEditor.this.tickLabelFontField .setText(SWTAxisEditor.this.font.getFontData()[0].toString()); SWTAxisEditor.this.tickLabelFont = SWTAxisEditor.this.font.getFontData()[0]; } } }); this.showTickMarksCheckBox = new Button(ticks, SWT.CHECK); this.showTickMarksCheckBox.setText(localizationResources.getString("Show_tick_marks")); this.showTickMarksCheckBox.setSelection(axis.isTickMarksVisible()); this.showTickMarksCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); item1.setControl(ticks); }
From source file:com.rcp.wbw.demo.editor.SWTAxisEditor.java
/** * Standard constructor: builds a composite for displaying/editing * the properties of the specified axis. * /* ww w . j a va 2 s . c o m*/ * @param parent * The parent composite. * @param style * The SWT style of the SwtAxisEditor. * @param axis * the axis whose properties are to be displayed/edited * in the composite. */ public SWTAxisEditor(Composite parent, int style, Axis axis) { super(parent, style); this.labelFont = SWTUtils.toSwtFontData(getDisplay(), axis.getLabelFont(), true); this.labelPaintColor = SWTUtils.toSwtColor(getDisplay(), axis.getLabelPaint()); this.tickLabelFont = SWTUtils.toSwtFontData(getDisplay(), axis.getTickLabelFont(), true); this.tickLabelPaintColor = SWTUtils.toSwtColor(getDisplay(), axis.getTickLabelPaint()); FillLayout layout = new FillLayout(SWT.VERTICAL); layout.marginHeight = layout.marginWidth = 4; setLayout(layout); Group general = new Group(this, SWT.NONE); general.setLayout(new GridLayout(3, false)); general.setText(localizationResources.getString("General")); // row 1 new Label(general, SWT.NONE).setText(localizationResources.getString("Label")); this.label = new Text(general, SWT.BORDER); if (axis.getLabel() != null) { this.label.setText(axis.getLabel()); } this.label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); new Label(general, SWT.NONE).setText(""); // empty cell // row 2 new Label(general, SWT.NONE).setText(localizationResources.getString("Font")); this.labelFontField = new Text(general, SWT.BORDER); this.labelFontField.setText(this.labelFont.toString()); this.labelFontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button selectFontButton = new Button(general, SWT.PUSH); selectFontButton.setText(localizationResources.getString("Select...")); selectFontButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString("Font_Selection")); dlg.setFontList(new FontData[] { SWTAxisEditor.this.labelFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTAxisEditor.this.font != null) { SWTAxisEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTAxisEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList()); // label.setFont(font); SWTAxisEditor.this.labelFontField.setText(SWTAxisEditor.this.font.getFontData()[0].toString()); SWTAxisEditor.this.labelFont = SWTAxisEditor.this.font.getFontData()[0]; } } }); // row 3 new Label(general, SWT.NONE).setText(localizationResources.getString("Paint")); // Use a colored text field to show the color final SWTPaintCanvas colorCanvas = new SWTPaintCanvas(general, SWT.NONE, this.labelPaintColor); GridData canvasGridData = new GridData(SWT.FILL, SWT.CENTER, true, false); canvasGridData.heightHint = 20; colorCanvas.setLayoutData(canvasGridData); Button selectColorButton = new Button(general, SWT.PUSH); selectColorButton.setText(localizationResources.getString("Select...")); selectColorButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the color-change dialog ColorDialog dlg = new ColorDialog(getShell()); dlg.setText(localizationResources.getString("Title_Color")); dlg.setRGB(SWTAxisEditor.this.labelPaintColor.getRGB()); RGB rgb = dlg.open(); if (rgb != null) { // create the new color and set it to the // SwtPaintCanvas SWTAxisEditor.this.labelPaintColor = new Color(getDisplay(), rgb); colorCanvas.setColor(SWTAxisEditor.this.labelPaintColor); } } }); Group other = new Group(this, SWT.NONE); FillLayout tabLayout = new FillLayout(); tabLayout.marginHeight = tabLayout.marginWidth = 4; other.setLayout(tabLayout); other.setText(localizationResources.getString("Other")); this.otherTabs = new TabFolder(other, SWT.NONE); TabItem item1 = new TabItem(this.otherTabs, SWT.NONE); item1.setText(" " + localizationResources.getString("Ticks") + " "); Composite ticks = new Composite(this.otherTabs, SWT.NONE); ticks.setLayout(new GridLayout(3, false)); this.showTickLabelsCheckBox = new Button(ticks, SWT.CHECK); this.showTickLabelsCheckBox.setText(localizationResources.getString("Show_tick_labels")); this.showTickLabelsCheckBox.setSelection(axis.isTickLabelsVisible()); this.showTickLabelsCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); new Label(ticks, SWT.NONE).setText(localizationResources.getString("Tick_label_font")); this.tickLabelFontField = new Text(ticks, SWT.BORDER); this.tickLabelFontField.setText(this.tickLabelFont.toString()); // tickLabelFontField.setFont(SwtUtils.toSwtFontData(getDisplay(), // axis.getTickLabelFont())); this.tickLabelFontField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); Button selectTickLabelFontButton = new Button(ticks, SWT.PUSH); selectTickLabelFontButton.setText(localizationResources.getString("Select...")); selectTickLabelFontButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { // Create the font-change dialog FontDialog dlg = new FontDialog(getShell()); dlg.setText(localizationResources.getString("Font_Selection")); dlg.setFontList(new FontData[] { SWTAxisEditor.this.tickLabelFont }); if (dlg.open() != null) { // Dispose of any fonts we have created if (SWTAxisEditor.this.font != null) { SWTAxisEditor.this.font.dispose(); } // Create the new font and set it into the title // label SWTAxisEditor.this.font = new Font(getShell().getDisplay(), dlg.getFontList()); // tickLabelFontField.setFont(font); SWTAxisEditor.this.tickLabelFontField .setText(SWTAxisEditor.this.font.getFontData()[0].toString()); SWTAxisEditor.this.tickLabelFont = SWTAxisEditor.this.font.getFontData()[0]; } } }); this.showTickMarksCheckBox = new Button(ticks, SWT.CHECK); this.showTickMarksCheckBox.setText(localizationResources.getString("Show_tick_marks")); this.showTickMarksCheckBox.setSelection(axis.isTickMarksVisible()); this.showTickMarksCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); item1.setControl(ticks); }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified axis.//from www . jav a 2 s . c o m * * @param axis * the axis whose properties are to be displayed/edited in the * panel. */ public DefaultAxisEditor(Axis axis) { this.labelFont = axis.getLabelFont(); this.labelPaintSample = new PaintSample(axis.getLabelPaint()); this.tickLabelFont = axis.getTickLabelFont(); this.tickLabelPaintSample = new PaintSample(axis.getTickLabelPaint()); // Insets values this.tickLabelInsets = axis.getTickLabelInsets(); this.labelInsets = axis.getLabelInsets(); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(5)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Label"))); this.label = new JTextField(axis.getLabel()); interior.add(this.label); interior.add(new JPanel()); interior.add(new JLabel(localizationResources.getString("Font"))); this.labelFontField = new FontDisplayField(this.labelFont); interior.add(this.labelFontField); JButton b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelFont"); b.addActionListener(this); interior.add(b); interior.add(new JLabel(localizationResources.getString("Paint"))); interior.add(this.labelPaintSample); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelPaint"); b.addActionListener(this); interior.add(b); general.add(interior); add(general, BorderLayout.NORTH); this.slot1 = new JPanel(new BorderLayout()); JPanel other = new JPanel(new BorderLayout()); other.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("Other"))); this.otherTabs = new JTabbedPane(); this.otherTabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JPanel ticks = new JPanel(new LCBLayout(3)); ticks.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.showTickLabelsCheckBox = new JCheckBox(localizationResources.getString("Show_tick_labels"), axis.isTickLabelsVisible()); ticks.add(this.showTickLabelsCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); ticks.add(new JLabel(localizationResources.getString("Tick_label_font"))); this.tickLabelFontField = new FontDisplayField(this.tickLabelFont); ticks.add(this.tickLabelFontField); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectTickLabelFont"); b.addActionListener(this); ticks.add(b); this.showTickMarksCheckBox = new JCheckBox(localizationResources.getString("Show_tick_marks"), axis.isTickMarksVisible()); ticks.add(this.showTickMarksCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); this.otherTabs.add(localizationResources.getString("Ticks"), ticks); other.add(this.otherTabs); this.slot1.add(other); this.slot2 = new JPanel(new BorderLayout()); this.slot2.add(this.slot1, BorderLayout.NORTH); add(this.slot2); }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, Integer baseFontSize) { Boolean defaultAxisLabelVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_VISIBLE); if (defaultAxisLabelVisible != null && defaultAxisLabelVisible.booleanValue()) { if (axis.getLabel() == null) axis.setLabel((String) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL)); Double defaultLabelAngle = (Double) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_ANGLE); if (defaultLabelAngle != null) axis.setLabelAngle(defaultLabelAngle.doubleValue()); Font themeLabelFont = getFont( (JRFont) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_FONT), labelFont, baseFontSize); axis.setLabelFont(themeLabelFont); RectangleInsets defaultLabelInsets = (RectangleInsets) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_INSETS); if (defaultLabelInsets != null) { axis.setLabelInsets(defaultLabelInsets); }//from ww w.j av a2s . co m Paint labelPaint = labelColor != null ? labelColor : (Paint) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_PAINT); if (labelPaint != null) { axis.setLabelPaint(labelPaint); } } }
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, Integer baseFontSize) { Boolean defaultAxisLabelVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_VISIBLE); if (defaultAxisLabelVisible != null && defaultAxisLabelVisible) { if (axis.getLabel() == null) axis.setLabel((String) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL)); Double defaultLabelAngle = (Double) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_ANGLE); if (defaultLabelAngle != null) axis.setLabelAngle(defaultLabelAngle); Font themeLabelFont = getFont( (JRFont) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_FONT), labelFont, baseFontSize); axis.setLabelFont(themeLabelFont); RectangleInsets defaultLabelInsets = (RectangleInsets) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_INSETS); if (defaultLabelInsets != null) { axis.setLabelInsets(defaultLabelInsets); }/*from ww w. ja va 2 s. co m*/ Paint labelPaint = labelColor != null ? labelColor : (Paint) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_PAINT); if (labelPaint != null) { axis.setLabelPaint(labelPaint); } } }