当前位置: 首页>>代码示例>>Java>>正文


Java DataSetBuilder.row方法代码示例

本文整理汇总了Java中org.dashbuilder.dataset.DataSetBuilder.row方法的典型用法代码示例。如果您正苦于以下问题:Java DataSetBuilder.row方法的具体用法?Java DataSetBuilder.row怎么用?Java DataSetBuilder.row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dashbuilder.dataset.DataSetBuilder的用法示例。


在下文中一共展示了DataSetBuilder.row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildDataSet

import org.dashbuilder.dataset.DataSetBuilder; //导入方法依赖的package包/类
public DataSet buildDataSet(Map<String,String> params) {
    int currentYear =  Calendar.getInstance().get(Calendar.YEAR);
    int startYear = currentYear + parseParam(params.get("startYear"), -2);
    int endYear = currentYear + parseParam(params.get("endYear"), 2);
    int opportunitiesPerMonth = parseParam(params.get("oppsPerMonth"), 30);

    DataSetBuilder builder = DataSetFactory.newDataSetBuilder()
            .number(AMOUNT)
            .date(CREATION_DATE)
            .date(CLOSING_DATE)
            .label(PIPELINE)
            .label(STATUS)
            .label(CUSTOMER)
            .label(COUNTRY)
            .label(PRODUCT)
            .label(SALES_PERSON)
            .number(PROBABILITY)
            .label(SOURCE)
            .number(EXPECTED_AMOUNT)
            .label(COLOR);

    for (int year = startYear; year <= endYear; year++) {
        for (int month = 0; month < 12; month++) {
            for (int i = 0; i < opportunitiesPerMonth; i++) {

                double amount = MIN_AMOUNT + random.nextDouble() * (MAX_AMOUNT - MIN_AMOUNT);
                double probability = random.nextDouble() * 100.0;
                Date creationDate = buildDate(month, year);
                String color = "GREEN";
                if (probability < 25) color = "RED";
                else if (probability < 50) color = "GREY";
                else if (probability < 75) color = "YELLOW";

                builder.row(amount,
                        creationDate,
                        addDates(creationDate, (int) (AVG_CLOSING_DAYS + random.nextDouble() * AVG_CLOSING_DAYS * 0.5)),
                        randomValue(DIC_PIPELINE),
                        randomValue(DIC_STATUS),
                        randomValue(DIC_CUSTOMER),
                        randomValue(DIC_COUNTRIES),
                        randomValue(DIC_PRODUCT),
                        randomValue(DIC_SALES_PERSON),
                        probability,
                        randomValue(DIC_SOURCE),
                        amount * (1 + (random.nextDouble() * ((month*i)%10)/10)),
                        color);
            }
        }
    }
    return builder.buildDataSet();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:52,代码来源:SalesDataSetGenerator.java


注:本文中的org.dashbuilder.dataset.DataSetBuilder.row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。