use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testSmallDataFail.
@Test
public void testSmallDataFail() {
String chart = "<chart>" + "<chart-type>BubbleChart</chart-type>" + "<dataset-type>XYZSeriesCollection</dataset-type>" + "</chart>";
IPentahoResultSet rs = getRelationData();
Node chartNode = getChartNode(chart);
try {
PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
Assert.fail();
} catch (RuntimeException e) {
Assert.assertTrue(e.getMessage().toLowerCase().indexOf("xyz") >= 0);
}
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testDotChart.
@Test
public void testDotChart() {
String chart = "<chart>" + "<chart-type>DotChart</chart-type>" + "<dataset-type>XYSeriesCollection</dataset-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\":\"Sales\"," + "\"values\":[{\"y\":12,\"x\":11}],\"type\":\"scatter\",\"tip\":\"Sales: 11, 12\"}," + "{\"colour\":\"#0066CC\"," + "\"text\":\"Finance\",\"values\":[{\"y\":9,\"x\":14}],\"type\":\"scatter\",\"tip\":\"Finance: 14, 9\"}," + "{\"colour\":\"#009999\",\"text\":\"Human Resource\",\"values\":[{\"y\":100,\"x\":7}]," + "\"type\":\"scatter\"," + "\"tip\":\"Human Resource: 7, 100\"}],\"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 getDimensionalData.
public static IPentahoResultSet getDimensionalData() {
IPentahoResultSet ips = null;
ArrayList<String> colHeaders = new ArrayList();
// colHeaders.add(0, "DEPARTMENT");
colHeaders.add(0, "ACTUAL");
colHeaders.add(1, "BUDGET");
colHeaders.add(2, "DIFFERENCE");
ArrayList<String> rowHeaders = new ArrayList();
rowHeaders.add(0, "Sales");
rowHeaders.add(1, "Finance");
rowHeaders.add(2, "Human Resource");
ArrayList r1 = new ArrayList();
r1.add(11);
r1.add(12);
r1.add(1);
ArrayList r2 = new ArrayList();
r2.add(14);
r2.add(9);
r2.add(5);
ArrayList r3 = new ArrayList();
r3.add(7);
r3.add(100);
r3.add(93);
ArrayList data = new ArrayList();
data.add(r1);
data.add(r2);
data.add(r3);
ips = createFromLists(colHeaders, rowHeaders, data);
return ips;
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testBarChartWithProps.
@Test
public void testBarChartWithProps() {
String chart = "<chart>" + "<chart-type>BarChart</chart-type>" + "<is-sketch>true</is-sketch>" + "<fun-factor>10</fun-factor>" + "<plot-background type=\"color\">#FF0000</plot-background>" + "<chart-background type=\"color\">#FF0000</chart-background>" + "<title>TITLE_STR</title>" + "<title-font>" + "<font-family>Arial</font-family>" + "<size>11</size>" + "<is-bold>true</is-bold>" + "<is-italic>true</is-italic>" + "</title-font>" + "<range-minimum>1</range-minimum>" + "<range-maximum>1</range-maximum>" + "<range-color>#0F0000</range-color>" + "<range-grid-color>#00F000</range-grid-color>" + "<range-stroke>123</range-stroke>" + "<range-steps>10</range-steps>" + "<domain-minimum>1</domain-minimum>" + "<domain-maximum>1</domain-maximum>" + "<domain-color>#0F0000</domain-color>" + "<domain-grid-color>#00F000</domain-grid-color>" + "<domain-stroke>123</domain-stroke>" + "<domain-steps>10</domain-steps>" + "<color-palette>" + "<color>#FF0000</color>" + "<color>#00FF00</color>" + "</color-palette>" + "</chart>";
IPentahoResultSet rs = getRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
assertJsonEquals("{\"y_axis\":{\"min\":1,\"colour\":\"#0F0000\",\"grid-colour\":\"#00F000\",\"stroke\":123,\"max\":1}," + "\"title\":{\"text\":\"TITLE_STR\",\"style\":\"font-family: Arial; font-size: 11px; font-weight: bold; " + "font-style: italic;\"},\"inner_bg_colour\":\"#FF0000\",\"x_legend\":{\"text\":\"DEPARTMENT\"," + "\"style\":\"font-family: Arial; font-size: 14px; font-weight: normal; font-style: normal;\"}," + "\"bg_colour\":\"#FF0000\",\"elements\":[{\"colour\":\"#FF0000\",\"text\":\"ACTUAL\"," + "\"outline-colour\":\"#006666\",\"values\":[{\"top\":11},{\"top\":14},{\"top\":7}],\"offset\":10," + "\"type\":\"bar_sketch\"},{\"colour\":\"#00FF00\",\"text\":\"BUDGET\",\"outline-colour\":\"#0066CC\"," + "\"values\":[{\"top\":12},{\"top\":9},{\"top\":100}],\"offset\":10,\"type\":\"bar_sketch\"}]," + "\"x_axis\":{\"colour\":\"#0F0000\",\"grid-colour\":\"#00F000\",\"stroke\":123," + "\"labels\":{\"labels\":[\"Sales\",\"Finance\",\"Human Resource\"]}, \"offset\":1}}", c2, when(IGNORING_ARRAY_ORDER));
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testBarLineChart.
@Test
public void testBarLineChart() {
String chart = "<chart>" + "<chart-type>BarLineChart</chart-type>" + "<bar-series>" + "<series>ACTUAL</series>" + "<series>DIFFERENCE</series>" + "</bar-series>" + "<line-series><series>BUDGET</series></line-series>" + "</chart>";
IPentahoResultSet rs = getXYZRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
// verify there is a right axis, and that there is a y_axis_right
Assert.assertTrue(c2.indexOf("\"axis\":\"right\"") >= 0);
Assert.assertTrue(c2.indexOf("\"y_axis_right\":{") >= 0);
assertJsonEquals("{\"y_axis\":{\"min\":0,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"max\":110," + "\"steps\":10},\"y_axis_right\":{\"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\":[{\"top\":11},{\"top\":14}," + "{\"top\":7}],\"type\":\"bar\"},{\"axis\":\"right\",\"colour\":\"#0066CC\",\"text\":\"BUDGET\"," + "\"values\":[{\"value\":12},{\"value\":9},{\"value\":100}],\"font-size\":10,\"type\":\"line\"}," + "{\"colour\":\"#009999\",\"text\":\"DIFFERENCE\",\"values\":[{\"top\":1},{\"top\":5},{\"top\":93}]," + "\"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