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