Example usage for org.jfree.chart.axis Axis setLabelInsets

List of usage examples for org.jfree.chart.axis Axis setLabelInsets

Introduction

In this page you can find the example usage for org.jfree.chart.axis Axis setLabelInsets.

Prototype

public void setLabelInsets(RectangleInsets insets) 

Source Link

Document

Sets the insets for the axis label, and sends an AxisChangeEvent to all registered listeners.

Usage

From source file:daylightchart.options.chart.AxisOptions.java

/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.//from  w  ww .  ja va2s . c  o m
 *
 * @param axis
 *        the axis.
 */
void setAxisProperties(final Axis axis) {
    axis.setLabel(label);
    if (labelFont != null) {
        axis.setLabelFont(labelFont);
    }
    if (labelPaint != null) {
        axis.setLabelPaint(labelPaint);
    }
    if (labelInsets != null) {
        axis.setLabelInsets(labelInsets);
    }
    //
    axis.setTickMarksVisible(tickMarksVisible);
    axis.setTickLabelsVisible(tickLabelsVisible);
    if (tickLabelFont != null) {
        axis.setTickLabelFont(tickLabelFont);
    }
    if (tickLabelPaint != null) {
        axis.setTickLabelPaint(tickLabelPaint);
    }
    if (tickLabelInsets != null) {
        axis.setTickLabelInsets(tickLabelInsets);
    }
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java

/**
 * Sets the properties of the specified axis to match the properties defined
 * on this panel.//from w ww.j  ava2 s  .  com
 * 
 * @param axis
 *            the axis.
 */
public void setAxisProperties(Axis axis) {
    axis.setLabel(getLabel());
    axis.setLabelFont(getLabelFont());
    axis.setLabelPaint(getLabelPaint());
    axis.setTickMarksVisible(isTickMarksVisible());
    axis.setTickLabelsVisible(isTickLabelsVisible());
    axis.setTickLabelFont(getTickLabelFont());
    axis.setTickLabelPaint(getTickLabelPaint());
    axis.setTickLabelInsets(getTickLabelInsets());
    axis.setLabelInsets(getLabelInsets());
}

From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java

public static void customizeAxis(Axis axis, ChartParams params, String prefix) {

    if (params.get(prefix + ChartParams.AXIS_VISIBLE_SUFIX) != null
            && params.getBoolean(prefix + ChartParams.AXIS_VISIBLE_SUFIX).booleanValue() == false) {
        axis.setVisible(false);// w ww  .j  av a2 s.  co m

    } else {
        if (params.get(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX) != null) {
            if (params.getBoolean(prefix + ChartParams.AXIS_LINE_VISIBLE_SUFFIX).booleanValue()) {
                axis.setAxisLineVisible(true);

                if (params.get(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX) != null) {
                    axis.setAxisLinePaint(params.getColor(prefix + ChartParams.AXIS_LINE_COLOR_SUFFIX));
                }

                if (params.get(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX) != null) {
                    axis.setAxisLineStroke(params.getStroke(prefix + ChartParams.AXIS_LINE_STROKE_SUFFIX));
                }
            } else {
                axis.setAxisLineVisible(false);
            }
        }

        if (params.get(prefix + ChartParams.AXIS_LABEL_SUFFIX) != null) {
            axis.setLabel(params.getString(prefix + ChartParams.AXIS_LABEL_SUFFIX));

            if (params.get(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX) != null) {
                axis.setLabelFont(params.getFont(prefix + ChartParams.AXIS_LABEL_FONT_SUFFIX));
            }

            if (params.get(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX) != null) {
                axis.setLabelPaint(params.getColor(prefix + ChartParams.AXIS_LABEL_COLOR_SUFFIX));
            }

            if (params.get(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX) != null) {
                axis.setLabelInsets(params.getRectangleInsets(prefix + ChartParams.AXIS_LABEL_INSERTS_SUFFIX));
            }
        }

        if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX) != null) {
            if (params.getBoolean(prefix + ChartParams.AXIS_TICK_LABEL_VISIBLE_SUFFIX).booleanValue()) {
                axis.setTickLabelsVisible(true);

                if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX) != null) {
                    axis.setTickLabelFont(params.getFont(prefix + ChartParams.AXIS_TICK_LABEL_FONT_SUFFIX));
                }

                if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX) != null) {
                    axis.setTickLabelPaint(params.getColor(prefix + ChartParams.AXIS_TICK_LABEL_COLOR_SUFFIX));
                }

                if (params.get(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX) != null) {
                    axis.setTickLabelInsets(
                            params.getRectangleInsets(prefix + ChartParams.AXIS_TICK_LABEL_INSERTS_SUFFIX));
                }

            } else {
                axis.setTickLabelsVisible(false);
            }
        }

        if (params.get(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX) != null) {
            if (params.getBoolean(prefix + ChartParams.AXIS_TICK_MARK_VISIBLE_SUFFIX).booleanValue()) {
                axis.setTickMarksVisible(true);

                if (params.get(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX) != null) {
                    axis.setTickMarkInsideLength(params
                            .getFloat(prefix + ChartParams.AXIS_TICK_MARK_INSIDE_LENGTH_SUFFIX).floatValue());
                }

                if (params.get(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX) != null) {
                    axis.setTickMarkOutsideLength(params
                            .getFloat(prefix + ChartParams.AXIS_TICK_MARK_OUTSIDE_LENGTH_SUFFIX).floatValue());
                }

                if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) {
                    axis.setTickMarkPaint(params.getColor(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX));
                }

                if (params.get(prefix + ChartParams.AXIS_TICK_MARK_COLOR_SUFFIX) != null) {
                    axis.setTickMarkStroke(params.getStroke(prefix + ChartParams.AXIS_TICK_MARK_STROKE_SUFFIX));
                }

            } else {
                axis.setTickMarksVisible(false);
            }
        }
    }
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, AxisSettings axisSettings) {
    Boolean axisLabelVisible = axisSettings.getLabelVisible();

    if (axisLabelVisible == null || axisLabelVisible.booleanValue()) {
        //         if(axis.getLabel() == null)
        //            axis.setLabel(axisSettings.getLabel());

        Double labelAngle = axisSettings.getLabelAngle();
        if (labelAngle != null)
            axis.setLabelAngle(labelAngle.doubleValue());

        JRBaseFont font = new JRBaseFont();
        JRFontUtil.copyNonNullOwnProperties(axisSettings.getLabelFont(), font);
        JRFontUtil.copyNonNullOwnProperties(labelFont, font);
        font = new JRBaseFont(getChart(), font);
        axis.setLabelFont(JRFontUtil.getAwtFont(font, getLocale()));

        RectangleInsets labelInsets = axisSettings.getLabelInsets();
        if (labelInsets != null) {
            axis.setLabelInsets(labelInsets);
        }/*ww  w.j a v a 2s  . c  o  m*/
        Paint labelPaint = labelColor != null ? labelColor
                : axisSettings.getLabelPaint() != null ? axisSettings.getLabelPaint().getPaint() : null;
        if (labelPaint != null) {
            axis.setLabelPaint(labelPaint);
        }
    }
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected void setAxisLabel(Axis axis, JRFont labelFont, Paint labelColor, AxisSettings axisSettings) {
    Boolean axisLabelVisible = axisSettings.getLabelVisible();

    if (axisLabelVisible == null || axisLabelVisible) {
        //         if (axis.getLabel() == null)
        //            axis.setLabel(axisSettings.getLabel());

        Double labelAngle = axisSettings.getLabelAngle();
        if (labelAngle != null)
            axis.setLabelAngle(labelAngle);

        JRBaseFont font = new JRBaseFont();
        FontUtil.copyNonNullOwnProperties(axisSettings.getLabelFont(), font);
        FontUtil.copyNonNullOwnProperties(labelFont, font);
        font = new JRBaseFont(getChart(), font);
        axis.setLabelFont(getFontUtil().getAwtFont(font, getLocale()));

        RectangleInsets labelInsets = axisSettings.getLabelInsets();
        if (labelInsets != null) {
            axis.setLabelInsets(labelInsets);
        }/*from ww  w  . j a v a  2s . co  m*/
        Paint labelPaint = labelColor != null ? labelColor
                : axisSettings.getLabelPaint() != null ? axisSettings.getLabelPaint().getPaint() : null;
        if (labelPaint != null) {
            axis.setLabelPaint(labelPaint);
        }
    }
}

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 w  w  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);
        }
    }
}

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);
        }// w ww  . j  a  v a  2s . c o  m
        Paint labelPaint = labelColor != null ? labelColor
                : (Paint) getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_PAINT);
        if (labelPaint != null) {
            axis.setLabelPaint(labelPaint);
        }
    }
}