Page 1 of 1

text disappearing from annotation/rectangle tool

Posted: Tue May 05, 2009 8:37 am
by 13046648
Hi,

I have a chart with multiple fastline series. I display a rectangle tool on the chart and update the text dynamically when a user clicks a series. Everything works fine until I deselect all but one serie in the ChartListBox,
then the text disappears from the rectangle tool. Though when doubleclicking the tool to edit the text, the text is there in the editbox. Also when changing the text in the tool by clicking another point on the remaining serie you see it resizing. Only no text can be seen. When reselecting a second serie in the ChartListBox the text is there again.


The code I use to create the rectangel tool:

Code: Select all

            this.m_resultAnnotation = new Steema.TeeChart.Tools.RectangleTool();
            this.m_resultAnnotation.AllowDrag = true;
            this.m_resultAnnotation.AllowEdit = true;
            this.m_resultAnnotation.AutoSize = true;
            this.m_resultAnnotation.Shape.Transparency = 50;
            this.m_resultAnnotation.Text = text;
            this.m_resultAnnotation.Position = Steema.TeeChart.Tools.AnnotationPositions.RightTop;
            this.m_resultAnnotation.Shape.Shadow.Visible = true;
            this.m_resultAnnotation.Cursor = Cursors.Hand;
            this.tChart1.Tools.Add(this.m_resultAnnotation);
(I use to use the annotation tool first, same problem there.)

I'm using Teechart version 3.5.3371.26405

Posted: Wed May 06, 2009 10:38 am
by narcis
Hi DieterDHoker,

I'm not able to reproduce the issue here using code below. Using a ChartListBox instead of legend checkboxes makes no difference. Could you please modify the code snippet below and let us know the exact steps we should follow so that we can reproduce the issue here?

Code: Select all

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

		private Steema.TeeChart.Tools.RectangleTool rectangle1;

		private void InitializeChart()
		{
			for (int i = 0; i < 5; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());
				tChart1[i].FillSampleValues();
			}

			rectangle1 = new Steema.TeeChart.Tools.RectangleTool(tChart1.Chart);
			rectangle1.Text = "No series selected";
			rectangle1.AutoSize = true;

			tChart1.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
			tChart1.Legend.CheckBoxes = true;
		}

		void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, MouseEventArgs e)
		{
			rectangle1.Text = s.Title;
		}
Thanks in advance.

Posted: Wed May 06, 2009 1:25 pm
by 13046648
Hi,

I took me a while to reproduce it using the testprogramm, but here the clue was using the ChartListBox while NOT using the legend checkboxes. (if you use both everything works ok)

so your code would become:

Code: Select all

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

        private Steema.TeeChart.Tools.RectangleTool rectangle1;

        private void InitializeChart()
        {
            for (int i = 0; i < 5; i++)
            {
                tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());
                tChart1[i].FillSampleValues();
            }

            rectangle1 = new Steema.TeeChart.Tools.RectangleTool(tChart1.Chart);
            rectangle1.Text = "No series selected";
            rectangle1.AutoSize = true;

            tChart1.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
            //tChart1.Legend.CheckBoxes = true;
        }

        void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, MouseEventArgs e)
        {
            rectangle1.Text = s.Title;
        }
(+ CharListBox added in the designer)

Posted: Wed May 06, 2009 1:45 pm
by narcis
Hi DieterDHoker,

Thanks for the information but I'm still unable to reproduce it. Could you please let me know the exact steps I should follow to reproduce the issue here?

Thanks in advance.

Posted: Wed May 06, 2009 3:06 pm
by 13046648
Hi, I uploaded a visual studio project of a test app where i could reproduce the problem with to:

http://dieterdhoker.free.fr/temp/TestTchart.zip

this also includes my debug build.

Posted: Thu May 07, 2009 9:10 am
by narcis
Hi DieterDHoker,

Thanks for the example project. Finally found the difference between it and my code. What makes the difference is this line:

Code: Select all

			tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
Aligning the legend to the right of the chart solves the problem. Anyway, I've added the issue (TF02014135) to the defect list to be investigated for future releases.