I am creating a chart based on candlestick bars for stocks. I have a problem with scrolling. I am using Teecharts. When the chart pulls up, the end the x-axis is 5/16/2000. When I click on the scroll to move to the right, the beginning of the charts start X-axis is 4/5/2001. Here are my questions:
1. Why doesn't the x-axis start date beginning with the previous X-end date?
2. What parameters control the x-axis scroll? The axis is based on date.
3. In the code, I am using the following in the candlestickscroll. I notice when I use the LastDisplayIndex it gives me the values from the chart before the scroll. How do I get the values after the chart will repaint with the new x-axis values?
Code: Select all
vMin := 9999999;
vMax := -1;
if CandleStickSeries.LastValueIndex > 0 then
begin
vMin := CandleStickSeries.Lowvalues.items[CandleStickSeries.FirstDisplayedIndex] ;
vMax := CandleStickSeries.HighValues.items[CandleStickSeries.FirstDisplayedIndex] ;
vCandleBarDisplayed := CandleStickSeries.VisibleCount;
vCurrentCandleIndex := CandleStickSeries.LastDisplayedIndex;
for I := vCurrentCandleIndex to vCandleBarDisplayed +vCurrentCandleIndex do
begin
if CandleStickSeries.HighValues.Items[I] > vMax then vMax :=
CandleStickSeries.HighValues.Items[I];
if CandleStickSeries.LowValues.Items[I] < vMin then vMin :=
CandleStickSeries.LowValues.Items[I];
end;
end;