pie charts
pie charts
Save as a template and then load it back (this time I am calling the Chart.Clear() method in between the Save and Load) - not all the Chart 3d options are kept. In fact, Rotation is set back to 360, Elevation - to 315 and Perspective - to 0. Funny think is, if I ever change any of these properties and then do the Save/Load trick - it works. But if I do not touch them when I create the pie - then reloading from template sets different defaults...
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
Values you mention for those properties are default properties. Code below works fine for me here either using commented code or not. Could you please modify it so that we can reproduce the issue here?
Thanks in advance.
Values you mention for those properties are default properties. Code below works fine for me here either using commented code or not. Could you please modify it so that we can reproduce the issue here?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private System.IO.MemoryStream stream;
private void InitializeChart()
{
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
pie1.FillSampleValues();
//tChart1.Aspect.Elevation = 300;
//tChart1.Aspect.Rotation = 300;
//tChart1.Aspect.Perspective = 10;
stream = new System.IO.MemoryStream();
tChart1.Export.Template.Save(stream);
}
private void button1_Click(object sender, EventArgs e)
{
stream.Position = 0;
tChart1.Clear();
tChart1.Import.Template.Load(stream);
}
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 |
Your code works because you have your chart object on the form prior to all the template manipulations. There is some magic happening when you do it this way. So try this one:
This example will demonstrate the way it is used in our system. First, I set up a graph and save it into a template. Close app, go home... Later, I have an option to print a report which is using this graph. At this point I do not have a form do display the graph, all I do is generate output stream with graph in it. Reloading from template in this configuration does not work in your system in a lot of places, since you rely a lot on some drawing events happening in UI, and they are not fired here. Look into my other posts for more problems like this.
Code: Select all
private System.IO.MemoryStream stream;
private void InitializeChart()
{
TChart chart = new TChart();
Pie pie = new Pie(chart.Chart);
pie.FillSampleValues();
chart .Aspect.Elevation = 300;
chart .Aspect.Rotation = 300;
chart .Aspect.Perspective = 10;
stream = new System.IO.MemoryStream();
chart .Export.Template.Save(stream);
}
private void button1_Click(object sender, EventArgs e)
{
stream.Position = 0;
tChart1.Clear();
tChart1.Import.Template.Load(stream);
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
Thanks for the information but I'm not able to reproduce the issue here either using the code you posted. Could you please confirm that your project is using latest TeeChart for .NET v3 release available at the client area, which is build 3.5.3225.32183/4/5 from 3rd November 2008?
Thanks in advance.
Thanks for the information but I'm not able to reproduce the issue here either using the code you posted. Could you please confirm that your project is using latest TeeChart for .NET v3 release available at the client area, which is build 3.5.3225.32183/4/5 from 3rd November 2008?
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 |
Instructions - How to post in this forum |
Try it without setting up the properties:
// after this point place chart on the form and after clicking on the button compare chart and tChart1
So, this will demonstrate (hopefully) that building the chart "behind the curtains", saving it into a template, and then loading it from the template does not produce the same results.
Code: Select all
private System.IO.MemoryStream stream;
private TChart chart;
private void InitializeChart()
{
TChart chart = new TChart();
Pie pie = new Pie(chart.Chart);
pie.FillSampleValues();
stream = new System.IO.MemoryStream();
chart.Export.Template.Save(stream);
}
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
pnlGraph.Controls.Add(chart);
chart.Dock = DockStyle.Fill;
stream.Position = 0;
tChart1.Clear();
tChart1.Import.Template.Load(stream);
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
Sorry but I'm still unable to reproduce this here . I'm using this code:
Charts on the WinForm and exported images are the same. Could you please confirm this code produces the issue at your end?
Thanks in advance.
Sorry but I'm still unable to reproduce this here . I'm using this code:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private System.IO.MemoryStream stream;
private Steema.TeeChart.TChart chart;
private void InitializeChart()
{
chart = new Steema.TeeChart.TChart();
Steema.TeeChart.Styles.Pie pie = new Steema.TeeChart.Styles.Pie(chart.Chart);
pie.FillSampleValues();
stream = new System.IO.MemoryStream();
chart.Export.Template.Save(stream);
}
private void button1_Click(object sender, EventArgs e)
{
this.Controls.Add(chart);
chart.Dock = DockStyle.Fill;
stream.Position = 0;
tChart1.Clear();
tChart1.Import.Template.Load(stream);
//tChart1.Visible = false;
chart.Export.Image.PNG.Save("chart.png");
tChart1.Export.Image.PNG.Save("tChart1.png");
}
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 |
Instructions - How to post in this forum |
Running following code produces 2 different images for me (where tChart1 is placed on the form in the designer):
The difference in the chart objects:
Code: Select all
var chart = new TChart();
var pie = new Pie(chart.Chart);
pie.FillSampleValues();
var stream = new MemoryStream();
chart.Export.Template.Save(stream);
stream.Position = 0;
tChart1.Clear();
tChart1.Import.Template.Load(stream);
chart.Export.Image.PNG.Save("chart.png");
tChart1.Export.Image.PNG.Save("tChart1.png");
- chart
- Orthogonal = true
- Rotation = 345
- Elevation = 345
- Perspective = 15
- tChart1
- Orthogonal = false
- Rotation = 360
- Elevation = 315
- Perspective = 0
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
tChart1 has same settings you mention for chart here. Could you please confirm the exact TeeChart build number you are using and I'll send you an exe compiled here so that you can try using it next to the TeeChart assembly you are using?
Thanks in advance.
tChart1 has same settings you mention for chart here. Could you please confirm the exact TeeChart build number you are using and I'll send you an exe compiled here so that you can try using it next to the TeeChart assembly you are using?
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
And in which Visual Studio version are you using it? It is important for the build number as it's different for each IDE build.
Thanks in advance.
And in which Visual Studio version are you using it? It is important for the build number as it's different for each IDE build.
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
It could be that your project references or AssemblyFolders in your machine hadn't been correctly updated until yesterday.
If you can reproduce the issue again please let us know and we will send you the .exe built here.
Thanks in advance.
It could be that your project references or AssemblyFolders in your machine hadn't been correctly updated until yesterday.
If you can reproduce the issue again please let us know and we will send you the .exe built 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 |
Instructions - How to post in this forum |