legend with checkbox style

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

Re: legend with checkbox style

Post by Neelam » Wed Jun 17, 2009 8:05 am

thanx.. where exactly i need to paste this code ( i mean in which event/procedure)...it will be great if you can send the whole code taht works for u..

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

Re: legend with checkbox style

Post by Yeray » Wed Jun 17, 2009 8:11 am

Hi shikha,

I've simply modified the code you've sent to us by adding the mentioned code at the end of your InitializeChart method. Here is the whole code (cleaned of commented code):

Code: Select all

Public Class Form1
    Public Sub New()
        InitializeComponent()
        InitializeChart()
    End Sub


    Private Sub InitializeChart()
        TChart1.Aspect.View3D = False

        Dim barSeriesBase As Steema.TeeChart.Styles.Bar
        barSeriesBase = New Steema.TeeChart.Styles.Bar
        barSeriesBase.Add(123, "A")
        barSeriesBase.Add(456, "dr")
        barSeriesBase.Add(321, "rea")
        TChart1.Series.Add(barSeriesBase)
        barSeriesBase.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked

        TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
        TChart1.Series(1).Clear()
        TChart1.Series(1).Add(221, "cd")
        TChart1.Series(1).Add(456, "bg")
        TChart1.Series(1).Add(321, "rea")
        TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
        TChart1.Series(2).Clear()
        TChart1.Series(2).Add(100, "csd")
        TChart1.Series(2).Add(456, "bsg")
        TChart1.Series(2).Add(321, "resa")


        TChart1.Legend.CheckBoxes = True
        TChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series

        ' force a first repaint to set minimum and maximum for the axes
        TChart1.Draw()

        ' now you can force the axis not to move
        TChart1.Axes.Left.Automatic = False
        TChart1.Axes.Bottom.Automatic = False

        ' you could add a dummy series (series without data) to force axis to be always drawn
        TChart1.Series.Add(New Steema.TeeChart.Styles.Bar())
        TChart1.Series(TChart1.Series.Count - 1).ShowInLegend = False

        ' you should finally clear the bottom axis labels and draw the ones you wish
        TChart1.Axes.Bottom.Labels.Items.Clear()
        TChart1.Axes.Bottom.Labels.Items.Add(0, "label 1")
        TChart1.Axes.Bottom.Labels.Items.Add(1, "label 2")
        TChart1.Axes.Bottom.Labels.Items.Add(2, "label 3")
    End Sub
End Class
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

Re: legend with checkbox style

Post by Neelam » Wed Jun 17, 2009 9:52 am

EXCELLENT!!! this worked!! THANKS SO MUCH .......................... :D

Post Reply