Line series legend symbol problem

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Line series legend symbol problem

Post by Uli » Mon May 10, 2010 6:33 pm

Hi,

some days ago I installed TeeChart.NET version 2010. Within my main project I still used the TeeChart.dll from 2009 (4.0.2009.62332). Today I added some Dew.Math.TeePro functionality (From DewResearch) which led to a version conflict since Dew.Math.TeePro.dll I built already using the new TeeChart.dll (4.0.2010.13053). I changed the reference to the new dll and rebuild the project (VB). The new dll was really in the bin\debug folder. I noticed nearly immediately, that the symbols in the legend were not drawn correctly (LINE series) when points were set to not visible. Instead of a line a big rectangle was drawn. Making points visible led to correct symbols. (I read a posting about a similar problem with bar charts here and so tried different legend styles - nothing changed)
Chart1.png
Illustrates the problem
Chart1.png (36.93 KiB) Viewed 22756 times
.

A second topic is related to annotation behavior. Reading and converting old charts (own format) with the TeeChart 2009 I obtained my old text fields now as annotation at the positions according to my old files. With TeccHart 2010 the position is always (0; 0). Why? The corresponding lines:
Dim An As New Steema.TeeChart.Tools.Annotation(Graph.Chart)
An.Active = True
An.Text = s
An.Left = Left
An.Top = Top
An.Shape.Color = Color.Transparent
An.Shape.Pen.Visible = False
An.Shape.Shadow.Visible = False
AddHandler An.Click, AddressOf MyChildWindow.Annotation1_Click
Left and top are the previously read positions from the old file.

Another topic (both 2009 and 2010 versions): Using the axis label format string '#.0 "x10" E+0' (with option exponential on) then the labels look like in the image. For my taste, the distance between base (10) and exponent is too high. Trying to decrease the gap between 10 and exponent leads to a deleted "0" but not a smaller gap. Is there a work around?

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Wed May 12, 2010 11:50 am

Hello Uli,
some days ago I installed TeeChart.NET version 2010. Within my main project I still used the TeeChart.dll from 2009 (4.0.2009.62332). Today I added some Dew.Math.TeePro functionality (From DewResearch) which led to a version conflict since Dew.Math.TeePro.dll I built already using the new TeeChart.dll (4.0.2010.13053). I changed the reference to the new dll and rebuild the project (VB). The new dll was really in the bin\debug folder. I noticed nearly immediately, that the symbols in the legend were not drawn correctly (LINE series) when points were set to not visible. Instead of a line a big rectangle was drawn. Making points visible led to correct symbols. (I read a posting about a similar problem with bar charts here and so tried different legend styles - nothing changed)
I could found your problem, and I recommend that change property of Legend.Symbol.Width, as next example code:

Code: Select all

            tChart1.Legend.Symbol.Width = 15;
A second topic is related to annotation behavior. Reading and converting old charts (own format) with the TeeChart 2009 I obtained my old text fields now as annotation at the positions according to my old files. With TeccHart 2010 the position is always (0; 0). Why? The corresponding lines:
Please, you could send us a simple project, because we can reproduce your problem here?
Another topic (both 2009 and 2010 versions): Using the axis label format string '#.0 "x10" E+0' (with option exponential on) then the labels look like in the image. For my taste, the distance between base (10) and exponent is too high. Trying to decrease the gap between 10 and exponent leads to a deleted "0" but not a smaller gap. Is there a work around?
I could reproduce your problem and I have added it in bug report list whit number [TF02014878]. We will try to fix for next versions of TeeChart .Net.


Thanks,
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Thu May 13, 2010 6:58 am

Hi Sandra,

thanks for the reply.
some days ago I installed TeeChart.NET version 2010. Within my main project I still used the TeeChart.dll from 2009 (4.0.2009.62332). Today I added some Dew.Math.TeePro functionality (From DewResearch) which led to a version conflict since Dew.Math.TeePro.dll I built already using the new TeeChart.dll (4.0.2010.13053). I changed the reference to the new dll and rebuild the project (VB). The new dll was really in the bin\debug folder. I noticed nearly immediately, that the symbols in the legend were not drawn correctly (LINE series) when points were set to not visible. Instead of a line a big rectangle was drawn. Making points visible led to correct symbols. (I read a posting about a similar problem with bar charts here and so tried different legend styles - nothing changed)



I could found your problem, and I recommend that change property of Legend.Symbol.Width, as next example code:

Code: Select all
tChart1.Legend.Symbol.Width = 15;
I tried it but it does not work. Is there another work around?
A second topic is related to annotation behavior. Reading and converting old charts (own format) with the TeeChart 2009 I obtained my old text fields now as annotation at the positions according to my old files. With TeccHart 2010 the position is always (0; 0). Why? The corresponding lines:



Please, you could send us a simple project, because we can reproduce your problem here?
In the zip file (in order to reduce size I deleted TeeChart.dll) you will find the sample project, some remarks:

sample.xyf (the data file created by my old own application, it's relatively large since it contains a preview image)
sample.jpg (image exported from the old application, down sampled with photoshop)
MyLoadXYF.vb (the import module for the old file format. It looks a little bit terrible, since I first checked mschart before I decided to go with TeeChart...)
MyFunctions.vb (some required functions for the import module)

BTW, is there an easy way to include sub / superscript in the axis titles? For scientific applications it's really important.
I know, with importing the text fields from my old application into annotations I loose such format's, too. But when I have the possibility to format the axis titles accordingly I will change the annotations possibly to rich text boxes as shown in your canvas application...

Best regards

Uli
Last edited by Uli on Thu May 13, 2010 12:21 pm, edited 1 time in total.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Thu May 13, 2010 11:46 am

Hello Uli,

I tried it but it does not work. Is there another work around?
Ok, I have added it in bug report list whit number [TF02014877]. We will try to fix it with next versions of TeeChart .Net.
A second topic is related to annotation behavior. Reading and converting old charts (own format) with the TeeChart 2009 I obtained my old text fields now as annotation at the positions according to my old files. With TeccHart 2010 the position is always (0; 0). Why? The corresponding lines:
I could reproduce your problem. I think that it appears because in Teechart 2010 you need assign Annotation.Right and Annotation.Bottom value,because position of annotationTool change correctly, and in version of TeeChart 2009 not. We have considered it with a bug report with number [TF02014880] and we will try to fix for next maintenance releases of TeeChart2010. For now you could do next in your code:

Code: Select all

    Function ReadExtendedStrings() As Boolean
        If MyStreamReader.BaseStream.Position >= MyStreamReader.BaseStream.Length - 5 Then Return True
        'If fs.Position = fs.Size Then begin()
        '  result:=true;
        '  exit;
        'end;
        'MyStreamReader.BaseStream.Position = MyXYF_Information.Positions(0).ExtendedStrings
        ReadExtendedStrings = False
        Dim count As Integer
        Dim s As String
        'Dim ss As String
        Dim i As Integer
        Dim Left As Integer
        Dim Top As Integer
        Dim Bottom As Integer
        Dim Right As Integer
        Dim ii As Integer = 1
        'read:=read+fs.read(nr, sizeof(integer));
        count = MyStreamReader.ReadInt32
        'oldnr:=length(Graph.FExtendedStrings);
        'If Not FLoadOnlyTemplateLayout Then
        'SetLength(Graph.FExtendedStrings, oldnr+nr);
        'for i:=oldnr+1 to oldnr+nr do begin;
        For i = 0 To count - 1
            '  estr:=@Graph.FExtendedStrings[i-1];          
            '  if FLoadOnlyTemplateLayout then estr:=nil;
            '  if not loadgraphappearance then estr:=nil;   //  neu 2004-08-24
            s = ReadExtendedString(Left, Top)
            '  readstring(estr);
            '  if estr=nil then SetLength(Graph.FExtendedStrings, Length(Graph.FExtendedStrings)-1) // neu 2004-08-24
            's = s.Replace("#13", "\n")
            s = s.Replace("#13", "\n")
            Bottom = Top
            Right = Left
            Dim An As New Steema.TeeChart.Tools.Annotation(Graph.Chart)
            An.Active = True
            An.Text = s
            An.Shape.CustomPosition = True
            An.Shape.Left = Left
            An.Shape.Top = Top
            An.Shape.Bottom = Bottom
            An.Shape.Right = Right
            An.Shape.Color = Color.Transparent
            An.Shape.Pen.Visible = False
            An.Shape.Shadow.Visible = False
            'AddHandler An.Click, AddressOf MyChildWindow.Annotation1_Click
            ii = 1
        Next
        'end;
        'if Version > 110 Then begin()
        '  read:=read+fs.Read(i, sizeof(integer));
        If Ver > 110 Then i = MyStreamReader.ReadInt32
        '  result:=read=i;
        '  if not result then exit;
        'end;
        'result:=true;
        'end;

        Return True
    End Function
Please, check previous code works as you want in your application.
BTW, is there an easy way to include sub / superscript in the axis titles? For scientific applications it's really important.
I know, with importing the text fields from my old application into annotations I loose such format's, too. But when I have the possibility to format the axis titles accordingly I will change the annotations possibly to rich text boxes as shown in your canvas application...
I recommend instead of use Axis.Title do simlar that explain to All Features\Welcome !\Canvas\RichText Drawing TeeChart .Net Demo.


I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Thu May 13, 2010 12:47 pm

Hi Sandra,

thanks, the Annotation positioning now works...
BTW, is there an easy way to include sub / superscript in the axis titles? For scientific applications it's really important.
I know, with importing the text fields from my old application into annotations I loose such format's, too. But when I have the possibility to format the axis titles accordingly I will change the annotations possibly to rich text boxes as shown in your canvas application...



I recommend instead of use Axis.Title do simlar that explain to All Features\Welcome !\Canvas\RichText Drawing TeeChart .Net Demo.
Yes, I thought about this possibility, too. There are some contraindications:
(1) in a RichTextBox I can not set the back color to transparent
(2) RichTextBox has not an orientation property (as far as I know) to align the text parallel to vertical axes / Do you have a suggestion?
(3) realizing such a solution could lead to conflicts when user edit axes properties with the TeeChart editor. Is it possible to disable editing axis title there?
Ok, I have added it in bug report list whit number [TF02014877]. We will try to fix it with next versions of TeeChart .Net.
When this fix could be available? Since it is a an important issue I have to decide to switch back to TeeChart 2009 or not.

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Fri May 14, 2010 11:07 am

Hello Uli,
(2) RichTextBox has not an orientation property (as far as I know) to align the text parallel to vertical axes / Do you have a suggestion?
I have found a simple example for rotate text using pictureBox, and it could help you, please see next code:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        RichTextBox richTextBox1;
        PictureBox pictureBox1;
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
    
            richTextBox1 = new RichTextBox();
            pictureBox1 = new PictureBox();
            this.pictureBox1.Location = new Point(richTextBox1.Width, 0);
            bar.FillSampleValues();
            tChart1.Controls.Add(richTextBox1);
            tChart1.Controls.Add(pictureBox1);
            richTextBox1.Text = "";
            richTextBox1.TextChanged +=new EventHandler(richTextBox1_TextChanged);
            pictureBox1.SizeChanged +=new EventHandler(pictureBox1_SizeChanged);    

        }
        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            this.DrawText(richTextBox1.Lines);
        }

        private void DrawText(string[] lines)
        {
            Graphics g = Graphics.FromHwnd(this.pictureBox1.Handle);
            g.Clear(Color.White);
            StringFormat stringFormat = new StringFormat();
            stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
            float xPos = 0;
            foreach (string s in lines)
            {
                g.DrawString(s, new Font("Times NewRoman", 10), Brushes.Black, new PointF(xPos, 0f), stringFormat);
                xPos += 17;
            }
            g.Flush();
        }

        private void pictureBox1_SizeChanged(object sender, EventArgs e)
        {
            this.DrawText(richTextBox1.Lines);
        }
Please, check previous code works fine for you.
(3) realizing such a solution could lead to conflicts when user edit axes properties with the TeeChart editor. Is it possible to disable editing axis title there?
I think you could use property of editor HideTabs, that allow choose which tab you want see. Please see next code and check if it works as you want.

Code: Select all

 public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Editor editor;
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Bar bar = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar.FillSampleValues();
            editor = new Steema.TeeChart.Editor();
            editor.Chart = tChart1;
       
        }

        private void button1_Click(object sender, EventArgs e)
        {
           	editor.HighLightTabs = true;
		editor.HideTabs = new Steema.TeeChart.Editors.ChartEditorTabs[] {
				Steema.TeeChart.Editors.ChartEditorTabs.Axes
			};
		editor.Options = new Steema.TeeChart.Editors.ChartEditorOptions[] {
				Steema.TeeChart.Editors.ChartEditorOptions.Add
			};	

            editor.ShowModal();
		}
When this fix could be available? Since it is a an important issue I have to decide to switch back to TeeChart 2009 or not.
Not yet. The last version was released three weeks ago so it's most likely that it will still take some time until a maintenance is out. I strongly recommend you to be aware at this forums or subscribe to our RSS news feedfor new release announcements and what's implemented on them.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Thu May 20, 2010 9:46 am

Hello Uli,

We've fixed the bug with number TF02014880. I've verified it is working fine now with the actual sources so it will be included with the next maintenance release build.

Thanks,
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Tue May 25, 2010 8:45 am

Hallo Sandra,

thanks for the reply.
We've fixed the bug with number TF02014880. I've verified it is working fine now with the actual sources so it will be included with the next maintenance release build.
That's good news. But more important are fixes to [TF02014877] and [TF02014878] (legend symbols for line series with invisible points and exponential axis label format).

With respect to the sub/superscript within axis titles I had the hope to get it within a more easy way. I now have realized it in the afterdraw event with textout/rotatelable methods (similar I had done it previously with delphi). But it's not a really fine solution so I would suggest to include this possibility in future versions of TeeChart. For scientific applications I assume it as essential. That's true for custom legend items, too. That is what I'm now working on and I run into another pitfall. In order to analyze legend behavior I wrote

Code: Select all

If Chart1.Legend.Items(e.Index).SymbolRectangle.Left = 10 Then Beep()
If Chart1.Legend.Items(2).Top = 10 Then Beep()
in the Chart1_AfterDraw and/or Chart1_GetLegendText events but the .SymboRectangle is always (0, 0, 0, 0) , .Top=0, too

Another bug seems to be serialization of chart1.tag: its used (or should be) to store some RichText and other information:
After saving the chart with

Code: Select all

        Chart1.Export.Template.IncludeData = True
        Chart1.Export.Template.Save(FileName)
and reloading it with

Code: Select all

Chart1.Import.Template.Load(FileName)
the chart1.tag is empty. A work around is to use the panel.tag but it makes things not clear.

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Wed May 26, 2010 9:53 am

Hello Uli,

I inform that we’ve fixed the bug with number (TF02014877). I've verified it is working fine now with the actual sources so it will be included with the next maintenance release builds. Also, I have increased priority of bug (TF02014878).
That's true for custom legend items, too. That is what I'm now working on and I run into another pitfall. In order to analyze legend behaviour I wrote
If Chart1.Legend.Items(e.Index).SymbolRectangle.Left = 10 Then Beep()
If Chart1.Legend.Items(2).Top = 10 Then Beep()
in the Chart1_AfterDraw and/or Chart1_GetLegendText events but the .SymboRectangle is always (0, 0, 0, 0) , .Top=0, too
I recommend that you use event OnDrawSymbol, since when you want treat symbols of legend it’s the correct way to access they. I think you can use similar code as next for solve your problem:

Code: Select all

void Symbol_OnSymbolDraw(object sender, Steema.TeeChart.SymbolDrawEventArgs e)
        {
            if (e.Rect.Left==10)
            {
                e.ValueIndex.ToString();
            }

            if (e.ValueIndex == 2)
            {
                if (e.Rect.Top == 2)
                {
                    this.Text = e.ValueIndex.ToString();
                }
            }
        }
Another bug seems to be serialization of chart1.tag: its used (or should be) to store some RichText and other information:
After saving the chart with
Chart1.Export.Template.IncludeData = True
Chart1.Export.Template.Save(FileName)
and reloading it with
Chart1.Import.Template.Load(FileName)
I could not reproduce your problem here. Please, could you make a simple code that "run-as" here, because we can reproduce problem here?

Thanks,
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Wed May 26, 2010 12:09 pm

Hallo Sandra,

thanks for your effort with bug (TF02014877) and (TF02014878).
I could not reproduce your problem here. Please, could you make a simple code that "run-as" here, because we can reproduce problem here?
Place two buttons, a tchart and the dialogs on an empty form:

Code: Select all

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Return
        Chart1.Tag = "test"
        Chart1.Export.Template.IncludeData = True
        Chart1.Export.Template.Save(SaveFileDialog1.FileName)
        Chart1.Tag = ""
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Not OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Return
        Chart1.Import.Template.Load(OpenFileDialog1.FileName)
        MsgBox(Chart1.Tag)
    End Sub
The message box displays nothing. If you remove the last line in Button1_click then you have to close the application before loading the chart again.
I recommend that you use event OnDrawSymbol, since when you want treat symbols of legend it’s the correct way to access they. I think you can use similar code as next for solve your problem:
That's possibly a misunderstanding. I do not want to treat the legend symbols. What I want is to replace the legend text (series title) by an RTF text with sub and superscripts. So I have to know the rectangle were the normal legend items text would be drawn (I plan to set the font.color to transparent, so I did with the axis title). The problem is that the code related to legend dimensions like

Code: Select all

Chart1.Legend.Items(e.Index).SymbolRectangle.Left 'is always(0,0,0,0)
Chart1.Legend.Items(2).Top ' is = 0
does not give any useful value. Why? The code was placed in Chart1_AfterDraw and/or Chart1_GetLegendText events. How can I get the rectangles of the legend items text?

What do you think about my suggestion to include rich text formating of axis titles and legend items (at least sub and superscripts) in future versions of TeeChart?

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Thu May 27, 2010 11:36 am

Hello Uli,
Place two buttons, a tchart and the dialogs on an empty form:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Return
Chart1.Tag = "test"
Chart1.Export.Template.IncludeData = True
Chart1.Export.Template.Save(SaveFileDialog1.FileName)
Chart1.Tag = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Not OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Return
Chart1.Import.Template.Load(OpenFileDialog1.FileName)
MsgBox(Chart1.Tag)
End Sub
The message box displays nothing. If you remove the last line in Button1_click then you have to close the application before loading the chart again.
Thanks, for your code. I could reproduce your problem and I have added it in bug report list with number [TF02014913]. We will try to fix it for next maintenance releases of Teechart.Net.
That's possibly a misunderstanding. I do not want to treat the legend symbols. What I want is to replace the legend text (series title) by an RTF text with sub and superscripts. So I have to know the rectangle were the normal legend items text would be drawn (I plan to set the font.color to transparent, so I did with the axis title). The problem is that the code related to legend dimensions like
Chart1.Legend.Items(e.Index).SymbolRectangle.Left 'is always(0,0,0,0)
Chart1.Legend.Items(2).Top ' is = 0
does not give any useful value. Why? The code was placed in Chart1_AfterDraw and/or Chart1_GetLegendText events. How can I get the rectangles of the legend items text?
In that case, the only solution I can think of is drawing a custom legend as in the example Christopher Ireland suggested on this thread.
What do you think about my suggestion to include rich text formating of axis titles and legend items (at least sub and superscripts) in future versions of TeeChart?
We consider your suggestion, is interesting and we had already added your request to the wish-list .I recommend you to be aware at this forums or subscribe to our RSS news feed for new release announcements and what's implemented on them.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Thu May 27, 2010 1:55 pm

Hallo Sandra,

I was wrong: Placed in the Chart1-AfterDraw event

Code: Select all

Chart1.Legend.Items(i).Top
returns correct values. So I now have realized the RTF text in the legend items. I use the Chart1.Legend.Items(i).Tag property to store the reuired data (RTF text, left, top ....).

Unfortunately, the next bug was obvious: The Chart1.Legend.Items(i).Tag will not be serialized (like chart1.tag, bug report list with number [TF02014913]), too. You can check it (same procedure as above) with

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Chart1.Walls.View3D = False
        Chart1.Aspect.View3D = False
        Chart1.Series(0).FillSampleValues()
        Chart1.Series(1).FillSampleValues()
        Chart1.Legend.Items(0).Tag = "legend item test"
        Chart1.Series(0).Tag = "series test"
        If SaveFileDialog1.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Chart1.Export.Template.IncludeData = True
        Chart1.Export.Template.Save(SaveFileDialog1.FileName)
        Chart1.Legend.Items(0).Tag = ""
        Chart1.Series(0).Tag = ""
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Not OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Return
        Chart1.Import.Template.Load(OpenFileDialog1.FileName)
        MsgBox(Chart1.Legend.Items(0).Tag)
        MsgBox(Chart1.Series(0).Tag)
    End Sub
So it's obviously a bug.

Though I now have a solution for sub and superscript text in legend and axis titles I still would prefer a native TeeChart solution. With my way a lot of overhead is required, some settings might conflict with user input within the corresponding dialogs. By the way, if Steema will realize such a native solution: It would be nice to get a dot "." in the usual vertical position (in the middle of the line) as operator for multiplication (exponential axis labels).

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Fri May 28, 2010 10:12 am

Hello Uli,
Unfortunately, the next bug was obvious: The Chart1.Legend.Items(i).Tag will not be serialized (like chart1.tag, bug report list with number [TF02014913]), too.
Thanks, I have added your information in bug (TF02014913).
Though I now have a solution for sub and superscript text in legend and axis titles I still would prefer a native TeeChart solution. With my way a lot of overhead is required, some settings might conflict with user input within the corresponding dialogs. By the way, if Steema will realize such a native solution: It would be nice to get a dot "." in the usual vertical position (in the middle of the line) as operator for multiplication (exponential axis labels).
Ok, we will add this specific request to the wish-list to be considered for inclusion in future release. However, it's not clear for us what do you exactly mean with the dot thing. Could you please elaborate on that or provide an example?

Thanks in advance.
Best Regards,
Sandra Pazos / 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

Uli
Newbie
Newbie
Posts: 80
Joined: Thu Apr 22, 2010 12:00 am

Re: Line series legend symbol problem

Post by Uli » Fri May 28, 2010 12:22 pm

Hallo Sandra,

very exciting if you could realize it, soon:
Ok, we will add this specific request to the wish-list to be considered for inclusion in future release. However, it's not clear for us what do you exactly mean with the dot thing. Could you please elaborate on that or provide an example?
Here you can see an image from my old Delphi application (downsampled with MS Paint, therefore sorry for the quality). There you can see that the multiplication operator on the left axis labels is a "high dot" while it is in the legend a "star". I assume the "high dot" as the more appropriate symbol.
demo.jpg
demo.jpg (40.34 KiB) Viewed 22446 times
I discovered another Bug: After removing a series from the chart the corresponding legend item still lives in the chart. Try the code:

Code: Select all

            
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Chart1.Walls.View3D = False
        Chart1.Aspect.View3D = False
        Chart1.Series(0).FillSampleValues()
        Chart1.Series(1).FillSampleValues()
        Chart1.Series(1).Title = "Test"
        Chart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        Chart1.Invalidate()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Chart1.Series.Remove(Chart1.Series(0))
        Chart1.Invalidate()
        MsgBox(Chart1.Legend.Items.Count.ToString)  ' displayed is: "2"
    End Sub

(the series title property was set in the editor to "Test")

That's really an exorbitant bug since for the remaining series the name of the removed series ("line1") instead of "Test" is displayed in the legend.

Best regards

Uli

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Line series legend symbol problem

Post by Sandra » Mon May 31, 2010 11:23 am

Hello Uli,
Here you can see an image from my old Delphi application (downsampled with MS Paint, therefore sorry for the quality). There you can see that the multiplication operator on the left axis labels is a "high dot" while it is in the legend a "star". I assume the "high dot" as the more appropriate symbol.
I have made a simple example that I think you can use in your application. Please, see next code and check if it works as you want

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private Steema.TeeChart.Styles.Line line1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            this.line1.Add(1, 1.0);
            this.line1.Add(2, 1.0e+1);
            this.line1.Add(3, 1.0e+2);
            this.line1.Add(4, 1.0e+3);
            this.line1.Add(5, 1.0e+4);
            this.line1.Add(6, 1.0e+5);
            this.line1.Add(7, 1.0e+6);
            for (int i = 0; i < line1.Count; i++)
            {
                line1[i].Label = "1.0•e+" + Math.Log10(line1[i].Y).ToString();
            }
            tChart1.Axes.Left.Labels.Exponent = true;
            tChart1.Axes.Left.Labels.ValueFormat = "#.0•10 E+0";
            tChart1.GetLegendText += new Steema.TeeChart.GetLegendTextEventHandler(tChart1_GetLegendText);
            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
        }

        void tChart1_GetLegendText(object sender, Steema.TeeChart.GetLegendTextEventArgs e)
        {
            e.Text = line1[e.Index].Label;
        }

I could reproduce your problem and I have added it in bug report list with number [TF02014922]. We will try to fix it for next maintenance releases of TeeChart .Net.

I hope will help.

Thanks,
Best Regards,
Sandra Pazos / 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