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

com.janeluo.jfinalplus.render.chart.funshion.GraphChart Maven / Gradle / Ivy

There is a newer version: 2.2.0.r3
Show newest version
/**
 * Copyright (c) 2011-2013, kidzhou 周磊 ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.janeluo.jfinalplus.render.chart.funshion;

import com.jfinal.kit.StrKit;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class GraphChart {
    /**
     * 标题
     */
    private String caption;
    /**
     * 子标题
     */
    private String subcaption;
    /**
     * 背景色
     */
    private String bgColor;
    /**
     * 线性颜色
     */
    private String divLineColor;

    /**
     * 左边y轴刻度前缀
     */
    private String numberPrefix = "";

    /**
     * 左边y轴刻度后缀
     */
    private String numberSuffix = "";
    /**
     * 左边y轴描述
     */

    private String pYAxisName = "";

    /**
     * 右边y轴刻度前缀
     */
    private String sNumberSuffix = "";
    /**
     * 右边y轴描述
     */
    private String sYAxisName = "";
    /**
     * 标签,每一点说明
     */
    private List labels;
    /**
     * 每个柱状或者曲线说明
     */
    private List leftSeriesNames;
    /**
     * 右个柱状或者曲线说明
     */
    private List rightSeriesNames;
    /**
     * 柱状,曲线颜色 anchorBgColor(折线节点填充颜色,6位16进制颜色值)
     */
    private List colors;
    /**
     * 左刻度数据集
     */
    private List> leftValues;

    /**
     * 右刻度数据集
     */
    private List> rightValues;

    /**
     * FLASH位置
     */
    private String charUrl;
    /**
     * FLASH宽
     */
    private String charWidth;

    /**
     * FLASH高
     */
    private String charHigh;

    public String getCaption() {
        return caption;
    }

    public void setCaption(String caption) {
        this.caption = caption;
    }

    public String getSubcaption() {
        return subcaption;
    }

    public void setSubcaption(String subcaption) {
        this.subcaption = subcaption;
    }

    public String getBgColor() {
        if (StrKit.isBlank(bgColor)) {
            bgColor = genColor();
        }
        return bgColor;
    }

    public void setBgColor(String bgColor) {
        this.bgColor = bgColor;
    }

    public String getDivLineColor() {
        if (StrKit.isBlank(bgColor)) {
            divLineColor = genColor();
        }
        return divLineColor;
    }

    public void setDivLineColor(String divLineColor) {
        this.divLineColor = divLineColor;
    }

    public List getLabels() {
        return labels;
    }

    public void setLabels(List labels) {
        this.labels = labels;
    }

    public List getColors() {
        if (colors == null) {
            colors = new ArrayList();
            for (int i = 0; i < leftValues.size(); i++) {
                colors.add(genColor());
            }
        }

        return colors;
    }

    public void setColors(List colors) {
        this.colors = colors;
    }

    public String getCharUrl() {
        return charUrl;
    }

    public void setCharUrl(String charUrl) {
        this.charUrl = charUrl;
    }

    public String getCharWidth() {
        return charWidth;
    }

    public void setCharWidth(String charWidth) {
        this.charWidth = charWidth;
    }

    public String getCharHigh() {
        return charHigh;
    }

    public void setCharHigh(String charHigh) {
        this.charHigh = charHigh;
    }

    public String getNumberPrefix() {
        return numberPrefix;
    }

    public void setNumberPrefix(String numberPrefix) {
        this.numberPrefix = numberPrefix;
    }

    public String getpYAxisName() {
        return pYAxisName;
    }

    public void setpYAxisName(String pYAxisName) {
        this.pYAxisName = pYAxisName;
    }

    public String getsNumberSuffix() {
        return sNumberSuffix;
    }

    public void setsNumberSuffix(String sNumberSuffix) {
        this.sNumberSuffix = sNumberSuffix;
    }

    public String getsYAxisName() {
        return sYAxisName;
    }

    public void setsYAxisName(String sYAxisName) {
        this.sYAxisName = sYAxisName;
    }

    private String genColor() {
        Random random = new Random();
        String rgb = "";
        for (int i = 0; i < 6; i++) {
            int r = random.nextInt(16);
            rgb += Integer.toHexString(r);
        }
        return rgb;
    }

    public String getNumberSuffix() {
        return numberSuffix;
    }

    public void setNumberSuffix(String numberSuffix) {
        this.numberSuffix = numberSuffix;
    }

    public List getLeftSeriesNames() {
        return leftSeriesNames;
    }

    public void setLeftSeriesNames(List leftSeriesNames) {
        this.leftSeriesNames = leftSeriesNames;
    }

    public List getRightSeriesNames() {
        return rightSeriesNames;
    }

    public void setRightSeriesNames(List rightSeriesNames) {
        this.rightSeriesNames = rightSeriesNames;
    }

    public List> getLeftValues() {
        return leftValues;
    }

    public void setLeftValues(List> leftValues) {
        this.leftValues = leftValues;
    }

    public List> getRightValues() {
        return rightValues;
    }

    public void setRightValues(List> rightValues) {
        this.rightValues = rightValues;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy