Chart moves down when legend appears

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Elric
Newbie
Newbie
Posts: 21
Joined: Fri Nov 15, 2002 12:00 am

Chart moves down when legend appears

Post by Elric » Fri Feb 04, 2005 1:31 pm

Hello
In my application the user can display or hide the legend through a button click. When the legend disappears the chart (incl the axes) moves up a few pixels, when the legend appears the chart moves down a little bit (and the labels of the x-axis are cut). The amount of pixels, that the chart moves, depends on the size of the window !! and NOT on the size or rows of legend. What can i do?

A second question: How can i change the mousecursor, when it it moves over the legend?

Thank you. Greetings.
Elric

Elric
Newbie
Newbie
Posts: 21
Joined: Fri Nov 15, 2002 12:00 am

Post by Elric » Wed Feb 16, 2005 9:14 am

Hello
Am I the only, who had this problem? You can easily create it. Make a new projekt, put a TChart on it and implement a event, where the legend appears and disappers. Look at the bottom axis and its labels. They moving up and down and the way they move is not the height of the legend.

Example-Code:
Form-Designer

Code: Select all

   Friend WithEvents TChart1 As Steema.TeeChart.TChart
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.TChart1 = New Steema.TeeChart.TChart
      Me.SuspendLayout()
      '
      'TChart1
      '
      Me.TChart1.Dock = System.Windows.Forms.DockStyle.Fill
      '
      'TChart1.Header
      '
      Me.TChart1.Header.Lines = New String() {"TeeChart"}
      Me.TChart1.Location = New System.Drawing.Point(0, 0)
      Me.TChart1.Name = "TChart1"
      Me.TChart1.Size = New System.Drawing.Size(292, 273)
      Me.TChart1.TabIndex = 0
      '
      'Form1
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(292, 273)
      Me.Controls.Add(Me.TChart1)
      Me.Name = "Form1"
      Me.Text = "Form1"
      Me.ResumeLayout(False)

   End Sub

Events:

Code: Select all

   Private Sub TChart1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TChart1.Click
      Me.TChart1.Legend.Visible = Not Me.TChart1.Legend.Visible
   End Sub

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim s As New Steema.TeeChart.Styles.Line(Me.TChart1.Chart)
      s.FillSampleValues(10)
      Me.TChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top
   End Sub
Please look at it and tell me how to solve the problem (I have the latest version from 15th Feb.)

Thanks
Elric

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 Feb 16, 2005 2:31 pm

Hello Elric,

Yes, you are right, I've been able to reproduce this here and it has already been fixed for the next release.

Meanwhile a workaround would be:

Code: Select all

Private tmp As Double

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim s As New Steema.TeeChart.Styles.Line(Me.TChart1.Chart)
        s.FillSampleValues(25)

        With TChart1
            .Legend.Alignment = Steema.TeeChart.LegendAlignments.Top
            tmp = (4 * TChart1.Height / 100)
            With .Panel
                .MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels
                .MarginBottom = 50
            End With
        End With
    End Sub


    Private Sub TChart1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TChart1.Click
        If (TChart1.Legend.Visible) Then
            TChart1.Legend.Visible = False
            TChart1.Panel.MarginBottom -= tmp
        Else
            TChart1.Legend.Visible = True
            TChart1.Panel.MarginBottom = 50
        End If
    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

Elric
Newbie
Newbie
Posts: 21
Joined: Fri Nov 15, 2002 12:00 am

Post by Elric » Thu Feb 17, 2005 1:57 pm

Hello Narcis
I think I can live with this workaraound.
Thank you
Elric

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 Feb 17, 2005 2:00 pm

Hi Elric,

Well, be aware that this will be included in TeeChart for .NET v2, so you will have to remove the workaround in case you upgrade.
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