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

com.vaadin.flow.component.charts.model.Pane Maven / Gradle / Ivy

There is a newer version: 24.5.4
Show newest version
/**
 * Copyright 2000-2024 Vaadin Ltd.
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See {@literal } for the full
 * license.
 */
package com.vaadin.flow.component.charts.model;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * Applies only to polar charts and angular gauges. This configuration object
 * holds general options for the combined X and Y axes set. Each xAxis or yAxis
 * can reference the pane by index.
 */
public class Pane extends AbstractConfigurationObject {

    private Integer paneIndex;
    private ArrayList background;
    private String[] center;
    private Number endAngle;
    private String size;
    private Number startAngle;

    public Pane() {
    }

    /**
     * @see #setPaneIndex(Integer)
     */
    Integer getPaneIndex() {
        return paneIndex;
    }

    void setPaneIndex(Integer paneIndex) {
        this.paneIndex = paneIndex;
    }

    /**
     * @see #setBackground(Background...)
     */
    public Background[] getBackground() {
        if (background == null) {
            return new Background[] {};
        }
        Background[] arr = new Background[background.size()];
        background.toArray(arr);
        return arr;
    }

    /**
     * An object, or array of objects, for backgrounds.
     */
    public void setBackground(Background... background) {
        this.background = new ArrayList(Arrays.asList(background));
    }

    /**
     * Adds background to the background array
     *
     * @param background
     *            to add
     * @see #setBackground(Background...)
     */
    public void addBackground(Background background) {
        if (this.background == null) {
            this.background = new ArrayList();
        }
        this.background.add(background);
    }

    /**
     * Removes first occurrence of background in background array
     *
     * @param background
     *            to remove
     * @see #setBackground(Background...)
     */
    public void removeBackground(Background background) {
        this.background.remove(background);
    }

    /**
     * The center of a polar chart or angular gauge, given as an array of [x, y]
     * positions. Positions can be given as integers that transform to pixels,
     * or as percentages of the plot area size.
     * 

* Defaults to: ["50%", "50%"] */ public void setCenter(String[] center) { this.center = center; } /** * @see #setEndAngle(Number) */ public Number getEndAngle() { return endAngle; } /** * The end angle of the polar X axis or gauge value axis, given in degrees * where 0 is north. Defaults to startAngle + * 360. */ public void setEndAngle(Number endAngle) { this.endAngle = endAngle; } /** * @see #setSize(String) */ public String getSize() { return size; } /** * The size of the pane, either as a number defining pixels, or a percentage * defining a percentage of the plot are. *

* Defaults to: 85% */ public void setSize(String size) { this.size = size; } /** * @see #setStartAngle(Number) */ public Number getStartAngle() { return startAngle; } /** * The start angle of the polar X axis or gauge axis, given in degrees where * 0 is north. Defaults to 0. */ public void setStartAngle(Number startAngle) { this.startAngle = startAngle; } public Pane(Number startAngle, Number endAngle) { this.startAngle = startAngle; this.endAngle = endAngle; } public void setCenter(String x, String y) { this.center = new String[] { x, y }; } public String[] getCenter() { return this.center; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy