Pie chart on teechart java v2

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Pie chart on teechart java v2

Post by newsoft » Fri Feb 20, 2009 4:35 pm

I'm trying the evaluation version 2 and when I try to print or write the image the program goes into the dump. I also tried the applet in the folder examples/swing but also when selecting the styles pie the applet freezes.

Thanks for any suggestions.

This is the error

java.lang.NullPointerException
at com.steema.teechart.drawing.Graphics3DAWT.unClip(Unknown Source)
at com.steema.teechart.styles.Series.clipRegionDone(Unknown Source)
at com.steema.teechart.Chart.internalDraw(Unknown Source)
at com.steema.teechart.Chart.paint(Unknown Source)
at com.steema.teechart.exports.ImageExport.image(Unknown Source)
at com.steema.teechart.Chart.image(Unknown Source)
at com.steema.teechart.exports.ImageExportFormat.save(Unknown Source)
at com.steema.teechart.exports.ImageExportFormat.save(Unknown Source)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Feb 23, 2009 4:50 pm

Hi newsoft,

I'm not able to reproduce the issue here using TeeChart.Features.jar demo nor in a simple example project (see code below). Could you please let us know the exact steps we should follow in the demo or modify code snippet below so that we can reproduce the problem here?

Thanks in advance.

Code: Select all

        try {
            commander1.setChart(tChart1.getChart());

            Pie pie1 = new Pie(tChart1.getChart());
            pie1.fillSampleValues();

            tChart1.getExport().getImage().getJPEG().save("c:\\temp\\piejava.jpg");
        } catch (IOException ex) {
            Logger.getLogger(DesktopApplication1View.class.getName()).log(Level.SEVERE, null, ex);
        }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Post by newsoft » Tue Feb 24, 2009 10:20 am

Hi Narcís,

I use TeeChart.Swing.jar v2 lib evaluation version, this is my example:

Code: Select all

package testteechartpie;

import java.awt.Container;
import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JPanel;

import com.steema.teechart.TChart;
import com.steema.teechart.Chart;
import com.steema.teechart.Commander;
import com.steema.teechart.styles.Series;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.Pie;
import com.steema.teechart.drawing.Color;

final public class nsTCp extends JPanel {
 static  TChart    chart;

 JButton    colorButton;
 JToolBar   oc; // Commander
 Container  cnt;
 JPanel     mPane;//,tPane,bPane;
 Series      ss;

  public static void main(final String[] args) {
     javax.swing.SwingUtilities.invokeLater(new Runnable() {
       public void run() {
         try {
           UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
           nsTCp a=new nsTCp();
           System.exit(0);
         } catch (Exception ex) {
           ex.printStackTrace();
         }
       }
     });
  }

 public nsTCp()  {
  super(new BorderLayout());
   com.steema.teechart.exports.ImageExport img;
   cnt =this;

   // ** OK bar.jp is created**
   displayChart(1);
   try {
     chart.getChart().getExport().getImage().getJPEG().save("bar.jpg");
   } catch (Exception e) {
     e.printStackTrace();
     System.err.println(e.toString());
   }

   // ** ERROR pie.jpg is empty **
   displayChart(2);
   try {
     chart.getChart().getExport().getImage().getJPEG().save("pie.jpg");
   } catch (Exception e) {
     e.printStackTrace();
     System.err.println(e.toString());
   }
 }


 private void displayChart(int tp) {
  Chart  c;
   setChartLayout(1);

   if (tp==1) {
     c =chart.getChart();
     Bar b =new Bar();
     b.fillSampleValues(15);
     c.addSeries(b);
   } else {  
     c =chart.getChart();
     Pie b =new Pie();
     b.fillSampleValues(15);
     c.addSeries(b);
   }
   chart.setVisible(true);
 }

 private void setChartLayout(int tp) {
   mPane = new JPanel();
   mPane.setLayout(new BorderLayout());
   mPane.setBackground(Color.yellow);
   cnt.add(mPane,BorderLayout.CENTER);
   chart =new com.steema.teechart.TChart();

   Commander oc_tmp;
   oc_tmp =new Commander(chart.getChart());
   oc_tmp.setLabelValues(true);
   oc =(Commander)oc_tmp;

   if (oc!=null) {
     oc.setEnabled(true);
     oc.setVisible(true);
     mPane.add(oc,BorderLayout.PAGE_START);
   }
   mPane.add(chart, BorderLayout.CENTER);
   chart.setHeight(cnt.getHeight() - (oc!=null ? oc.getHeight() : 0));
   chart.setWidth (cnt.getWidth() );
   if (oc!=null) {chart.setLocation(0,oc.getHeight());}

 }
}
The java version is build 1.6.0_11-b03.
Let me remind you that in the example Examples/Swing/Applet/TChartAppletDemo.htm when I select the pie chart applet hangs.

Thank you for your replay.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 24, 2009 1:00 pm

Hi newsoft,
The java version is build 1.6.0_11-b03.
It's not clear to us which is the TeeChart version you are using. This seems to be the Java Runtime Environment version number. At Steema Software's version info page you can see the exact releases for each TeeChart version. Below you can find TeeChart for Java v1 and v2 release notes:

http://www.steema.com/files/public/teec ... tJava1.txt
http://www.steema.com/files/public/teec ... tJava2.txt

Your code is very similar to the code snippet I posted. Does it work fine at your end? Could you please modify it so that we can reproduce the problem here?
Let me remind you that in the example Examples/Swing/Applet/TChartAppletDemo.htm when I select the pie chart applet hangs.
We will investigate this but works fine here:

http://www.steema.com/products/teechart ... etDemo.htm
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Post by newsoft » Wed Feb 25, 2009 12:34 pm

Hi Narcís,

the version is not the same, the link that you have specified using the evaluation version 2.0.0.701 while the one I use is the evaluation 2.0.0.771, downloaded from your site. I think this is the problem, can you tell me where to download the TeeChart.Swing.jar 2.0.0.701 version.

Thank you.

newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Post by newsoft » Wed Feb 25, 2009 2:42 pm

I downloaded again from the "private customer downloads" the trial version but it is always the 2.0.0.771.

The site writes:
TeeChart Pro for Java -- Evaluation version

Download:

Latest Binary version: 24th Nov 2008, Build 2.0.0.701.
Installer File hash (reg. ver): MD5: 11C0AE040F9EC5493F6829CE124C6CF8
(eval. ver): MD5: 40D6317232DE7644CA20BB34D00AD905

Click here to download TeeChart for Java Evaluation version 2
(compiled binary classes, demos and documentation) 17MB (updated 22nd Jan 09)
but it's false, the version is'nt 2.0.0.701, the download link is: http://www.teechart.net/files/java/publ ... uation.zip.

Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 25, 2009 3:04 pm

Hi newsoft,

Thanks for the information. This is possibly because the Evaluation version could be built later and hence small difference in build number. However, could you please check if the code snippet I posted works fine for you or can you modify it so that we can reproduce the problem here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Post by newsoft » Wed Feb 25, 2009 3:53 pm

Hi Narcís,

Sorry if I do not do other tests, but in the version I downloaded the applet hangs when you select the pie chart, it is enough that you download, unzip and run the demo applet in the folder Examples/Swing/Applet, you'll see that it crashes. Basically if you try the version 2.0.0.771 to 2.0.0.701 place you'll see that the problem occurs. You can also try to http://www.studiomuscella.it/teechart/T ... etDemo.htm I have done from different computers and the problem still occurs.

Thank you and sorry for my English, I am using a translator and my little knowledge of the language.

newsoft
Newbie
Newbie
Posts: 8
Joined: Mon Oct 15, 2001 4:00 am

Post by newsoft » Wed Feb 25, 2009 5:01 pm

Hi Narcís,

I found the old version, and without changing anything in the source everything works perfectly, this is proof that there is a problem on the pie charts in the new version (2.0.0.771).

Thanks for your support.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Feb 27, 2009 8:03 am

Hi newsoft,

Thanks for the information.

I can't reproduce this. Neither using the demo you posted nor using our current source code so you may expect the issue being solved for the next maintenance release. You could also try checking if there's any Java upgrade that can be applied to your environment.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply