本文整理汇总了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();
}