Example #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();
    }
  }
 /** The SWT paint callback */
 public void paintControl(PaintEvent pe) {
   if (chart == null) return;
   try {
     render.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, pe.gc);
     Composite co = (Composite) pe.getSource();
     Rectangle re = co.getClientArea();
     Bounds bo = BoundsImpl.create(re.x, re.y, re.width, re.height);
     bo.scale(72d / render.getDisplayServer().getDpiResolution());
     Generator gr = Generator.instance();
     state = gr.build(render.getDisplayServer(), chart, bo, null, null, null);
     gr.render(render, state);
   } catch (ChartException e) {
     //     e.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();
    }
  }