use of org.dom4j.Node in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method getChartNode.
public static Node getChartNode(String xml) {
try {
Document chartDocument = XmlDom4JHelper.getDocFromString(xml, new PentahoEntityResolver());
Node chartNode = chartDocument.selectSingleNode("chart");
if (chartNode == null) {
chartNode = chartDocument.selectSingleNode("chart-attributes");
}
return chartNode;
} catch (XmlParseException e) {
e.printStackTrace();
}
return null;
}
use of org.dom4j.Node 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.dom4j.Node 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.dom4j.Node 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.dom4j.Node 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