space isssue

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Wed May 27, 2009 7:08 am

hey, thanks so much for sending the solution. I tried the code , the only issue is now taht i have vb.net and this is in c sharp. so i tried to convert it, but at this line
tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);

it gives error.. it sauys use raoise event.. but when i use taht it does not take.
Can u send me its equivalent vb.net code. thanks so much for ur help.

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Wed May 27, 2009 7:14 am

i tried to convert using a utility..
Private Sub InitializeChart()
chartController1.Chart = tChart1

tChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
tChart1.Series(0).Add(123, "really long long label 1", Color.Red)
tChart1.Series(0).Add(456, "really long long label 2", Color.Blue)
tChart1.Series(0).Add(321, "really long long label 3", Color.Green)

tChart1.Axes.Bottom.Labels.Angle = 90

tChart1.GetAxisLabel += New Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel)
End Sub

Private Sub tChart1_GetAxisLabel(ByVal sender As Object, ByVal e As Steema.TeeChart.GetAxisLabelEventArgs)
If e.LabelText.Length > 16 Then
Dim tmp1 As String = e.LabelText.Substring(0,16)
Dim tmp2 As String = e.LabelText.Substring(16,e.LabelText.Length-16)

e.LabelText = String.Format("{0}{1}{2}", tmp1, "\n", tmp2)
End If
End Sub

'BUT it gives error - Use a raiseevent statement to raise an event at this line- " tChart1.GetAxisLabel += New Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel)"

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

Post by Sandra » Wed May 27, 2009 10:36 am

Hello shikha,

The example code of VB is next:


Form_Load:

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeChart()
    End Sub
InitializeChart:

Code: Select all

    Private Sub InitializeChart()
        ChartController1.Chart = TChart1

        TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
        TChart1.Series(0).Marks.Visible = False
        TChart1.Series(0).Add(123, "really long long label 1", Color.Red)
        TChart1.Series(0).Add(456, "really long long label 2", Color.Blue)
        TChart1.Series(0).Add(321, "really long long label 3", Color.Green)
        TChart1.Axes.Bottom.Labels.Angle = 90
    End Sub
GetAxisEvent:

Code: Select all

  Private Sub tChart1_GetAxisLabel(ByVal sender As Object, ByVal e As Steema.TeeChart.GetAxisLabelEventArgs) Handles TChart1.GetAxisLabel
        If e.LabelText.Length > 16 Then
            Dim tmp1 As String = e.LabelText.Substring(0, 16)
            Dim tmp2 As String = e.LabelText.Substring(16, e.LabelText.Length - 16)

            e.LabelText = String.Format("{0}{1}{2}", tmp1, vbCrLf, tmp2)
        End If
    End Sub

I have assigned GetAxisLabels event at design time, because it's more easy. Please check that this code works fine.


I hope that 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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Tue Jun 02, 2009 11:05 am

great this works but..
just one thing it pushes the chart up(that is make size of chart smaller). But the whole idea of doing this is taht the chart size does not change and does not become small.Infact there is lot of empty space belowthe labels in this case. how can we resolve that?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Jun 02, 2009 11:40 am

Hi shikha,

Try playing with the following properties until you'll find your desired combination:

Code: Select all

TChart1.Panel.MarginBottom = 0
Chart1.Axes.Bottom.RelativePosition = -12
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Tue Jun 02, 2009 12:11 pm

where exactly these 2 lines should be placed .. i mean at which event?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Jun 02, 2009 1:01 pm

Hi shikha,

In a beginning you should modify your chart aspect at chart creation. If your labels change at any event, maybe you should do some calculations and change your chart aspect there.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

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

Re: space isssue

Post by Narcís » Mon Jul 20, 2009 9:12 am

Hi shikha,

For topic consistency and so that it is easier for everyone to follow each topic I splitted your last post into another thread as it's a problem different from what was originally discussed here. You can follow the new thread here:

http://www.teechart.net/support/viewtop ... =4&t=10020

We will appreciate that you start a new thread for each different technical inquiry not related to an existing topic.

Thanks in advance.
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:

Re: space isssue

Post by Narcís » Mon Jul 20, 2009 9:16 am

Hi shikha,

Sorry, I wrongly splitted the first topic instead of the last, new topic is this one:

http://www.teechart.net/support/viewtop ... =4&t=10021
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