Package lupos.event.consumer.app.charts

Examples of lupos.event.consumer.app.charts.DataModel


  private String analyseChartBlock(String chartBlock, QueryResult queryResult){
   
    StringBuffer result = new StringBuffer("data:image/jpeg;base64,");
    String chartTyp, variables, line = new String();
    int width, height;
    DataModel dm;
    ByteArrayOutputStream output=new ByteArrayOutputStream();
    Pattern pattern = Pattern.compile(Encode.OPTIONS + "\\((.*?),(.*?),width=(.*?),height=(.*?)\\)" + Encode.END + "(.*)");
   
   
    Matcher matcher = pattern.matcher(chartBlock);
   
    if (matcher.find()){
      chartTyp = matcher.group(1);
      variables = matcher.group(2);
      variables = variables.replaceAll("\\?", "");
      width = Integer.parseInt(matcher.group(3));
      height = Integer.parseInt(matcher.group(4));
      line = matcher.group(5);
      dm = ChartFactory.getModel(chartTyp, variables.split(","), queryResult);
      output = dm.asImage(width, height)
      result.append(Base64.encodeBase64String(output.toByteArray()));
      line = replaceImage(result.toString(), line);
      line = replaceLegend(dm.getLegend(), line);
    }
   
    return line;
   
  }
View Full Code Here

TOP

Related Classes of lupos.event.consumer.app.charts.DataModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.