예제 #1
0
  @Test
  @Ignore("Phantomjs not installed on our build server")
  public void testWide() throws InterruptedException, URISyntaxException {

    Configuration conf = new Configuration();
    conf.getChart().setType(ChartType.COLUMN);
    conf.getChart().setMarginRight(200);
    Legend legend = conf.getLegend();
    legend.setLayout(LayoutDirection.VERTICAL);
    legend.setHorizontalAlign(HorizontalAlign.RIGHT);
    legend.setVerticalAlign(VerticalAlign.MIDDLE);
    legend.setBorderWidth(0);

    Random r = new Random();

    for (int i = 0; i < 20; i++) {
      String name = RandomStringUtils.randomAlphabetic(r.nextInt(20));
      DataSeries dataSeries = new DataSeries(name);
      dataSeries.add(new DataSeriesItem(name, r.nextInt(100)));
      conf.addSeries(dataSeries);
    }

    SVGGenerator instance = SVGGenerator.getInstance();
    String generatedSVG = instance.generate(conf, 1200, 400);

    Assert.assertTrue(generatedSVG.contains("width=\"1200\""));
    Assert.assertTrue(generatedSVG.contains("height=\"400\""));

    SVGGenerator.getInstance().destroy();
  }