Bar Series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Bar Series

Post by UserLS » Wed Nov 05, 2008 9:28 pm

When I save a bar series as template and the reload it, I lose BarWidthPercent value.

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

Post by Narcís » Thu Nov 06, 2008 9:48 am

Hi Profitstar,

Code below works fine for me here using latest v3 release available at the download area. Could you please check if it works fine for you and modify to code snippet so that we can reproduce the issue here?

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private System.IO.MemoryStream stream;

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;

			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.FillSampleValues();
			bar1.BarWidthPercent = 100;

			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);
		}
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Bar series

Post by UserLS » Thu Nov 06, 2008 4:43 pm

Yes, it helps, when you use the right property :)

But I have another issue when I save and load a template - I am loosing gradient colors and border color:

Code: Select all

            Chart1.Export.Template.Save(fileName);
            Chart1.Import.Template.Load(fileName);
Any ideas?

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

Post by Narcís » Thu Nov 06, 2008 4:56 pm

Hi Profitstar,

This also works fine for me here using this code:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private System.IO.MemoryStream stream;

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
      bar1.FillSampleValues();
      bar1.Pen.Color = Color.Red;
      bar1.Gradient.Visible = true;
      bar1.Gradient.StartColor = Color.Red;
      bar1.Gradient.EndColor = Color.White;

      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);
    }
Could you please check if it works fine at your end and modify code snippet above to reproduce the issue here?
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Bar series

Post by UserLS » Thu Nov 06, 2008 7:41 pm

When I add bar series using your editor those colors are coming through the Save/Load procedure just fine. But if I create a bar series in my code and just set up all the properties, then the colors are lost in the reload procedure.

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 Nov 07, 2008 9:48 am

Hi Profitstar,

Thanks for the information. In the example I posted Bar series is created programmatically and all properties persists when saving/loading the chart. Could you please modify the code snippet I posted 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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Fri Nov 07, 2008 4:28 pm

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private MemoryStream stream;

    private void InitializeChart()
    {
      TChart chart = new TChart();
      chart.Aspect.View3D = false;

      Bar bar = new Bar(chart.Chart);
      bar.FillSampleValues();
      bar.Pen.Color = Color.Red;
      bar.Gradient.Visible = true;
      bar.Gradient.StartColor = Color.Red;
      bar.Gradient.EndColor = Color.White;

      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);
    }

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 Nov 07, 2008 4:44 pm

Hi Profitstar,

Thanks for your code but I'm not able to reproduce this too. Could you please confirm the exact TeeChart build number 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
Image Image Image Image Image Image
Instructions - How to post in this forum

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Fri Nov 07, 2008 7:27 pm

Sorry, I've missed one obviously very important detail: you actually must set the series color like in the following example:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private MemoryStream stream;

    private void InitializeChart()
    {
      TChart chart = new TChart();

      Bar bar = new Bar(chart.Chart);
      bar.Color = Color.Navy;
      bar.FillSampleValues();
      bar.Pen.Color = Color.Yellow;
      bar.Gradient.Visible = true;
      bar.Gradient.StartColor = Color.Red;
      bar.Gradient.EndColor = Color.White;

      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);
    } 

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 Nov 10, 2008 9:31 am

Hi Profitstar,

Thanks for the information. I could finally reproduce the issue here and added it (TF02013551) to the defect list to be fixed for next releases.
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