Page 1 of 1

Problem on TChart.Legend.LegendStyle

Posted: Tue Oct 31, 2006 8:31 am
by 9638303
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

Posted: Tue Oct 31, 2006 12:17 pm
by narcis
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.

Posted: Wed Nov 01, 2006 2:14 am
by 9638303
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

Posted: Thu Nov 02, 2006 9:36 am
by narcis
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

Posted: Mon Nov 06, 2006 3:58 am
by 9638303
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:

Posted: Tue Nov 07, 2006 12:21 pm
by narcis
Dear Eric,

This is certainly a bug (TF02011875) which I added to our defect list to be fixed for future releases.

Posted: Mon Nov 20, 2006 6:58 am
by 9638303
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

Posted: Mon Nov 20, 2006 9:03 am
by narcis
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.

Posted: Wed Jan 10, 2007 6:31 am
by 9638303
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

Posted: Wed Jan 10, 2007 9:08 am
by narcis
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.

Posted: Thu Jan 11, 2007 1:20 pm
by narcis
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.

Posted: Fri Jan 12, 2007 2:12 am
by 9638303
Dear Sir

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

Posted: Fri Jan 12, 2007 8:17 am
by Marjan
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.

Posted: Fri Jan 12, 2007 8:59 am
by 9640117
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

Posted: Fri Jan 12, 2007 10:15 am
by narcis
Hi DAPESCO,

Yes, it is a general Series issue, Series.cs contains the series base class.