Hello,
I want to display the legend at the right side centre of the Chart
I set the custom position of the Legends,But when i change the Scales then they displaced.
Regards
Faizullah Khan
Displaying legend at the right side centre of the Chart
-
- Newbie
- Posts: 50
- Joined: Wed Apr 26, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Faizullah,
It works fine for me here using something like this:
It works fine for me here using something like this:
Code: Select all
Private Sub Form_Load()
TChart1.Series(0).FillSampleValues 10
Me.ScaleMode = vbPixels
TChart1.Legend.CustomPosition = True
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnAfterDraw()
TChart1.Legend.Left = TChart1.Width / 2
TChart1.Legend.Top = TChart1.Top + 50
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 50
- Joined: Wed Apr 26, 2006 12:00 am
Displaying legend at the right side middle of the Chart
Hi,
Thanks it works fine as You understood but my requirement is that I want to display legend right side outside the chart scale area (Right Align at Middle )
Regard ,
Faizullah Khan
Thanks it works fine as You understood but my requirement is that I want to display legend right side outside the chart scale area (Right Align at Middle )
Regard ,
Faizullah Khan
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Faizullah,
I'm still not sure about what you are exactly trying to achieve. You can try if the code below does what you request. If it doesn't could you please extend on your request and if possible send us an image so that I can exactly understand what you want to draw?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
I'm still not sure about what you are exactly trying to achieve. You can try if the code below does what you request. If it doesn't could you please extend on your request and if possible send us an image so that I can exactly understand what you want to draw?
You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
Code: Select all
Dim LegendLeft As Integer
Private Sub Form_Load()
TChart1.Series(0).FillSampleValues 10
Me.ScaleMode = vbPixels
LegendLeft = 0
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnAfterDraw()
Dim LegendHeight As Integer
With TChart1.Legend
If (LegendLeft = 0) Then
LegendLeft = .Left
End If
LegendHeight = .ShapeBounds.Bottom - .ShapeBounds.Top
.CustomPosition = True
.Left = LegendLeft
.Top = (TChart1.Height / 2) - (LegendHeight / 2)
TChart1.Panel.MarginUnits = muPixels
TChart1.Panel.MarginRight = (TChart1.Width - .Left) + _
(TChart1.Width - .ShapeBounds.Right)
End With
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 50
- Joined: Wed Apr 26, 2006 12:00 am
Displaying legend at the right side centre of the Chart
Hi
Legends problem is almost solved by using this code .
1- Some time Panel Right Margin increases from legend size .
2 -On resizing the Vb 6.0 form follwing Error mesaage appear and form resizing is not possible "Not Enough Storage is available to process this commad".
Regards
Faizullah Khan
Legends problem is almost solved by using this code .
1- Some time Panel Right Margin increases from legend size .
2 -On resizing the Vb 6.0 form follwing Error mesaage appear and form resizing is not possible "Not Enough Storage is available to process this commad".
Regards
Faizullah Khan
Hi,
it works fine here (both issues) using the following code :
Could you please check if it works fine for you ?
it works fine here (both issues) using the following code :
Code: Select all
Private Sub Form_Load()
With TChart1
.Height = Form1.ScaleHeight
.Width = Form1.ScaleWidth
.Left = 0
.Top = 0
.AddSeries scLine
.Series(0).FillSampleValues 10
Me.ScaleMode = vbPixels
LegendLeft = 0
.Environment.InternalRepaint
End With
End Sub
Private Sub TChart1_OnAfterDraw()
Dim LegendHeight As Integer
With TChart1.Legend
LegendHeight = .ShapeBounds.Bottom - .ShapeBounds.Top
.CustomPosition = True
.Left = TChart1.Width - (.ShapeBounds.Right - .ShapeBounds.Left) - 10
.Top = (TChart1.Height / 2) - (LegendHeight / 2)
TChart1.Panel.MarginUnits = muPixels
TChart1.Panel.MarginRight = (TChart1.Width - .Left) + 10
End With
End Sub
Private Sub Form_Resize()
With TChart1
.Height = Form1.ScaleHeight
.Width = Form1.ScaleWidth
.Left = 0
.Top = 0
End With
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com