Page 1 of 2
LastVisibleIndex not correct
Posted: Fri Aug 08, 2008 7:37 pm
by 14049416
Hi,
Maybe I have something set causing this issue but when I go to the end of my candle data and query the LastVisibleIndex it shows 99. (I have 100 loaded for this example) If I pan to the left until that candle is gone and then query the LastVisibleIndex again it still shows 99. If I pan again to the left to hide the next one then it shows 98, which should be 97.
Is there something setup on the chart incorrectly that can cause this? I also notice that even though my MaxPointsPerPage is set to 50, I can see 52 candles when the chart is first displayed.
Thanks,
Kevin
Re: LastVisibleIndex not correct
Posted: Mon Aug 11, 2008 11:05 am
by Chris
Hello Kevin,
WD_Gordon wrote:Maybe I have something set causing this issue but when I go to the end of my candle data and query the LastVisibleIndex it shows 99. (I have 100 loaded for this example) If I pan to the left until that candle is gone and then query the LastVisibleIndex again it still shows 99. If I pan again to the left to hide the next one then it shows 98, which should be 97.
Ok, I can reproduce this issue here and have added it to our bug tracking software with reference TF02013319. Please be aware that this defect has already been fixed for the next maintenance release due out in the next few days. Also, please note that the value of 99 is correct. Series indexes start at zero, so the 100th point has an index of 99. What isn't correct is the LastVisibleIndex value of 50 on the first page (which should be 49).
WD_Gordon wrote:
Is there something setup on the chart incorrectly that can cause this? I also notice that even though my MaxPointsPerPage is set to 50, I can see 52 candles when the chart is first displayed.
I'm afraid I haven't been able to reproduce this one. Of the times I've tested it, the number of visible points has been exactly 50.
Posted: Mon Aug 11, 2008 12:53 pm
by 14049416
Thanks Christopher, I look forward to the update.
I found the issue where it was showing 2 extra candles. I had the Axes.Right.MaximumOffset property set to 20, which caused the 2 extra candles to display. Probably because it was set so high. I backed it back down to 5 and it works fine now.
Posted: Mon Aug 11, 2008 1:39 pm
by Chris
Hello Kevin,
WD_Gordon wrote:I found the issue where it was showing 2 extra candles. I had the Axes.Right.MaximumOffset property set to 20, which caused the 2 extra candles to display. Probably because it was set so high. I backed it back down to 5 and it works fine now.
I see, ok. Well, taking into account the MaximumOffset and MinimumOffset when performing the calculation of the FirstVisibleIndex and LastVisibleIndex properties was one of the issues that had to be addressed for TF02013319. I would expect this area to work considerably better.
Posted: Tue Sep 23, 2008 2:11 pm
by 14049416
Christopher,
I am not so sure TF02013319 fixed this issue.
1. It appears that setting the MinimumOffset or MaximumOffset properties no longer works.
2. I am no longer using the Page.MaxPointsPerPage property to determine the number of candles displayed. I am trying to use the SetMinMax method but it seems that the FirstVisibleIndex and LastVisibleIndex doesn't always represent the correct index.
I can load call SetMinMax(0, 9) and expect to see 10 candles, which I do. The First and LastVisibleIndex are correct, 0 and 9. But if I pan just a pixel or 2 to the right, the LastVisibleIndex jumps to 10, but that candle is far from being seen.
3. I have also noticed a difference in how the left most candle is removed from the chart before hitting the edge where as the right most candle scrolls off the chart.
4. I added code in the AllowScroll event to control panning. It appears to work for the most part other than it gets in a state where the first candle will not always display.
Code: Select all
if (a == this.tChart1.Axes.Bottom)
{
if (e.Min < 0 || e.Max > this.pointsToLoad - 1)
e.AllowScroll = false;
else
e.AllowScroll = true;
}
I have created a very small sample application that demonstrates everything I have mentioned above. If you would like it I can get it to you if you explain to me how to send it.
Thanks,
Kevin
Posted: Tue Sep 23, 2008 2:24 pm
by narcis
Hi Kevin,
Yes please, send us the example project at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance.
Posted: Tue Sep 23, 2008 2:36 pm
by 14049416
Hi NarcĂs,
I cannot get to any of the addresses you specified. Both IE and FireFox says that www.steema.net\uploads or even
www.steema.net does not exist. Is the server down?
Thanks,
Kevin
Posted: Tue Sep 23, 2008 2:47 pm
by narcis
Hi Kevin,
No the problem is a major issue in a datacenter or DNS server which is afecting most spanish ISPs today
. Using steema.net's IP should solve the problem:
http://217.126.48.36/upload/
Hope this helps!
Posted: Tue Sep 23, 2008 2:53 pm
by narcis
Hi Kevin,
Some more details about the incident:
http://tinyurl.com/3fgoql
Posted: Tue Sep 23, 2008 3:00 pm
by Chris
"In fact there is a twitter created where comment that could have caused a fire in the circuit of the air conditioning in the building."
Should read:
"In fact a twitter has been created which comments that a fire caused by a short circuit in an air conditioning unit could have produced the problem."
Spain
Posted: Tue Sep 23, 2008 3:49 pm
by 14049416
Wow, that's not good. Hopefully things will be back up and running soon. I uploaded the sample project, named SampleCandle.zip.
Thanks,
Kevin
Posted: Tue Sep 23, 2008 3:50 pm
by Chris
Kevin,
Kevin wrote:Christopher,
1. It appears that setting the MinimumOffset or MaximumOffset properties no longer works.
Using the latest build, released today, the following code seems to work just fine:
Code: Select all
private void InitializeChart()
{
tChart1 = new Steema.TeeChart.TChart();
watch = new System.Diagnostics.Stopwatch();
tChart1.Dock = DockStyle.Fill;
this.panel1.Controls.Add(tChart1);
tChart1.Aspect.View3D = false;
tChart1.Series.Add(series = new Candle());
series.FillSampleValues();
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Axes.Left.MaximumOffset = 100;
}
Kevin wrote:
I can load call SetMinMax(0, 9) and expect to see 10 candles, which I do. The First and LastVisibleIndex are correct, 0 and 9. But if I pan just a pixel or 2 to the right, the LastVisibleIndex jumps to 10, but that candle is far from being seen.
This behaviour is by design, that is to say, that a candle's date value is from the previous date value to the one you set it. This means that adding an hour to a value, as in the code below, will cause the first and last to jump one. We could discuss making the date value of a candle "in the middle" of the previous one and the next one, but this would certainly slow down the candle series if this were the default case as there is no guarantee that date values will be equidistant. Maybe we could come up with an idea for a new property ...
Code: Select all
private void InitializeChart()
{
tChart1 = new Steema.TeeChart.TChart();
watch = new System.Diagnostics.Stopwatch();
tChart1.Dock = DockStyle.Fill;
this.panel1.Controls.Add(tChart1);
tChart1.Aspect.View3D = false;
tChart1.Series.Add(series = new Candle());
DateTime today = DateTime.Today;
for (int i = 0; i < 50; i++)
{
series.Add(today, 50, 100, 0, 75);
today = today.AddDays(1);
}
tChart1.Axes.Bottom.SetMinMax(DateTime.Today.AddHours(1), DateTime.Today.AddDays(9).AddHours(1));
}
private void button1_Click(object sender, EventArgs e)
{
string message = "First: " + series.FirstVisibleIndex.ToString() +
" First: " + series.LastVisibleIndex.ToString();
MessageBox.Show(message);
}
Kevin wrote:
3. I have also noticed a difference in how the left most candle is removed from the chart before hitting the edge where as the right most candle scrolls off the chart.
I'll have to wait for you to upload your example project, as here I can't immediately see what you mean. Maybe an image or two would help?
Kevin wrote:
4. I added code in the AllowScroll event to control panning. It appears to work for the most part other than it gets in a state where the first candle will not always display.
Running the following code seems to work as expected, that is, e.AllowScroll is set to false. Please be aware that you should be checking for datetime values, as in the code below:
Code: Select all
private void InitializeChart()
{
tChart1 = new Steema.TeeChart.TChart();
watch = new System.Diagnostics.Stopwatch();
tChart1.Dock = DockStyle.Fill;
this.panel1.Controls.Add(tChart1);
tChart1.Aspect.View3D = false;
tChart1.Series.Add(series = new Candle());
DateTime today = DateTime.Today;
for (int i = 0; i < 50; i++)
{
series.Add(today, 50, 100, 0, 75);
today = today.AddDays(1);
}
tChart1.AllowScroll+=new TChart.AllowScrollEventHandler(tChart1_AllowScroll);
tChart1.Axes.Bottom.SetMinMax(DateTime.Today, DateTime.Today.AddDays(this.pointsToLoad - 1));
}
private int pointsToLoad = 10;
void tChart1_AllowScroll(Axis a, TChart.AllowScrollEventArgs e)
{
if (a == this.tChart1.Axes.Bottom)
{
if (e.Min < DateTime.Today.ToOADate() || e.Max > DateTime.Today.AddDays(this.pointsToLoad - 1).ToOADate())
e.AllowScroll = false;
else
e.AllowScroll = true;
}
}
I wonder if the reference you have in your project is set to the correct one, the lastest version?
Posted: Tue Sep 23, 2008 4:00 pm
by 14049416
Hey Christopher,
In reference to your answer of question 4, I can't use dates. This is an issue which I addressed a couple of months ago. We divide our candles into several increments such as 5, 15, 30 minute candles and such. The issue is when the markets close Friday evening and reopen Sunday there are large gaps in the chart. You guys mentioned that you may address this in the future. As for now, I load the candles numerically and handle the date/time labeling in the GetAxisDrawLabel event. That eliminates the gaps.
You will see the issue I mentioned in the sample project I just uploaded.
Thanks,
Kevin
Posted: Tue Sep 23, 2008 4:20 pm
by Chris
Kevin,
Kevin wrote:In reference to your answer of question 4, I can't use dates. This is an issue which I addressed a couple of months ago.
I see, no problem.
Any comments on any of my other responses?
Posted: Tue Sep 23, 2008 4:51 pm
by 14049416
Christopher,
Ref # 1: Well I just downloaded the latest and using your code I set the values but they still have no effect. I even cut and past the code you showed above. After looking even deeper I notice that when I changed the MaximumOffset in a button event it appears that the property is not retaining the value. Click the button a second time and it shows its original value.
Ref # 2: I understand what you are saying but it is a little confusing as one would expect if the LastVisibleIndex, "visible" being the key here, equals 10 then you would expect to actually see that candle on the chart.
Ref # 3: You stated you would have to wait for the sample to # 3, did you observe the same thing and is this by design? (See comments for #4)
Ref # 4: So you do not see what I am seeing, where if you pan to the right then back to the left a few times the first candle will not be displayed? Well I can produce it everytime on my dev box but on another dev box next to me it works just fine. As a matter of fact # 3 works fine on that one as well. This must have to do with the video driver on my box.
Thanks,
Kevin