Chart display shrinks with more series addition

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Chart display shrinks with more series addition

Post by asupriya » Tue Jun 09, 2009 4:46 am

I set the chart height to 300 pixels and display the legend at the bottom. When there are couple of series on the chart, the proportion of graph display(Where series is displayed as a line chart) to the total chart area is good. But when i add more series to the chart, the legend is displayed in multiple lines and squeezing the graph display of the chart area with legends occupying more area than the graph display.

Is there anyway I can automatically fix the graph display area size (where the line series is displayed) by automatically increasing the chart height?

Thanks,

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

Post by Sandra » Tue Jun 09, 2009 12:13 pm

Hello asupriya,


I made a simple example that I think solve your problem using Legend.CustomPosition:

InitializeChart:

Code: Select all

    Private a As Integer = 100
    Private b As Integer = 10
    Private Sub InitializeChart()
        TChart1.Aspect.View3D = False
        Line1 = New Steema.TeeChart.Styles.Line(TChart1.Chart)
        Line1.FillSampleValues(5)
        TChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series
        TChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom
        TChart1.Legend.CustomPosition = True
        TChart1.Panel.MarginLeft = 1
        TChart1.Panel.MarginBottom = 10
        TChart1.Legend.Left = TChart1.Panel.MarginBottom + (TChart1.Height()) - a
        TChart1.Legend.Top = TChart1.Panel.MarginLeft + (TChart1.Width() / 2) + b

    End Sub

ButtonClick:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Line1 = New Steema.TeeChart.Styles.Line(TChart1.Chart)
        Line1.FillSampleValues(5)
    End Sub

Please check that this code works fine in your application.

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

Post Reply