Page 1 of 1

Chart display shrinks with more series addition

Posted: Tue Jun 09, 2009 4:46 am
by 13051032
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,

Posted: Tue Jun 09, 2009 12:13 pm
by 10050769
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,