use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method getRelationOneColData.
public static IPentahoResultSet getRelationOneColData() {
IPentahoResultSet ips = null;
ArrayList<String> colHeaders = new ArrayList();
colHeaders.add(0, "DEPARTMENT");
colHeaders.add(1, "ACTUAL");
colHeaders.add(2, "BUDGET");
ArrayList r1 = new ArrayList();
r1.add("Sales");
r1.add(11);
ArrayList r2 = new ArrayList();
r2.add("Finance");
r2.add(14);
ArrayList r3 = new ArrayList();
r3.add("Human Resource");
r3.add(7);
ArrayList data = new ArrayList();
data.add(r1);
data.add(r2);
data.add(r3);
ips = MemoryResultSet.createFromLists(colHeaders, data);
System.out.println(ips.getRowCount());
return ips;
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testBogusData.
@Test
public void testBogusData() {
String chart = "<chart>" + "<chart-type>BarChart</chart-type>" + "</chart>";
IPentahoResultSet rs = getRelationBogusData();
Node chartNode = getChartNode(chart);
try {
PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
Assert.fail();
} catch (RuntimeException e) {
Assert.assertTrue(e.getMessage().toLowerCase().indexOf("result set") >= 0);
}
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testAreaChart.
@Test
public void testAreaChart() {
String chart = "<chart>" + "<chart-type>AreaChart</chart-type>" + "</chart>";
IPentahoResultSet rs = getRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
assertJsonEquals("{\"y_axis\":{\"min\":0,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"max\":110," + "\"steps\":10},\"x_legend\":{\"text\":\"DEPARTMENT\",\"style\":\"font-family: Arial; " + "font-size: 14px; " + "font-weight: normal; font-style: normal;\"},\"elements\":[{\"colour\":\"#006666\",\"text\"" + ":\"ACTUAL\"," + "\"values\":[11,14,7],\"fill\":\"#006666\",\"font-size\":10,\"fillAlpha\":0.35,\"type\":" + "\"area_line\"}," + "{\"colour\":\"#0066CC\",\"text\":\"BUDGET\",\"values\":[12,9,100],\"fill\":\"#0066CC\"," + "\"font-size\":10," + "\"fillAlpha\":0.35,\"type\":\"area_line\"}],\"x_axis\":{\"colour\":\"#000000\"," + "\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"labels\":{\"labels\":[\"Sales\",\"Finance\"," + "\"Human Resource\"]}}}", c2, when(IGNORING_ARRAY_ORDER));
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testBubbleChart.
@Test
public void testBubbleChart() {
String chart = "<chart>" + "<chart-type>BubbleChart</chart-type>" + "<dataset-type>XYZSeriesCollection</dataset-type>" + "</chart>";
IPentahoResultSet rs = getXYZRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
assertJsonEquals("{\"y_axis\":{\"min\":0,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"max\":110," + "\"steps\":10},\"x_legend\":{\"text\":\"DEPARTMENT\",\"style\":\"font-family: Arial; font-size: 14px; " + "font-weight: normal; font-style: normal;\"},\"elements\":[{\"colour\":\"#006666\",\"dot-size\":1," + "\"text\":\"Sales\",\"values\":[{\"y\":12,\"x\":11}],\"type\":\"scatter\"},{\"colour\":\"#0066CC\"," + "\"dot-size\":5,\"text\":\"Finance\",\"values\":[{\"y\":9,\"x\":14}],\"type\":\"scatter\"}," + "{\"colour\":\"#009999\",\"dot-size\":100,\"text\":\"Human Resource\",\"values\":[{\"y\":100,\"x\":7}]," + "\"type\":\"scatter\"}],\"x_axis\":{\"min\":7,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\"," + "\"stroke\":1,\"max\":14,\"labels\":{}}}", c2, when(IGNORING_ARRAY_ORDER));
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testBarChart.
@Test
public void testBarChart() {
String chart = "<chart>" + "<chart-type>BarChart</chart-type>" + "</chart>";
IPentahoResultSet rs = getRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
assertJsonEquals("{\"y_axis\":{\"min\":0,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"max\":121," + "\"steps\":11},\"x_legend\":{\"text\":\"DEPARTMENT\",\"style\":\"font-family: Arial; font-size: 14px; " + "font-weight: normal; font-style: normal;\"},\"elements\":[{\"colour\":\"#006666\",\"text\":\"ACTUAL\"," + "\"values\":[{\"top\":11},{\"top\":14},{\"top\":7}],\"type\":\"bar\"},{\"colour\":\"#0066CC\"," + "\"text\":\"BUDGET\",\"values\":[{\"top\":12},{\"top\":9},{\"top\":100}],\"type\":\"bar\"}]," + "\"x_axis\":{\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1," + "\"labels\":{\"labels\":[\"Sales\",\"Finance\",\"Human Resource\"]},\"offset\":1}}", c2, when(IGNORING_ARRAY_ORDER));
}
Aggregations