示例#1
0
  /** Constructor */
  public Regression_152033() {
    final PluginSettings ps = PluginSettings.instance();
    try {
      dRenderer = ps.getDevice("dv.JPG"); // $NON-NLS-1$

    } catch (ChartException ex) {
      ex.printStackTrace();
    }
    cm = createDateTimeScatter();
    BufferedImage img = new BufferedImage(600, 600, BufferedImage.TYPE_INT_ARGB);
    Graphics g = img.getGraphics();

    Graphics2D g2d = (Graphics2D) g;
    dRenderer.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, g2d);
    dRenderer.setProperty(IDeviceRenderer.FILE_IDENTIFIER, this.getClassFolder2()); // $NON-NLS-1$
    Bounds bo = BoundsImpl.create(0, 0, 600, 600);
    bo.scale(72d / dRenderer.getDisplayServer().getDpiResolution());

    Generator gr = Generator.instance();

    try {
      gcs = gr.build(dRenderer.getDisplayServer(), cm, bo, null, null, null);
      gr.render(dRenderer, gcs);
    } catch (ChartException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
 SwingLiveChartViewer() {
   try {
     PlatformConfig config = new PlatformConfig();
     config.setProperty("STANDALONE", "true");
     config.setProperty(
         "BIRT_HOME", "D:/wxz/birt 安装/birt-runtime-2_2_1/birt-runtime-2_2_1/ReportEngine");
     this.dRenderer = ChartEngine.instance(config).getRenderer("dv.SWING");
   } catch (ChartException ex) {
     ex.printStackTrace();
   }
 }
  public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    this.dRenderer.setProperty("device.output.context", g2d);
    Dimension d = getSize();
    Bounds bo = BoundsImpl.create(0.0D, 0.0D, d.width, d.height);
    bo.scale(72.0D / this.dRenderer.getDisplayServer().getDpiResolution());

    Generator gr = Generator.instance();
    try {
      this.gcState = gr.build(this.dRenderer.getDisplayServer(), this.cm, bo, null, null, null);
    } catch (ChartException ex) {
      ex.printStackTrace();
    }
    try {
      gr.render(this.dRenderer, this.gcState);
    } catch (ChartException ex) {
      ex.printStackTrace();
    }
  }