All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.dynamicreports.report.builder.chart.ThermometerChartBuilder Maven / Gradle / Ivy

Go to download

DynamicReports is an open source Java reporting library based on JasperReports. It allows to create dynamic report designs and it doesn't need a visual report designer. You can very quickly create reports and produce documents that can be displayed, printed or exported into many popular formats such as PDF, Excel, Word and others.

There is a newer version: 6.20.1
Show newest version
/**
 * DynamicReports - Free Java reporting library for creating reports dynamically
 *
 * Copyright (C) 2010 - 2016 Ricardo Mariaca
 * http://www.dynamicreports.org
 *
 * This file is part of DynamicReports.
 *
 * DynamicReports is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * DynamicReports is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with DynamicReports. If not, see .
 */

package net.sf.dynamicreports.report.builder.chart;

import java.awt.Color;

import net.sf.dynamicreports.report.base.chart.dataset.DRValueDataset;
import net.sf.dynamicreports.report.base.chart.plot.DRThermometerPlot;
import net.sf.dynamicreports.report.builder.DynamicReports;
import net.sf.dynamicreports.report.builder.FieldBuilder;
import net.sf.dynamicreports.report.builder.column.ValueColumnBuilder;
import net.sf.dynamicreports.report.builder.expression.Expressions;
import net.sf.dynamicreports.report.builder.style.FontBuilder;
import net.sf.dynamicreports.report.constant.ChartType;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.constant.ValueLocation;
import net.sf.dynamicreports.report.definition.expression.DRIExpression;

import org.apache.commons.lang3.Validate;

/**
 * @author Ricardo Mariaca ([email protected])
 */
public class ThermometerChartBuilder extends AbstractChartBuilder {
	private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;

	protected ThermometerChartBuilder() {
		super(ChartType.THERMOMETER);
	}

	public ThermometerChartBuilder setTheme(String theme) {
		getObject().setTheme(theme);
		return this;
	}

	//dataset
	public ThermometerChartBuilder setValue(Number value) {
		getDataset().setValueExpression(Expressions.number(value));
		return this;
	}

	public ThermometerChartBuilder setValue(ValueColumnBuilder column) {
		Validate.notNull(column, "column must not be null");
		getDataset().setValueExpression(column.getColumn());
		return this;
	}

	public ThermometerChartBuilder setValue(String fieldName, Class valueClass) {
		return setValue(DynamicReports.field(fieldName, valueClass));
	}

	public ThermometerChartBuilder setValue(FieldBuilder field) {
		Validate.notNull(field, "field must not be null");
		getDataset().setValueExpression(field.build());
		return this;
	}

	public ThermometerChartBuilder setValue(DRIExpression expression) {
		getDataset().setValueExpression(expression);
		return this;
	}

	//plot
	public ThermometerChartBuilder setDataRangeLowExpression(Number dataRangeLowValue) {
		getPlot().setDataRangeLowExpression(Expressions.number(dataRangeLowValue));
		return this;
	}

	public ThermometerChartBuilder setDataRangeLowExpression(DRIExpression dataRangeLowExpression) {
		getPlot().setDataRangeLowExpression(dataRangeLowExpression);
		return this;
	}

	public ThermometerChartBuilder setDataRangeHighExpression(Number dataRangeHighValue) {
		getPlot().setDataRangeHighExpression(Expressions.number(dataRangeHighValue));
		return this;
	}

	public ThermometerChartBuilder setDataRangeHighExpression(DRIExpression dataRangeHighExpression) {
		getPlot().setDataRangeHighExpression(dataRangeHighExpression);
		return this;
	}

	public ThermometerChartBuilder setValueColor(Color valueColor) {
		getPlot().setValueColor(valueColor);
		return this;
	}

	public ThermometerChartBuilder setValueMask(String valueMask) {
		getPlot().setValueMask(valueMask);
		return this;
	}

	public ThermometerChartBuilder setValueFont(FontBuilder valueFont) {
		Validate.notNull(valueFont, "valueFont must not be null");
		getPlot().setValueFont(valueFont.build());
		return this;
	}

	public ThermometerChartBuilder setValueLocation(ValueLocation valueLocation) {
		getPlot().setValueLocation(valueLocation);
		return this;
	}

	public ThermometerChartBuilder setMercuryColor(Color mercuryColor) {
		getPlot().setMercuryColor(mercuryColor);
		return this;
	}

	public ThermometerChartBuilder setLowDataRangeLowExpression(Number lowDataRangeLowValue) {
		getPlot().setLowDataRangeLowExpression(Expressions.number(lowDataRangeLowValue));
		return this;
	}

	public ThermometerChartBuilder setLowDataRangeLowExpression(DRIExpression lowDataRangeLowExpression) {
		getPlot().setLowDataRangeLowExpression(lowDataRangeLowExpression);
		return this;
	}

	public ThermometerChartBuilder setLowDataRangeHighExpression(Number lowDataRangeHighValue) {
		getPlot().setLowDataRangeHighExpression(Expressions.number(lowDataRangeHighValue));
		return this;
	}

	public ThermometerChartBuilder setLowDataRangeHighExpression(DRIExpression lowDataRangeHighExpression) {
		getPlot().setLowDataRangeHighExpression(lowDataRangeHighExpression);
		return this;
	}

	public ThermometerChartBuilder setMediumDataRangeLowExpression(Number mediumDataRangeLowValue) {
		getPlot().setMediumDataRangeLowExpression(Expressions.number(mediumDataRangeLowValue));
		return this;
	}

	public ThermometerChartBuilder setMediumDataRangeLowExpression(DRIExpression mediumDataRangeLowExpression) {
		getPlot().setMediumDataRangeLowExpression(mediumDataRangeLowExpression);
		return this;
	}

	public ThermometerChartBuilder setMediumDataRangeHighExpression(Number mediumDataRangeHighValue) {
		getPlot().setMediumDataRangeHighExpression(Expressions.number(mediumDataRangeHighValue));
		return this;
	}

	public ThermometerChartBuilder setMediumDataRangeHighExpression(DRIExpression mediumDataRangeHighExpression) {
		getPlot().setMediumDataRangeHighExpression(mediumDataRangeHighExpression);
		return this;
	}

	public ThermometerChartBuilder setHighDataRangeLowExpression(Number highDataRangeLowValue) {
		getPlot().setHighDataRangeLowExpression(Expressions.number(highDataRangeLowValue));
		return this;
	}

	public ThermometerChartBuilder setHighDataRangeLowExpression(DRIExpression highDataRangeLowExpression) {
		getPlot().setHighDataRangeLowExpression(highDataRangeLowExpression);
		return this;
	}

	public ThermometerChartBuilder setHighDataRangeHighExpression(Number highDataRangeHighValue) {
		getPlot().setHighDataRangeHighExpression(Expressions.number(highDataRangeHighValue));
		return this;
	}

	public ThermometerChartBuilder setHighDataRangeHighExpression(DRIExpression highDataRangeHighExpression) {
		getPlot().setHighDataRangeHighExpression(highDataRangeHighExpression);
		return this;
	}

	private DRValueDataset getDataset() {
		return (DRValueDataset) getObject().getDataset();
	}

	private DRThermometerPlot getPlot() {
		return (DRThermometerPlot) getObject().getPlot();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy