private JRDataSource createDataSource() { DRDataSource dataSource = new DRDataSource("x", "y", "z"); for (int i = 0; i < 10; i++) { dataSource.add(i, 0, (int) (Math.random() * 4)); dataSource.add(i, 1, (int) (Math.random() * 4)); } return dataSource; }
private JRDataSource createDataSource() { DRDataSource dataSource = new DRDataSource("item", "quantity", "unitprice"); for (int i = 0; i < 20; i++) { dataSource.add( "Book", (int) (Math.random() * 10) + 1, new BigDecimal(Math.random() * 100 + 1)); } return dataSource; }