Resetting FirstVisibleIndex if data is reloaded.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
WD_Gordon
Newbie
Newbie
Posts: 49
Joined: Wed Jun 18, 2008 12:00 am

Resetting FirstVisibleIndex if data is reloaded.

Post by WD_Gordon » Tue Jul 22, 2008 7:21 pm

I have a candle chart. I load data from a database but instead of binding the data source to the chart I load it manually. This is done to control the gap in candles for weekends. The user has the capability to change the data source via a combobox. When this is done the data is pulled from a new table and displayed. Here is a snippet of code where I reload the new data into the candle chart:

Code: Select all

int count = 1;

this.candleChart.Clear();
            
for (int i = 0; i < this.sourceTable.Rows.Count; i++)
{
      this.candleChart.Add(count++,
            Convert.ToDouble(this.sourceTable.Rows[i]["OPEN1"]),
            Convert.ToDouble(this.sourceTable.Rows[i]["HIGH2"]),
            Convert.ToDouble(this.sourceTable.Rows[i]["LOW3"]),
            Convert.ToDouble(this.sourceTable.Rows[i]["CLOSE4"]));
}
I enable panning and allow the user to scroll via a scrollbar using the Scroll() method. The issue comes in when I reload new data into the candle cahrt it somehow remembers the scroll position of where the chart was with the previous data. In other words, if I load 1000 candles and the user scrolls pr pans to the right say 100 candles then decides to load other data, when it loads the FirstVisibleIndex remains at 100 and it positions the candles as well.

Is there a way to reset this an ensure it starts at zero?

Thanks,
Kevin

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

Post by Narcís » Wed Jul 23, 2008 7:29 am

Hi Kevin,

To force axes scales returning to its original position you can use this:

Code: Select all

			tChart1.Axes.Left.Automatic = true;
			tChart1.Axes.Bottom.Automatic = true;
Or use their SetMinMax to set them to desired position.
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