private CartesianChartModel createLinearModelTermMarksForOlSub( OLSubjectPrediction olSubjectPrediction) { CartesianChartModel model = new CartesianChartModel(); LineChartSeries termMarks = new LineChartSeries(); LineChartSeries lowerBound = null; termMarks.setLabel("Term Marks"); if (olSubjectPrediction.getTermMarks().get(0) >= 0) { termMarks.set(1, olSubjectPrediction.getTermMarks().get(0)); } if (olSubjectPrediction.getTermMarks().get(1) >= 0) { termMarks.set(2, olSubjectPrediction.getTermMarks().get(1)); } if (olSubjectPrediction.getTermMarks().get(2) >= 0) { termMarks.set(3, olSubjectPrediction.getTermMarks().get(2)); } if (olSubjectPrediction.getTermMarks().get(3) >= 0) { termMarks.set(4, olSubjectPrediction.getTermMarks().get(3)); } if (olSubjectPrediction.getTermMarks().get(4) >= 0) { termMarks.set(5, olSubjectPrediction.getTermMarks().get(4)); } // if (olSubjectPrediction.getTermMarks().get(5) >= 0) { // termMarks.set(6, olSubjectPrediction.getTermMarks().get(5)); // } if (!olSubjectPrediction.isCheck()) { LineChartSeries upperBound = new LineChartSeries(); upperBound.setLabel("Upper Bound"); upperBound.set(2, olSubjectPrediction.getTermMarksUpper().get(0)); upperBound.set(3, olSubjectPrediction.getTermMarksUpper().get(1)); upperBound.set(4, olSubjectPrediction.getTermMarksUpper().get(2)); upperBound.set(5, olSubjectPrediction.getTermMarksUpper().get(3)); upperBound.set(6, olSubjectPrediction.getTermMarksUpper().get(4)); lowerBound = new LineChartSeries(); lowerBound.setLabel("Lower Bound"); lowerBound.set(2, olSubjectPrediction.getTermMarksLower().get(0)); lowerBound.set(3, olSubjectPrediction.getTermMarksLower().get(1)); lowerBound.set(4, olSubjectPrediction.getTermMarksLower().get(2)); lowerBound.set(5, olSubjectPrediction.getTermMarksLower().get(3)); lowerBound.set(6, olSubjectPrediction.getTermMarksLower().get(4)); model.addSeries(upperBound); } // upperBound.setMarkerStyle(); model.addSeries(termMarks); if (!olSubjectPrediction.isCheck()) { model.addSeries(lowerBound); } return model; }
private void createLinearModel() { linearModel = new CartesianChartModel(); LineChartSeries series1 = new LineChartSeries(); series1.setLabel("Series 1"); series1.set(1, 2); series1.set(2, 1); series1.set(3, 3); series1.set(4, 6); series1.set(5, 8); LineChartSeries series2 = new LineChartSeries(); series2.setLabel("Series 2"); series2.setMarkerStyle("diamond"); series2.set(1, 6); series2.set(2, 3); series2.set(3, 2); series2.set(4, 7); series2.set(5, 9); linearModel.addSeries(series1); linearModel.addSeries(series2); }
public CartesianChartModel getMonthChartModel() { CartesianChartModel chartModel = new CartesianChartModel(); List<Account> accounts = accountRepository.getAccounts(); for (Account account : accounts) { List<Statement> accountStatements = statementRepository.getStatementsForOverview(account); if (!accountStatements.isEmpty()) { ChartSeries chartSeries = new ChartSeries(account.getName()); for (Statement statement : accountStatements) { chartSeries.set(getLabelForStatement(statement), statement.getEndAmount()); } chartModel.addSeries(chartSeries); } } return chartModel; }
public CartesianChartModel getCombinedModel() { LineChartSeries sales = new LineChartSeries(); sales.setLabel("Sales"); sales.set(2004, 1000); sales.set(2005, 1170); sales.set(2006, 660); sales.set(2007, 1030); BarChartSeries expenses = new BarChartSeries(); expenses.setLabel("Expenses"); expenses.set("2004", 400); expenses.set("2005", 460); expenses.set("2006", 1120); expenses.set("2007", 540); combinedModel.addSeries(sales); combinedModel.addSeries(expenses); return combinedModel; }
public void createChartModelByDate() { chartModelByDate = new CartesianChartModel(); LineChartSeries sum = new LineChartSeries(); sum.setLabel("Sum"); for (Report rp : repByDateList) { System.out.println( "____________________________________________________________________\n\n\n" + rp); sum.set(rp.getDate(), rp.getTotal()); } chartModelByDate.addSeries(sum); }
public CartesianChartModel getLinearModel() { linearModel = new CartesianChartModel(); LineChartSeries series = new LineChartSeries(); series.setLabel("amount"); List<AccountInfo> accountHistory = accountService.getFindLasts(100); int serieNo = 100; for (AccountInfo account : accountHistory) { series.set(serieNo--, account.getNetLiquidation()); } linearModel.addSeries(series); BigDecimal net = accountService.getLastAccountInfo().getNetLiquidation(); linearMax = net.add(new BigDecimal(500)).intValue(); linearMin = net.subtract(new BigDecimal(500)).intValue(); return linearModel; }
private void createCategoryModel() { categoryModel = new CartesianChartModel(); ChartSeries boys = new ChartSeries(); boys.setLabel("Boys"); boys.set("2004", 120); boys.set("2005", 100); boys.set("2006", 44); boys.set("2007", 150); boys.set("2008", 25); ChartSeries girls = new ChartSeries(); girls.setLabel("Girls"); girls.set("2004", 52); girls.set("2005", 60); girls.set("2006", 110); girls.set("2007", 135); girls.set("2008", 120); categoryModel.addSeries(boys); categoryModel.addSeries(girls); }
@PostConstruct public void load() { membershipGrowthModel = new CartesianChartModel(); membershipCumulativeGrowthModel = new CartesianChartModel(); String[] months = { ResourceBundleHelper.INSTANCE.getMessage("januaryShort"), ResourceBundleHelper.INSTANCE.getMessage("februaryShort"), ResourceBundleHelper.INSTANCE.getMessage("marchShort"), ResourceBundleHelper.INSTANCE.getMessage("aprilShort"), ResourceBundleHelper.INSTANCE.getMessage("mayShort"), ResourceBundleHelper.INSTANCE.getMessage("juneShort"), ResourceBundleHelper.INSTANCE.getMessage("julyShort"), ResourceBundleHelper.INSTANCE.getMessage("augustShort"), ResourceBundleHelper.INSTANCE.getMessage("septemberShort"), ResourceBundleHelper.INSTANCE.getMessage("octoberShort"), ResourceBundleHelper.INSTANCE.getMessage("novemberShort"), ResourceBundleHelper.INSTANCE.getMessage("decemberShort") }; Calendar lastDay = Calendar.getInstance(); lastDay.set(Calendar.MONTH, Calendar.DECEMBER); lastDay.set(Calendar.DATE, 31); lastDay.set(Calendar.HOUR, 11); lastDay.set(Calendar.MINUTE, 59); lastDay.set(Calendar.SECOND, 59); lastDay.set(Calendar.AM_PM, Calendar.PM); Date to = lastDay.getTime(); Calendar firstDay = lastDay; firstDay.add(Calendar.YEAR, -1); firstDay.set(Calendar.DAY_OF_MONTH, 1); firstDay.set(Calendar.MONTH, 0); firstDay.set(Calendar.HOUR, 0); firstDay.set(Calendar.MINUTE, 0); lastDay.set(Calendar.SECOND, 0); lastDay.set(Calendar.AM_PM, Calendar.AM); Date from = firstDay.getTime(); List<UserAccount> userAccounts = userAccountBean.findConfirmedAccounts(from, to); Calendar registrationDate; Calendar deactivationDate; int[][] data = new int[2][12]; int year, month, currentYear = 0; for (UserAccount userAccount : userAccounts) { registrationDate = Calendar.getInstance(); registrationDate.setTime(userAccount.getRegistrationDate()); if (currentYear == 0) { currentYear = registrationDate.get(Calendar.YEAR); } year = registrationDate.get(Calendar.YEAR) - currentYear; month = registrationDate.get(Calendar.MONTH); data[year][month] += 1; if (userAccount.getDeactivationDate() != null) { deactivationDate = Calendar.getInstance(); deactivationDate.setTime(userAccount.getDeactivationDate()); year = deactivationDate.get(Calendar.YEAR) - currentYear; month = deactivationDate.get(Calendar.MONTH); data[year][month] -= 1; } } ChartSeries annualSeries; for (int i = 0; i < 2; i++) { annualSeries = new ChartSeries(); annualSeries.setLabel(String.valueOf(currentYear + i)); for (int j = 0; j < 12; j++) { annualSeries.set(months[j], data[i][j]); } membershipGrowthModel.addSeries(annualSeries); } ChartSeries accumulatedSeries; int accumulated; for (int i = 0; i < 2; i++) { accumulated = 0; accumulatedSeries = new ChartSeries(); accumulatedSeries.setLabel(String.valueOf(currentYear + i)); for (int j = 0; j < 12; j++) { accumulated = data[i][j] + accumulated; accumulatedSeries.set(months[j], accumulated); } membershipCumulativeGrowthModel.addSeries(accumulatedSeries); } }