Page 1 of 1

Gauges

Posted: Wed Mar 05, 2014 10:26 am
by 15654539
When I add a gauge, it show the legend, but If i export it and load it again the legend isn't there.
Thanks

Code: Select all

 private void button1_Click(object sender, EventArgs e)
        {
            Steema.TeeChart.Styles.LinearGauge linearGauge = new Steema.TeeChart.Styles.LinearGauge(tChart1.Chart);
            linearGauge.Title = "titulo";
            linearGauge.Tag = "1\tx";
            linearGauge.ShowInLegend = true;
            linearGauge.RedLine.Visible = false;
            linearGauge.GreenLine.Visible = false;
            tChart1.Series.Add(linearGauge);

            tChart1.Series[0].FillSampleValues();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string path = @"c:\gauges.ten";

            tChart1.Export.Template.IncludeData = false;
            tChart1.Export.Template.Save(path);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string path = @"c:\gauges.ten"; 
            tChart1.Import.Template.Load(path);
        }

Re: Gauges

Posted: Thu Mar 06, 2014 9:24 am
by Christopher
wakeup wrote:When I add a gauge, it show the legend, but If i export it and load it again the legend isn't there.
It would be much appreciated if these reproducible defects could be added directly into Steema's bug database http://bugs.teechart.net. I've added this problem in as ID=619, and as you can see it has already been fixed.

The workaround is to set the ShowInLegend property back to true after importation, e.g.

Code: Select all

    System.IO.MemoryStream stream;

    private void button1_Click(object sender, EventArgs e)
    {
      tChart1.Clear();
      Steema.TeeChart.Styles.LinearGauge linearGauge = new Steema.TeeChart.Styles.LinearGauge(tChart1.Chart);
      linearGauge.Title = "titulo";
      linearGauge.Tag = "1\tx";
      linearGauge.ShowInLegend = true;
      linearGauge.RedLine.Visible = false;
      linearGauge.GreenLine.Visible = false;
      tChart1.Series.Add(linearGauge);

      tChart1.Series[0].FillSampleValues();
    }

    private void button2_Click(object sender, EventArgs e)
    {
      stream = new System.IO.MemoryStream();
      tChart1.Export.Template.Save(stream);
    }

    private void button3_Click(object sender, EventArgs e)
    {
      stream.Position = 0;
      tChart1.Import.Template.Load(stream);

      tChart1[0].ShowInLegend = true;
    }