Hi
I am using the charting tool with good success and is proving quite responsive in our applications. This particular
piece of work is using the 3D chart.
I'm trying to save the graph settings between the applications use - Start the app, display some data and make some manual tweaks to axis settings, view the data and close the application.
When the application is run again I want the settings made on the previous run to applied.
My current attempt is to save out the settings to file once the user has made the edits. And similarly when the app is
started any settings are loaded from the saved file. The code I'm using is:
DialogResult res = ChartEditor.ShowModal();
if (res == DialogResult.OK)
Chart.Export.Template.Save(ChartSettingFileName);
It has some success but something isn't right. On restoring the settings the graph the axis ranges are correct but the data does not show.
Is the above code the correct way to achieve what I'm trying to do?
Any other pointers please?
DFB.
Persistent Graph Settings
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Persistent Graph Settings
Hello,
Yes, but first we need to know which version of TeeChart you are using, that is, which platform you are running on (.NET Framework 4, .NET 6.0, WinForm, WPF etc.) as serialization in each is slightly different.Any other pointers please?
Best Regards,
Christopher Ireland / 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: Persistent Graph Settings
Hi
The application hosting the TeeChart control is:
.NET Framework 4.7.2
Windows Application (A desktop .exe)
Thanks.
The application hosting the TeeChart control is:
.NET Framework 4.7.2
Windows Application (A desktop .exe)
Thanks.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Persistent Graph Settings
Hello,
That's great, thank you. Attached a zip file containing a simple .NET Framework 4.x WinForm example of TeeChart. I hope it is of help.
- Attachments
-
- 3DSerialization.zip
- (15.15 KiB) Downloaded 490 times
Best Regards,
Christopher Ireland / 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: Persistent Graph Settings
Hi
Thanks for the code example but it does not help my situation.
The issue is still present in that the axes have no data values, they are set to 0.
1) Invoke the Teechart Editor.
2) With 'Left Axis' selectected uncheck 'Auto' and leave the values as they are.
3) Select close then close the chart which then calls the serialize code you've supplied.
4) Load the chart again and serialize the saved state from before.
The chart walls and one of the axes are present but two of the three axes show no data and are annotated with zero.
To get the chart back to its previous state each of the axes 'Auto' scale settings has to be set and values other than zero need to
be specified.
I can record all of this in a video if it makes it easier?
Thanks for the code example but it does not help my situation.
The issue is still present in that the axes have no data values, they are set to 0.
1) Invoke the Teechart Editor.
2) With 'Left Axis' selectected uncheck 'Auto' and leave the values as they are.
3) Select close then close the chart which then calls the serialize code you've supplied.
4) Load the chart again and serialize the saved state from before.
The chart walls and one of the axes are present but two of the three axes show no data and are annotated with zero.
To get the chart back to its previous state each of the axes 'Auto' scale settings has to be set and values other than zero need to
be specified.
I can record all of this in a video if it makes it easier?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Persistent Graph Settings
Hello,
Doing this gives me the same chart before and after the serialization, e.g.
I have added this issue to our issue-tracking software with id=2514, meaning that a fix to it will become available shortly.
No, I can see what you mean—certainly it's easier with a code example, and I can reproduce what I believe is your issue modifying the code I sent you slightly:
Code: Select all
public Form1()
{
InitializeComponent();
tChart1.Aspect.View3D = true;
tChart1.Aspect.Zoom = 80;
tChart1.Aspect.Orthogonal = false;
tChart1.Aspect.Chart3DPercent = 100;
tChart1.Tools.Add(typeof(Rotate));
var surface = new Surface(tChart1.Chart);
int count = 20;
for (int x = 0; x < count; x++)
{
for (int z = 0; z < count; z++)
{
double y = Math.Cos(x) + Math.Sin(z);
surface.Add(x, y, z);
}
}
tChart1.Axes.Left.Automatic = false; //set left axis to Automatic false
}
private void button1_Click(object sender, EventArgs e)
{
using (var stream = new MemoryStream())
{
tChart1.Export.Template.IncludeData = true; //default setting
tChart1.Export.Template.Save(stream);
stream.Position = 0;
tChart2.Import.Template.Load(stream);
//to get the same chart back we have to set these both to true
tChart2.Axes.Bottom.Automatic = true;
tChart2.Axes.Depth.Automatic = true;
}
}
Best Regards,
Christopher Ireland / 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 |