TChart serializable problem
TChart serializable problem
hello,
I see that TChart implements Serializable.
Does it support to save TChart to a file and restore it form the file?
I mean:
if i have an instance
TChart chart = ...;
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("chart.dat"));
out.writeObject(chart);
//in another place
ObjectInputStream in = new ObjectInputStream(new FileInputStream("chart.dat"));
TChart chart2 = (TChart)in.readObject();
In this way, i can get the original TChart.
I have tried this.
but it fail.
Do you know how to solve this? thanks.
I see that TChart implements Serializable.
Does it support to save TChart to a file and restore it form the file?
I mean:
if i have an instance
TChart chart = ...;
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("chart.dat"));
out.writeObject(chart);
//in another place
ObjectInputStream in = new ObjectInputStream(new FileInputStream("chart.dat"));
TChart chart2 = (TChart)in.readObject();
In this way, i can get the original TChart.
I have tried this.
but it fail.
Do you know how to solve this? thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: TChart serializable problem
Hi rubby,
Yes, this is possible using TeeChart native template files (.tej in Java). You'll find more specific information in Tutorial 9. Exporting and Importing Charts. Tutorials can be found at the Docs folder in TeeChart's installation.
Yes, this is possible using TeeChart native template files (.tej in Java). You'll find more specific information in Tutorial 9. Exporting and Importing Charts. Tutorials can be found at the Docs folder in TeeChart's installation.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Re: TChart serializable problem
Hello,
Thanks.
But when I try one example of TeeChart for Swing, its path is All features-->Chart styples --> Bar --> Negative Stacked.
In the poped edit dialog, I export its template as xml format,
Some errors happen,
java.lang.NullPointerException
at com.steema.teechart.Aspect.getTextSmooth(Aspect.java:234)
Thanks.
But when I try one example of TeeChart for Swing, its path is All features-->Chart styples --> Bar --> Negative Stacked.
In the poped edit dialog, I export its template as xml format,
Some errors happen,
java.lang.NullPointerException
at com.steema.teechart.Aspect.getTextSmooth(Aspect.java:234)
Re: TChart serializable problem
Hi,
I've just run TeeChart.Features.jar from TeeChart Java Suite with SourceCode v3.2013.0517. I went to the "Negative Stacked" example, opened the editor, navigated to the "Export\Template" tab. Checked the "XML Format" checkbox and pressed "Save" button.
Find attached the xml generated. It looks correct. Do you see any difference between what we are doing?
I've just run TeeChart.Features.jar from TeeChart Java Suite with SourceCode v3.2013.0517. I went to the "Negative Stacked" example, opened the editor, navigated to the "Export\Template" tab. Checked the "XML Format" checkbox and pressed "Save" button.
Find attached the xml generated. It looks correct. Do you see any difference between what we are doing?
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
Re: TChart serializable problem
Hello, Yeray
I did not run it by the TeeChart.Features.jar.
I put the releated example code into netbeans, and run the example from netbeans.
in the output window of nebeans, some errors display.
I think even there is error, the TeeChart.Features.jar has no place to show it, because the error will be catched.
Thanks.
I did not run it by the TeeChart.Features.jar.
I put the releated example code into netbeans, and run the example from netbeans.
in the output window of nebeans, some errors display.
I think even there is error, the TeeChart.Features.jar has no place to show it, because the error will be catched.
Thanks.
Re: TChart serializable problem
Hi,
Although I get a correct xml file, I get many errors with the Suite with Sources v3.2013.0517. Find the errors attached (I attached a text file because the string is too long for a post).
However, I don't get any error with the actual sources we have here, so they shouldn't appear in the next version.
Although I get a correct xml file, I get many errors with the Suite with Sources v3.2013.0517. Find the errors attached (I attached a text file because the string is too long for a post).
However, I don't get any error with the actual sources we have here, so they shouldn't appear in the next version.
- Attachments
-
- errors.zip
- (8.46 KiB) Downloaded 1335 times
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
Re: TChart serializable problem
yes. I encount similar errors too.
Because of them,
when i export TChart and import them then, it fails or some properties are not effected.
Because of them,
when i export TChart and import them then, it fails or some properties are not effected.
Re: TChart serializable problem
Hello Yeray,
Is it possible to give me the new version of source to aviod to exporting errors?
Thanks.
Is it possible to give me the new version of source to aviod to exporting errors?
Thanks.
Re: TChart serializable problem
Hello,
I'll send you a mail with a link to download a private testing version.
I'll send you a mail with a link to download a private testing version.
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
Re: TChart serializable problem
Hello, I download the new version TeeChartJava 2013.1219.
But the export import functions still have some problem.
My goal is exporting Tchat to tej or xml, then when i load it, it should be the same to the one i stored.
But this is false.
the following is my code.
1. tej xml problem
I store the Tchart to c:\\tt23.xml and c:\\tt23.tej. (Stored Chart.png)
But when i load c:\\tt23.xml, the X axix label is not "MyXLabel-2". (xml loaded.png)
when i load c:\\tt23.tej, the "Stored chart" does not showed. Nothing changed (tej loaded.png)
What's more, there are some errors in the IDE outp0ut. My IDE is netbeans.
2. i want to know how to calculate the correct position of label item. so "MyXLabel-1" and "MyXLabel-2" can be presented correctly.
"bottom.getLabels().getItems().add((double) 0, "MyXLabel-1");" // in fact i want to add "MyXLabel-1" as the first label
Thanks.
But the export import functions still have some problem.
My goal is exporting Tchat to tej or xml, then when i load it, it should be the same to the one i stored.
But this is false.
the following is my code.
Code: Select all
import com.steema.teechart.Rectangle;
import com.steema.teechart.TChart;
import com.steema.teechart.axis.Axis;
import com.steema.teechart.drawing.Color;
import com.steema.teechart.editors.ChartEditor;
import com.steema.teechart.styles.Bar;
import com.steema.teechart.styles.HorizBar;
import com.steema.teechart.styles.Series;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import com.steema.teechart.styles.Box;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
* 测试TeeChart使用
* @author tom
*/
public class TestTeeChart {
/**
* @param args
* the command line arguments
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
Logger.getLogger(TestTeeChart.class.getName()).log(Level.SEVERE, null, ex);
}
MenuFrame frame = new MenuFrame();
frame.initChart();
frame.setVisible(true);
}
}
class MenuFrame extends JFrame {
public static final Color FEATURES_TREECOLOR = new Color(234, 238, 255);
public static final String FEATURES_URL = "features/features.xml";
public static final String NEW_FEATURES_URL = "features/new.xml";
private TChart tChart = null;
public MenuFrame() {
JFrame.setDefaultLookAndFeelDecorated(true);
this.setTitle("TeeChart for java");
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
this.setLayout(new BorderLayout());
JMenuBar menuBar = new JMenuBar();
JMenu opMenu = new JMenu("Operation");
JMenuItem saveItem = new JMenuItem("save");
JMenuItem openItem = new JMenuItem("load");
JMenuItem editItem = new JMenuItem("edit");
opMenu.add(saveItem);
opMenu.add(openItem);
opMenu.add(editItem);
saveItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (tChart != null) {
try {
tChart.setText("Stored chart");
tChart.getSeries(0).setTitle("StoreA");
tChart.getSeries(1).setTitle("StoreB");
Axis bottom = tChart.getAxes().getBottom();
System.out.println(bottom.getLabels().getItems().size());
bottom.getLabels().getItems().add((double) 0, "MyXLabel-1");
bottom.getLabels().getItems().add((double) 1, "MyXLabel-2");
tChart.repaint();
JOptionPane.showMessageDialog(null, "Current tchart will be stored");
tChart.getExport().getTemplate().toFile("c:\\tt23.tej");
tChart.getExport().getTemplate().toXML("c:\\tt23.xml");
tChart.getAspect().setView3D(true);
tChart.setText("New Chart");
tChart.getSeries(0).setTitle("new A");
tChart.getSeries(1).setTitle("new B");
bottom = tChart.getAxes().getBottom();
System.out.println(bottom.getLabels().getItems().size());
bottom.getLabels().getItems().clear();
bottom.getLabels().getItems().set( 0, "new-1");
tChart.repaint();
} catch (IOException ex) {
Logger.getLogger(MenuFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
openItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (tChart != null) {
try {
// tChart.getImport().getTemplate().fromFile("c:\\tt23.tej"); //load fail
tChart.getImport().getTemplate().fromXML("c:\\tt23.xml");
tChart.updateUI();
tChart.repaint();
} catch (Exception ex) {
Logger.getLogger(MenuFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
editItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (tChart != null) {
ChartEditor.editChart(tChart.getChart());
}
}
});
menuBar.add(opMenu);
setJMenuBar(menuBar);
pack();
this.setSize(600, 800);
setLocationRelativeTo(null);
// setVisible(true);
}
public void initChart() {
tChart = new TChart();
tChart.addSeries(new Bar());
tChart.getSeries(0).add(1, 10);
tChart.getSeries(0).add(2, 15);
tChart.getSeries(0).setTitle("A series");
tChart.addSeries(new Bar());
tChart.getSeries(1).add(1, 20);
tChart.getSeries(1).add(2, 35);
tChart.getSeries(1).setTitle("Bseries");
tChart.setBounds(new Rectangle(0, 0, 500, 500));
//设置图标的属性
tChart.getAspect().setView3D(false); // no 3D
this.add(tChart, BorderLayout.CENTER);
JButton button = new JButton("Edit");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ChartEditor.editChart(tChart.getChart());
}
});
this.add(button, BorderLayout.NORTH);
}
}
I store the Tchart to c:\\tt23.xml and c:\\tt23.tej. (Stored Chart.png)
But when i load c:\\tt23.xml, the X axix label is not "MyXLabel-2". (xml loaded.png)
when i load c:\\tt23.tej, the "Stored chart" does not showed. Nothing changed (tej loaded.png)
What's more, there are some errors in the IDE outp0ut. My IDE is netbeans.
2. i want to know how to calculate the correct position of label item. so "MyXLabel-1" and "MyXLabel-2" can be presented correctly.
"bottom.getLabels().getItems().add((double) 0, "MyXLabel-1");" // in fact i want to add "MyXLabel-1" as the first label
Thanks.
- Attachments
-
- xml loaded.png (16.29 KiB) Viewed 31241 times
-
- tej loaded.png (19.63 KiB) Viewed 31246 times
-
- Stored Chart.png (16.22 KiB) Viewed 31245 times
Re: TChart serializable problem
After the program runs. please click operation--> save.
Then click operation--> load
The output errors are:
java.lang.NullPointerException
at com.steema.teechart.drawing.Gradient.getCustomTargetRectangle(Gradient.java:448)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244)
at java.beans.Statement.invokeInternal(Statement.java:239)
at java.beans.Statement.access$000(Statement.java:39)
at java.beans.Statement$2.run(Statement.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Statement.invoke(Statement.java:137)
at java.beans.Expression.getValue(Expression.java:98)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:210)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:97)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeObject1(Encoder.java:206)
at java.beans.Encoder.cloneStatement(Encoder.java:219)
at java.beans.Encoder.writeStatement(Encoder.java:250)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:331)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:260)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:168)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:109)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:98)
at com.teechart.test.MenuFrame$2.actionPerformed(TestTeeChart.java:117)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.lang.NullPointerException
at com.steema.teechart.drawing.Gradient.getCustomTargetRectangle(Gradient.java:448)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244)
at java.beans.Statement.invokeInternal(Statement.java:239)
at java.beans.Statement.access$000(Statement.java:39)
at java.beans.Statement$2.run(Statement.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Statement.invoke(Statement.java:137)
at java.beans.Expression.getValue(Expression.java:98)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:210)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:97)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeObject1(Encoder.java:206)
at java.beans.Encoder.cloneStatement(Encoder.java:219)
at java.beans.Encoder.writeStatement(Encoder.java:250)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:331)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:260)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:168)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:109)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:98)
at com.teechart.test.MenuFrame$2.actionPerformed(TestTeeChart.java:117)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Then click operation--> load
The output errors are:
java.lang.NullPointerException
at com.steema.teechart.drawing.Gradient.getCustomTargetRectangle(Gradient.java:448)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244)
at java.beans.Statement.invokeInternal(Statement.java:239)
at java.beans.Statement.access$000(Statement.java:39)
at java.beans.Statement$2.run(Statement.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Statement.invoke(Statement.java:137)
at java.beans.Expression.getValue(Expression.java:98)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:210)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:97)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeObject1(Encoder.java:206)
at java.beans.Encoder.cloneStatement(Encoder.java:219)
at java.beans.Encoder.writeStatement(Encoder.java:250)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:331)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:260)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:168)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:109)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:98)
at com.teechart.test.MenuFrame$2.actionPerformed(TestTeeChart.java:117)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.lang.NullPointerException
at com.steema.teechart.drawing.Gradient.getCustomTargetRectangle(Gradient.java:448)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244)
at java.beans.Statement.invokeInternal(Statement.java:239)
at java.beans.Statement.access$000(Statement.java:39)
at java.beans.Statement$2.run(Statement.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Statement.invoke(Statement.java:137)
at java.beans.Expression.getValue(Expression.java:98)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:210)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.DefaultPersistenceDelegate.doProperty(DefaultPersistenceDelegate.java:212)
at java.beans.DefaultPersistenceDelegate.initBean(DefaultPersistenceDelegate.java:247)
at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeExpression(Encoder.java:279)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:372)
at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:97)
at java.beans.Encoder.writeObject(Encoder.java:54)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:257)
at java.beans.Encoder.writeObject1(Encoder.java:206)
at java.beans.Encoder.cloneStatement(Encoder.java:219)
at java.beans.Encoder.writeStatement(Encoder.java:250)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:331)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:260)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:168)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:109)
at com.steema.teechart.exports.TemplateExport.toXML(TemplateExport.java:98)
at com.teechart.test.MenuFrame$2.actionPerformed(TestTeeChart.java:117)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Re: TChart serializable problem
Hi,
Thanks for the info. We'll investigate it and reply you here asap.
Thanks for the info. We'll investigate it and reply you here asap.
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
Re: TChart serializable problem
Hello rubby,
We've made some tests with the Swing features demo shipped with the installation, concretely with the example at "All features\Welcome!\Exporting\Native binary format".
- With NetBeans, create a "new project from existing sources" and use the features demo project at "Examples\Swing\Features\src\features"
- Open the project properties and make it use the TeeChart.Swing.jar at the Libraries menu.
- Change TemplateDemo.java with the following:
It seems to work without problems:
It also shows the same good result if I change the code for the "run button" to use a tej file instead of a memory stream:
So, try adding the copyChart.refreshControl(); call after importing the tej file.
Also please check your project is referencing the correct jar and not a TeeChart.Swing.jar from a previous version.
We've made some tests with the Swing features demo shipped with the installation, concretely with the example at "All features\Welcome!\Exporting\Native binary format".
- With NetBeans, create a "new project from existing sources" and use the features demo project at "Examples\Swing\Features\src\features"
- Open the project properties and make it use the TeeChart.Swing.jar at the Libraries menu.
- Change TemplateDemo.java with the following:
Code: Select all
protected void initChart() {
super.initChart();
copyChart = new TChart();
chart1.addSeries(new Bar());
chart1.getSeries(0).add(1, 10);
chart1.getSeries(0).add(2, 15);
chart1.getSeries(0).setTitle("A series");
chart1.addSeries(new Bar());
chart1.getSeries(1).add(1, 20);
chart1.getSeries(1).add(2, 35);
chart1.getSeries(1).setTitle("Bseries");
chart1.setText("Stored chart");
chart1.getSeries(0).setTitle("StoreA");
chart1.getSeries(1).setTitle("StoreB");
Axis bottom = chart1.getAxes().getBottom();
System.out.println(bottom.getLabels().getItems().size());
bottom.getLabels().getItems().add((double) 0, "MyXLabel-1");
bottom.getLabels().getItems().add((double) 1, "MyXLabel-2");
}
Code: Select all
public void actionPerformed(ActionEvent ae) {
Object source = ae.getSource();
if (source == editButton) {
ChartEditor.editChart(chart1.getChart());
} else if (source == editButton2) {
ChartEditor.editChart(copyChart.getChart());
} else if (source == runButton) {
try {
chart1.getExport().getTemplate().toFile("C:\\tmp\\serialiseTest.tej");
} catch (FileNotFoundException ex) {
Logger.getLogger(TemplateDemo.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TemplateDemo.class.getName()).log(Level.SEVERE, null, ex);
}
try {
copyChart.setChart(copyChart.getImport().getTemplate().fromFile("C:\\tmp\\serialiseTest.tej"));
} catch (FileNotFoundException ex) {
Logger.getLogger(TemplateDemo.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(TemplateDemo.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(TemplateDemo.class.getName()).log(Level.SEVERE, null, ex);
}
copyChart.refreshControl();
}
}
Also please check your project is referencing the correct jar and not a TeeChart.Swing.jar from a previous version.
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
Re: TChart serializable problem
Hello, Yeray,
thank you sincerely for your reply.
1. I am sure that my project is referencing the correct jar, TeeChart.Swing.jar from directory TeeChartJavaSrc_3.2013.1219.
So it is the latest version. I have checked this several times.
2. your test is using the example at "All features\Welcome!\Exporting\Native binary format".
But "MyXLabel-1" is still not showed corrected. only "MyXLabel-2" is showed.
3. Yes, I believe there is no error in your test. I also try your test immediately. But one test may be not enough.
Could you please spend some time on my test example and tell me what's wrong with it?
I think my test example uses the correct export and import methods provided with TeeChart.
After my example started, I click operation--> save.
Then click operation--> load, the saved tchart will not presented correctly.
I am confused with this problem for several months.
thanks again for your time and reply.
thank you sincerely for your reply.
1. I am sure that my project is referencing the correct jar, TeeChart.Swing.jar from directory TeeChartJavaSrc_3.2013.1219.
So it is the latest version. I have checked this several times.
2. your test is using the example at "All features\Welcome!\Exporting\Native binary format".
But "MyXLabel-1" is still not showed corrected. only "MyXLabel-2" is showed.
3. Yes, I believe there is no error in your test. I also try your test immediately. But one test may be not enough.
Could you please spend some time on my test example and tell me what's wrong with it?
I think my test example uses the correct export and import methods provided with TeeChart.
After my example started, I click operation--> save.
Then click operation--> load, the saved tchart will not presented correctly.
I am confused with this problem for several months.
thanks again for your time and reply.
Re: TChart serializable problem
Hello,
In your sample code you are adding data at X 1 and 2:
..and you are adding the labels at 0 and 1. At 0 there is no data and so no label appears. There are other ways to paint labels at all locations if required.
Alternatively there are different approaches to adding labels.
For example you could add them with the data:
will give the following output:
or you can override the default labels as you have done (here applying the index to two of the points that have been added):
That will give the following output:
I hope that may be of help.
Regards,
Marc Meumann
In your sample code you are adding data at X 1 and 2:
Code: Select all
chart1.addSeries(new Bar());
chart1.getSeries(0).add(1, 10);
chart1.getSeries(0).add(2, 15);
chart1.getSeries(0).setTitle("A series");
Code: Select all
bottom.getLabels().getItems().add((double) 0, "MyXLabel-1");
bottom.getLabels().getItems().add((double) 1, "MyXLabel-2");
For example you could add them with the data:
Code: Select all
com.steema.teechart.styles.Bar bar = new com.steema.teechart.styles.Bar(chart1.getChart());
bar.clear();
bar.add(0, 123, "ABC", Color.RED);
bar.add(1, 456, "DEF", Color.BLUE);
bar.add(2, 321, "GHI", Color.GREEN);
bar.add(3, 321, "JKL", Color.YELLOW);
chart1.getSeries(0).setTitle("A series");
or you can override the default labels as you have done (here applying the index to two of the points that have been added):
Code: Select all
com.steema.teechart.styles.Bar bar = new com.steema.teechart.styles.Bar(chart1.getChart());
bar.clear();
bar.add(0, 123, "ABC", Color.RED);
bar.add(1, 456, "DEF", Color.BLUE);
bar.add(2, 321, "GHI", Color.GREEN);
bar.add(3, 321, "JKL", Color.YELLOW);
chart1.getSeries(0).setTitle("A series");
chart1.getAxes().getBottom().getLabels().getItems().add((double) 0, "MyXLabel-1");
chart1.getAxes().getBottom().getLabels().getItems().add((double) 1, "MyXLabel-2");
I hope that may be of help.
Regards,
Marc Meumann
Steema Support