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

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

Introduction

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

Prototype

public void setTickMarkStroke(Stroke stroke) 

Source Link

Document

Sets the stroke used to draw tick marks and sends an AxisChangeEvent to all registered listeners.

Usage

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

protected void setAxisTickMarks(Axis axis, Paint lineColor, AxisSettings axisSettings) {
    boolean axisTickMarksVisible = axisSettings.getTickMarksVisible() == null
            || axisSettings.getTickMarksVisible().booleanValue();

    axis.setTickMarksVisible(axisTickMarksVisible);

    if (axisTickMarksVisible) {
        Float axisTickMarksInsideLength = axisSettings.getTickMarksInsideLength();
        if (axisTickMarksInsideLength != null)
            axis.setTickMarkInsideLength(axisTickMarksInsideLength.floatValue());

        Float axisTickMarksOutsideLength = axisSettings.getTickMarksOutsideLength();
        if (axisTickMarksOutsideLength != null)
            axis.setTickMarkInsideLength(axisTickMarksOutsideLength.floatValue());

        Paint tickMarkPaint = axisSettings.getTickMarksPaint() != null
                && axisSettings.getTickMarksPaint().getPaint() != null
                        ? axisSettings.getTickMarksPaint().getPaint()
                        : lineColor;//from  w  ww  . ja  v  a  2s  .  co m

        if (tickMarkPaint != null) {
            axis.setTickMarkPaint(tickMarkPaint);
        }
        Stroke tickMarkStroke = axisSettings.getTickMarksStroke();
        if (tickMarkStroke != null)
            axis.setTickMarkStroke(tickMarkStroke);
    }
}

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  a  va  2 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.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected void setAxisTickMarks(Axis axis, Paint lineColor, AxisSettings axisSettings) {
    boolean axisTickMarksVisible = axisSettings.getTickMarksVisible() == null
            || axisSettings.getTickMarksVisible();

    axis.setTickMarksVisible(axisTickMarksVisible);

    if (axisTickMarksVisible) {
        Float axisTickMarksInsideLength = axisSettings.getTickMarksInsideLength();
        if (axisTickMarksInsideLength != null)
            axis.setTickMarkInsideLength(axisTickMarksInsideLength);

        Float axisTickMarksOutsideLength = axisSettings.getTickMarksOutsideLength();
        if (axisTickMarksOutsideLength != null)
            axis.setTickMarkInsideLength(axisTickMarksOutsideLength);

        Paint tickMarkPaint = axisSettings.getTickMarksPaint() != null
                && axisSettings.getTickMarksPaint().getPaint() != null
                        ? axisSettings.getTickMarksPaint().getPaint()
                        : lineColor;//from ww  w  .j  av a2  s .  c om

        if (tickMarkPaint != null) {
            axis.setTickMarkPaint(tickMarkPaint);
        }
        Stroke tickMarkStroke = axisSettings.getTickMarksStroke();
        if (tickMarkStroke != null)
            axis.setTickMarkStroke(tickMarkStroke);
    }
}

From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java

protected void setAxisTickMarks(Axis axis, Paint lineColor) {
    Boolean defaultAxisTickMarksVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap,
            ChartThemesConstants.AXIS_TICK_MARKS_VISIBLE);
    if (defaultAxisTickMarksVisible != null && defaultAxisTickMarksVisible.booleanValue()) {
        Float defaultAxisTickMarksInsideLength = (Float) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_INSIDE_LENGTH);
        if (defaultAxisTickMarksInsideLength != null)
            axis.setTickMarkInsideLength(defaultAxisTickMarksInsideLength.floatValue());

        Float defaultAxisTickMarksOutsideLength = (Float) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_OUTSIDE_LENGTH);
        if (defaultAxisTickMarksOutsideLength != null)
            axis.setTickMarkInsideLength(defaultAxisTickMarksOutsideLength.floatValue());

        Paint tickMarkPaint = getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_PAINT) != null
                        ? (Paint) getDefaultValue(defaultAxisPropertiesMap,
                                ChartThemesConstants.AXIS_TICK_MARKS_PAINT)
                        : lineColor;//from   w  w w  .  j  a  v  a  2 s  .  co  m

        if (tickMarkPaint != null) {
            axis.setTickMarkPaint(tickMarkPaint);
        }
        Stroke defaultTickMarkStroke = (Stroke) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_STROKE);
        if (defaultTickMarkStroke != null)
            axis.setTickMarkStroke(defaultTickMarkStroke);
    }
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java

protected void setAxisTickMarks(Axis axis, Paint lineColor) {
    Boolean defaultAxisTickMarksVisible = (Boolean) getDefaultValue(defaultAxisPropertiesMap,
            ChartThemesConstants.AXIS_TICK_MARKS_VISIBLE);
    if (defaultAxisTickMarksVisible != null && defaultAxisTickMarksVisible) {
        Float defaultAxisTickMarksInsideLength = (Float) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_INSIDE_LENGTH);
        if (defaultAxisTickMarksInsideLength != null)
            axis.setTickMarkInsideLength(defaultAxisTickMarksInsideLength);

        Float defaultAxisTickMarksOutsideLength = (Float) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_OUTSIDE_LENGTH);
        if (defaultAxisTickMarksOutsideLength != null)
            axis.setTickMarkInsideLength(defaultAxisTickMarksOutsideLength);

        Paint tickMarkPaint = getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_PAINT) != null
                        ? (Paint) getDefaultValue(defaultAxisPropertiesMap,
                                ChartThemesConstants.AXIS_TICK_MARKS_PAINT)
                        : lineColor;/*  ww w .  j a va2  s .c om*/

        if (tickMarkPaint != null) {
            axis.setTickMarkPaint(tickMarkPaint);
        }
        Stroke defaultTickMarkStroke = (Stroke) getDefaultValue(defaultAxisPropertiesMap,
                ChartThemesConstants.AXIS_TICK_MARKS_STROKE);
        if (defaultTickMarkStroke != null)
            axis.setTickMarkStroke(defaultTickMarkStroke);
    }
}