scrolling

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

scrolling

Post by Neelam » Thu Nov 27, 2008 7:05 am

is there a way to find that whether the chart displays all bars or there are any hidden? actually i have a bar chart and i am using axis arrow for scrolling. now the axis arrows should not appear when all the bars can be seen as in taht case there is no point to scroll.

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

Post by Narcís » Thu Nov 27, 2008 9:43 am

Hi shikha,

Yes, you can do something like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private Steema.TeeChart.Styles.Bar bar1;
		private Steema.TeeChart.Tools.AxisScroll axisScroll1;

		void InitializeChart()
		{
			bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
			bar1.FillSampleValues();

			axisScroll1 = new Steema.TeeChart.Tools.AxisScroll(tChart1.Chart);

			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			int visiblePoints = (bar1.LastDisplayedIndex() - bar1.FirstDisplayedIndex()) + 1;

			axisScroll1.Active = visiblePoints == bar1.Count ? false : true;
		}
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

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

Post by Neelam » Thu Nov 27, 2008 12:17 pm

thanks , but i am using axis arrow whereas you have used axis scroll. Are they same. If they are different what are the differences. Also wills ame code will work for both. Thanks.

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

Post by Neelam » Thu Nov 27, 2008 12:19 pm

also request you to give answers in vb.net language rather than c sharp as i am working into vb.net. Many thanks for your kind help!!!

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

Post by Narcís » Thu Nov 27, 2008 12:31 pm

Hi shikha,
thanks , but i am using axis arrow whereas you have used axis scroll. Are they same. If they are different what are the differences. Also wills ame code will work for both. Thanks.
Sorry, my fault. No, those tools are not the same but same code should apply to both of them.

The AxisArrow tool is used to display small arrows at beginning and / or end positions of axes.

The AxisScroll Tool allows you to drag an Axis by selecting it with the Mouse and dragging the Axis with the Left MouseButton depressed.
also request you to give answers in vb.net language rather than c sharp as i am working into vb.net. Many thanks for your kind help!!!
We use to make our examples in C# because it's the native language in which TeeChart for .NET is implemented and this makes it easier for us to debug projects. Anyway you can easily convert C# code to VB.NET using any of those conversion engines:

Kamal Patel's conversor
Carlos Aguilar's conversor

If this doesn't help don't hesitate to let us know.
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

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

Post by Neelam » Thu Nov 27, 2008 2:29 pm

thanks. but i am getting one error at this line :
TChart1.AfterDraw += New Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw)

error is - its an event and can not be called directly.use raise event statement to raise an event.

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

Post by Narcís » Thu Nov 27, 2008 2:43 pm

Hi shikha,

Carlos Aguilar's conversor worked fine for me here. I also changed AxisScroll to AxisArrow tool:

Code: Select all

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

    Dim bar1 As Steema.TeeChart.Styles.Bar
    Dim axisArrow1 As Steema.TeeChart.Tools.AxisArrow

    Private Sub InitializeChart()
        bar1 = New Steema.TeeChart.Styles.Bar(tChart1.Chart)
        bar1.FillSampleValues()
        axisArrow1 = New Steema.TeeChart.Tools.AxisArrow(TChart1.Chart)
        axisArrow1.Axis = TChart1.Axes.Bottom

        AddHandler tChart1.AfterDraw, AddressOf Me.tChart1_AfterDraw
    End Sub

    Private Sub tChart1_AfterDraw(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
        Dim visiblePoints As Integer = ((bar1.LastDisplayedIndex - bar1.FirstDisplayedIndex) + 1)
        axisArrow1.Active = Not (visiblePoints = bar1.Count)
    End Sub
Also you can easily generate events at designtime selecting the object you'd like to work with, go to "Properties" window, select "Events" tab, choose the event you'd like to assign and dobule click on it.

Hope this helps!
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

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

Post by Neelam » Thu Nov 27, 2008 3:42 pm

Great! just one thing , it works absolutely fine in sense that it disables the scrolling arrow(axisArrow1) when all the bars are shown.But it remains visible. is there any way to also hide it along with making it disbled.

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

Post by Neelam » Thu Nov 27, 2008 3:46 pm

also LastDisplayedIndex was not present( it said this property not available) so i have used LastVisibleIndex instead. i am using teechart version 3.02

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

Post by Neelam » Thu Nov 27, 2008 4:48 pm

Hey, it worked after i put teechart1.refresh. Thanks!!

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

Post by Narcís » Thu Nov 27, 2008 6:30 pm

Hi shikha,

You're welcome. I'm glad to hear that worked.
also LastDisplayedIndex was not present( it said this property not available) so i have used LastVisibleIndex instead. i am using teechart version 3.02
Ok, this is available with latest releases. Last one is from 3rd November 2008:

http://www.teechart.net/support/viewtopic.php?t=8636
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