Page 1 of 1

Bar Series

Posted: Wed Nov 05, 2008 9:28 pm
by 14045174
When I save a bar series as template and the reload it, I lose BarWidthPercent value.

Posted: Thu Nov 06, 2008 9:48 am
by narcis
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.

Bar series

Posted: Thu Nov 06, 2008 4:43 pm
by 14045174
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?

Posted: Thu Nov 06, 2008 4:56 pm
by narcis
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?

Bar series

Posted: Thu Nov 06, 2008 7:41 pm
by 14045174
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.

Posted: Fri Nov 07, 2008 9:48 am
by narcis
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.

Posted: Fri Nov 07, 2008 4:28 pm
by 14045174

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

Posted: Fri Nov 07, 2008 4:44 pm
by narcis
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.

Posted: Fri Nov 07, 2008 7:27 pm
by 14045174
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);
    } 

Posted: Mon Nov 10, 2008 9:31 am
by narcis
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.