org.jfree.chart.axis.Axis Java Examples

The following examples show how to use org.jfree.chart.axis.Axis. 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: DefaultAxisEditor.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #2
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void setAxisLine(Axis axis, Paint lineColor)
{
	Boolean defaultAxisLineVisible = (Boolean)getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LINE_VISIBLE);
	if (defaultAxisLineVisible != null && defaultAxisLineVisible)
	{
		Paint linePaint = lineColor != null ?
				lineColor :
				(Paint)getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LINE_PAINT);
		
		if (linePaint != null)
		{
			axis.setAxisLinePaint(linePaint);
		}
		Stroke defaultAxisLineStroke = (Stroke)getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LINE_STROKE);
		if (defaultAxisLineStroke != null)
			axis.setAxisLineStroke(defaultAxisLineStroke);
	}
}
 
Example #3
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
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;
		
		if (tickMarkPaint != null)
		{
			axis.setTickMarkPaint(tickMarkPaint);
		}
		Stroke defaultTickMarkStroke = (Stroke)getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_TICK_MARKS_STROKE);
		if (defaultTickMarkStroke != null)
			axis.setTickMarkStroke(defaultTickMarkStroke);
	}
}
 
Example #4
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Sets all the axis formatting options.  This includes the colors and fonts to use on
 * the axis as well as the color to use when drawing the axis line.
 *
 * @param axis the axis to format
 * @param labelFont the font to use for the axis label
 * @param labelColor the color of the axis label
 * @param tickLabelFont the font to use for each tick mark value label
 * @param tickLabelColor the color of each tick mark value label
 * @param tickLabelMask formatting mask for the label.  If the axis is a NumberAxis then
 * 						the mask should be <code>java.text.DecimalFormat</code> mask, and
 * 						if it is a DateAxis then the mask should be a
 * 						<code>java.text.SimpleDateFormat</code> mask.
 * @param verticalTickLabels flag to draw tick labels at 90 degrees
 * @param lineColor color to use when drawing the axis line and any tick marks
 */
protected void configureAxis(
		Axis axis,
		JRFont labelFont,
		Color labelColor,
		JRFont tickLabelFont,
		Color tickLabelColor,
		String tickLabelMask,
		Boolean verticalTickLabels,
		Paint lineColor,
		AxisSettings axisSettings,
		Comparable<?> axisMinValue,
		Comparable<?> axisMaxValue
		) throws JRException
{
	configureAxis(axis, labelFont, labelColor, tickLabelFont, tickLabelColor, tickLabelMask, verticalTickLabels, lineColor, axisSettings, DateTickUnitType.YEAR, axisMinValue, axisMaxValue);
}
 
Example #5
Source File: DefaultAxisEditor.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #6
Source File: DefaultAxisEditor.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #7
Source File: SWTChartEditor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties defined on this panel.
 *
 * @param axis
 *            the axis.
 */
public void setAxisProperties(final Axis axis) {
	axis.setLabel(getLabel());
	axis.setLabelFont(getLabelFont());
	axis.setLabelPaint(getLabelPaint());
	axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection());
	axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection());
	axis.setTickLabelFont(getTickLabelFont());
	axis.setTickLabelPaint(getTickLabelPaint());
}
 
Example #8
Source File: PolarPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    stream.defaultReadObject();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #9
Source File: SWTAxisEditor.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match 
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    axis.setLabel(getLabel());
    axis.setLabelFont(getLabelFont());
    axis.setLabelPaint(getLabelPaint());
    axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection());
    axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection());
    axis.setTickLabelFont(getTickLabelFont());
    axis.setTickLabelPaint(getTickLabelPaint());
}
 
Example #10
Source File: SWTNumberAxisEditor.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match 
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    NumberAxis numberAxis = (NumberAxis) axis;
    numberAxis.setAutoRange(this.autoRange);
    if (!this.autoRange) {
        numberAxis.setRange(this.minimumValue, this.maximumValue);
    }
}
 
Example #11
Source File: SWTAxisEditor.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    axis.setLabel(getLabel());
    axis.setLabelFont(getLabelFont());
    axis.setLabelPaint(getLabelPaint());
    axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection());
    axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection());
    axis.setTickLabelFont(getTickLabelFont());
    axis.setTickLabelPaint(getTickLabelPaint());
}
 
Example #12
Source File: SWTAxisEditor.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate
 * for the axis type.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param axis  the axis whose properties are to be displayed/edited
 *              in the composite.
 * @return A composite or <code>null</code< if axis is <code>null</code>.
 */
public static SWTAxisEditor getInstance(Composite parent, int style,
        Axis axis) {

    if (axis != null) {
        // return the appropriate axis editor
        if (axis instanceof NumberAxis)
            return new SWTNumberAxisEditor(parent, style,
                    (NumberAxis) axis);
        else return new SWTAxisEditor(parent, style, axis);
    }
    else return null;
}
 
Example #13
Source File: SWTChartEditor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties defined on this panel.
 *
 * @param axis
 *            the axis.
 */
@Override
public void setAxisProperties(final Axis axis) {
	super.setAxisProperties(axis);
	final NumberAxis numberAxis = (NumberAxis) axis;
	numberAxis.setAutoRange(this.autoRange);
	if (!this.autoRange) {
		numberAxis.setRange(this.minimumValue, this.maximumValue);
	}
}
 
Example #14
Source File: SWTNumberAxisEditor.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match 
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    NumberAxis numberAxis = (NumberAxis) axis;
    numberAxis.setAutoRange(this.autoRange);
    if (! this.autoRange)
        numberAxis.setRange(this.minimumValue, this.maximumValue);
}
 
Example #15
Source File: DefaultLogAxisEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    LogAxis logAxis = (LogAxis) axis;
    if (!isAutoTickUnitSelection()) {
        logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
    }
}
 
Example #16
Source File: SWTAxisEditor.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    axis.setLabel(getLabel());
    axis.setLabelFont(getLabelFont());
    axis.setLabelPaint(getLabelPaint());
    axis.setTickMarksVisible(this.showTickMarksCheckBox.getSelection());
    axis.setTickLabelsVisible(this.showTickLabelsCheckBox.getSelection());
    axis.setTickLabelFont(getTickLabelFont());
    axis.setTickLabelPaint(getTickLabelPaint());
}
 
Example #17
Source File: AxisLabelEntity.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new entity representing the label on an axis.
 * 
 * @param axis  the axis.
 * @param hotspot  the hotspot.
 * @param toolTipText  the tool tip text (<code>null</code> permitted).
 * @param url  the url (<code>null</code> permitted).
 */
public AxisLabelEntity(Axis axis, Shape hotspot, String toolTipText, 
        String url) {
    super(hotspot, toolTipText, url);
    if (axis == null) {
        throw new IllegalArgumentException("Null 'axis' argument.");
    }
    this.axis = axis;
}
 
Example #18
Source File: DefaultValueAxisEditor.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    ValueAxis valueAxis = (ValueAxis) axis;
    valueAxis.setAutoRange(this.autoRange);
    if (!this.autoRange) {
        valueAxis.setRange(this.minimumValue, this.maximumValue);
    }
    valueAxis.setAutoTickUnitSelection(this.autoTickUnitSelection);
}
 
Example #19
Source File: SWTChartEditor.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis type.
 *
 * @param parent
 *            the parent.
 * @param style
 *            the style.
 * @param axis
 *            the axis whose properties are to be displayed/edited in the composite.
 * @return A composite or <code>null</code< if axis is <code>null</code> .
 */
public static SWTAxisEditor getInstance(final Composite parent, final int style, final Axis axis) {

	if (axis != null) {
		// return the appropriate axis editor
		if (axis instanceof NumberAxis) {
			return new SWTNumberAxisEditor(parent, style, (NumberAxis) axis);
		} else {
			return new SWTAxisEditor(parent, style, axis);
		}
	} else {
		return null;
	}
}
 
Example #20
Source File: ChartFormatter.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
private void formatAxis(Axis axis) {
    axis.setLabelFont(LABEL_FONT);
    axis.setTickLabelFont(AXIS_FONT);

    axis.setLabelPaint(textColor);
    axis.setAxisLinePaint(elementColor);
    axis.setTickLabelPaint(elementColor);
    axis.setTickMarkPaint(elementColor);
}
 
Example #21
Source File: SWTNumberAxisEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match 
 * the properties defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    NumberAxis numberAxis = (NumberAxis) axis;
    numberAxis.setAutoRange(this.autoRange);
    if (!this.autoRange) {
        numberAxis.setRange(this.minimumValue, this.maximumValue);
    }
}
 
Example #22
Source File: DefaultValueAxisEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    ValueAxis valueAxis = (ValueAxis) axis;
    valueAxis.setAutoRange(this.autoRange);
    if (!this.autoRange) {
        valueAxis.setRange(this.minimumValue, this.maximumValue);
    }
    valueAxis.setAutoTickUnitSelection(this.autoTickUnitSelection);
}
 
Example #23
Source File: SWTAxisEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate
 * for the axis type.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param axis  the axis whose properties are to be displayed/edited
 *              in the composite.
 * @return A composite or <code>null</code< if axis is <code>null</code>.
 */
public static SWTAxisEditor getInstance(Composite parent, int style,
        Axis axis) {

    if (axis != null) {
        // return the appropriate axis editor
        if (axis instanceof NumberAxis)
            return new SWTNumberAxisEditor(parent, style,
                    (NumberAxis) axis);
        else return new SWTAxisEditor(parent, style, axis);
    }
    else return null;
}
 
Example #24
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {

    stream.defaultReadObject();
    this.angleGridlineStroke = SerialUtilities.readStroke(stream);
    this.angleGridlinePaint = SerialUtilities.readPaint(stream);
    this.radiusGridlineStroke = SerialUtilities.readStroke(stream);
    this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
    this.angleLabelPaint = SerialUtilities.readPaint(stream);

    int rangeAxisCount = this.axes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.axes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        PolarItemRenderer renderer = (PolarItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }
}
 
Example #25
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
		
		if (tickMarkPaint != null)
		{
			axis.setTickMarkPaint(tickMarkPaint);
		}
		Stroke tickMarkStroke = axisSettings.getTickMarksStroke();
		if (tickMarkStroke != null)
			axis.setTickMarkStroke(tickMarkStroke);
	}
}
 
Example #26
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
			}
			Paint labelPaint = labelColor != null 
					? labelColor 
					: axisSettings.getLabelPaint() != null 
					? axisSettings.getLabelPaint().getPaint()
					: null;
			if (labelPaint != null)
			{
				axis.setLabelPaint(labelPaint);
			}
		}
	}
 
Example #27
Source File: DefaultValueAxisEditor.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    ValueAxis valueAxis = (ValueAxis) axis;
    valueAxis.setAutoRange(this.autoRange);
    if (!this.autoRange) {
        valueAxis.setRange(this.minimumValue, this.maximumValue);
    }
    valueAxis.setAutoTickUnitSelection(this.autoTickUnitSelection);
}
 
Example #28
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
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);
		}
		Paint labelPaint = labelColor != null ? 
				labelColor :
				(Paint)getDefaultValue(defaultAxisPropertiesMap, ChartThemesConstants.AXIS_LABEL_PAINT);	
		if (labelPaint != null)
		{
			axis.setLabelPaint(labelPaint);
		}
	}
}
 
Example #29
Source File: DefaultAxisEditor.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
public void setAxisProperties(Axis axis) {
    axis.setLabel(getLabel());
    axis.setLabelFont(getLabelFont());
    axis.setLabelPaint(getLabelPaint());
    axis.setTickMarksVisible(isTickMarksVisible());
    // axis.setTickMarkStroke(getTickMarkStroke());
    axis.setTickLabelsVisible(isTickLabelsVisible());
    axis.setTickLabelFont(getTickLabelFont());
    axis.setTickLabelPaint(getTickLabelPaint());
    axis.setTickLabelInsets(getTickLabelInsets());
    axis.setLabelInsets(getLabelInsets());
}
 
Example #30
Source File: DefaultChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
protected void setAxisBounds(
	Axis axis,
	boolean isRangeAxis,
	Comparable<?> axisMinValue,
	Comparable<?> axisMaxValue
	)
{
	if (axis instanceof ValueAxis)
	{
		if (axis instanceof DateAxis)
		{
			if (axisMinValue != null)
			{
				((DateAxis)axis).setMinimumDate((Date)axisMinValue);
			}
			if (axisMaxValue != null)
			{
				((DateAxis)axis).setMaximumDate((Date)axisMaxValue);
			}
		}
		else
		{
			if (axisMinValue != null)
			{
				((ValueAxis)axis).setLowerBound(((Number)axisMinValue).doubleValue());
			}
			if (axisMaxValue != null)
			{
				((ValueAxis)axis).setUpperBound(((Number)axisMaxValue).doubleValue());
			}
		}
		
		calculateTickUnits(axis, isRangeAxis);
	}
}