Problem on TChart.Legend.LegendStyle

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Problem on TChart.Legend.LegendStyle

Post by Eric » Tue Oct 31, 2006 8:31 am

Dear Sir

Problem on TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series

Add 2 Pie chart into tchart and set LegendStyle = Series.
TChart show Pie1 and Pie2 in the legend.

Tchart version = 2.0.2489.20951

Thank
Eric

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

Post by Narcís » Tue Oct 31, 2006 12:17 pm

Dear Eric,

This is as designed, please notice that when setting LegendStyle to Series Legend draws the Series Titles even if there's only one Series in the chart.
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Wed Nov 01, 2006 2:14 am

Dear Sir

What are you trying to said? I can't undestand what you trying to explain.
Anyway below is the sample code.

Step by step
1. Click then button 1. Legend displaying USA and Japen
2. Click the button 2 or button 3. the legend no longer display USA and Japen. So what should I do to correct back?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AddSeries("USA")
AddSeries("Japen")
AddSeriesItem(0, 450, "Food")
AddSeriesItem(1, 1450, "Food")
End Sub
Public Sub AddSeriesItem(ByVal SeriesIndex As Long, ByVal value As Double, ByVal DisplayName As String)
Call TChart.Series(SeriesIndex).Add(value, DisplayName, TChart.Series(SeriesIndex).Color)
End Sub
Public Sub AddSeries(ByVal SeriesTitle As String)
TChart.Series.Add(New Steema.TeeChart.Styles.Bar3D)
TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
TChart.Series(TChart.Series.Count - 1).Title = SeriesTitle
TChart.Series(TChart.Series.Count - 1).Marks.Clip = True
TChart.Series(TChart.Series.Count - 1).Cursor = System.Windows.Forms.Cursors.Hand
TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim objChartStyle As New Steema.TeeChart.Styles.Pie
Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(0), objChartStyle.GetType)
TChart.Series(0).ColorEach = True
objChartStyle = TChart.Series(0)
objChartStyle.AutoMarkPosition = True


Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(1), objChartStyle.GetType)
TChart.Series(1).ColorEach = True
objChartStyle = TChart.Series(1)
objChartStyle.AutoMarkPosition = True
objChartStyle = Nothing
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim objChartStyle As New Steema.TeeChart.Styles.Bar3D
Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(0), objChartStyle.GetType)
Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(1), objChartStyle.GetType)
objChartStyle = Nothing
End Sub

Thank
Eric

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 02, 2006 9:36 am

Hi Eric,

This is because the series title is not saved when changing the series type, to solve this you can do something like this:

Code: Select all

    Dim Title1, Title2 As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Title1 = "USA"
        Title2 = "Japan"

        AddSeries(Title1)
        AddSeries(Title2)
        AddSeriesItem(0, 450, "Food")
        AddSeriesItem(1, 1450, "Food")
    End Sub

    Public Sub AddSeriesItem(ByVal SeriesIndex As Long, ByVal value As Double, ByVal DisplayName As String)
        Call TChart.Series(SeriesIndex).Add(value, DisplayName, TChart.Series(SeriesIndex).Color)
    End Sub

    Public Sub AddSeries(ByVal SeriesTitle As String)
        TChart.Series.Add(New Steema.TeeChart.Styles.Bar3D)
        TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        TChart.Series(TChart.Series.Count - 1).Title = SeriesTitle
        TChart.Series(TChart.Series.Count - 1).Marks.Clip = True
        TChart.Series(TChart.Series.Count - 1).Cursor = System.Windows.Forms.Cursors.Hand
        TChart.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim objChartStyle As New Steema.TeeChart.Styles.Pie
        Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(0), objChartStyle.GetType)
        TChart.Series(0).ColorEach = True
        objChartStyle = TChart.Series(0)
        objChartStyle.AutoMarkPosition = True


        Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(1), objChartStyle.GetType)
        TChart.Series(1).ColorEach = True
        objChartStyle = TChart.Series(1)
        objChartStyle.AutoMarkPosition = True
        objChartStyle = Nothing

        SetSeriesTitle()
    End Sub

    Private Sub SetSeriesTitle()
        TChart.Series(0).Title = Title1
        TChart.Series(1).Title = Title2
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim objChartStyle As New Steema.TeeChart.Styles.Bar3D
        Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(0), objChartStyle.GetType)
        Steema.TeeChart.Styles.Series.ChangeType(TChart.Series(1), objChartStyle.GetType)
        objChartStyle = Nothing

        SetSeriesTitle()
    End Sub
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Mon Nov 06, 2006 3:58 am

Dear Sir

Before I upgrade to latest version. We don't have any problem in series title and all the chart data is stored in the large database.
That is not a good ideas to re-execute the query just because the series title.

Do you think TChart is a good control?
Just a simple change chart type, all the series will automatic miss and need the developer to write a code to restore back the series title.. Wa... what chart control are you provide????

Very disappointed!! Every time upgrade the TChart must have some function is not working well. :twisted: :evil:

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

Post by Narcís » Tue Nov 07, 2006 12:21 pm

Dear Eric,

This is certainly a bug (TF02011875) which I added to our defect list to be fixed for future 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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Mon Nov 20, 2006 6:58 am

Dear Sir
I just downloaded the latest TChart (2.0.2511.18118)
that legend problem still exist!!

Which version are you going to solve it?

Eric

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 20, 2006 9:03 am

Hi Eric,

We can't tell this for now, please be aware at new releases announcements for what's being implemented/fixed in each of them.
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Wed Jan 10, 2007 6:31 am

Dear Sir
I just downloaded the latest TChart (2.0.2546.16099)
that legend problem still exist!!

Are you going to solve this problem? and where can I find the TF02011875 status?

Eric

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

Post by Narcís » Wed Jan 10, 2007 9:08 am

Dear Eric,

You are right, this bug hasn't been fixed yet. I can't tell you when this will be fixed. Currently we don't have a public bug tracking system, but you providing this internal code helps us to easily track the issue. Please be aware at this forum for new release announcements and what's implemented/fixed on them.
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

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 Jan 11, 2007 1:20 pm

Hi Eric,

As a follow up to my previous reply, you already have an easy workaround for this, you previously said:
That is not a good ideas to re-execute the query just because the series title.
However this shouldn't be a problem as you could save the series titles in a variable/array the first time you execute the query and don't have to execute it anymore.
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

Eric
Newbie
Newbie
Posts: 99
Joined: Wed Sep 14, 2005 4:00 am

Post by Eric » Fri Jan 12, 2007 2:12 am

Dear Sir

So are you trying to tell me, you are not going to solve this problem?
:twisted:
Eric

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Jan 12, 2007 8:17 am

Hi.

No, not at all. We're only saying that for the moment the only solution is to use the workaround Narcis suggested.

Looking at the sources it appears the best solution is to modify Series.cs AssignFormat method and add additional line:

Code: Select all

  title = source.Title;
and similarly for AssignSeriesFormat

Code: Select all

  source.Title = title;
This should fix the problem when changing series type. If there aren't any problems with thix fix, we'll include it in next maintenance release.
Marjan Slatinek,
http://www.steema.com

dev
Newbie
Newbie
Posts: 2
Joined: Mon Jan 30, 2006 12:00 am

Post by dev » Fri Jan 12, 2007 8:59 am

Just to say that this issues is general and is not restricted to the pie charts.
We had the same issue and we used the same kind of workaround.


DAPESCO

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 Jan 12, 2007 10:15 am

Hi DAPESCO,

Yes, it is a general Series issue, Series.cs contains the series base class.
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