Is there a way to control the number of candles displayed in a candle chart other than using the MaxPointsPerPage property? I am loading a 1000 candles but only want to show 50 to start with but the user will need to have the ability to increase or decrease the number of candles displayed during runtime.
Thanks,
Kevin
Controlling number of candles displayed.
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Re: Controlling number of candles displayed.
Hello Kevin,
I think that using the Page class is still the best way to go. You could present the MaxPointsPerPage property to your users to let them select how many points per page they wish to see, e.g.WD_Gordon wrote:Is there a way to control the number of candles displayed in a candle chart other than using the MaxPointsPerPage property? I am loading a 1000 candles but only want to show 50 to start with but the user will need to have the ability to increase or decrease the number of candles displayed during runtime.
Code: Select all
private Steema.TeeChart.Styles.Candle series;
private bool setting;
private void InitializeChart()
{
setting = true;
tChart1.Aspect.View3D = false;
tChart1.Series.Add(series = new Candle());
series.FillSampleValues(100);
tChart1.Page.MaxPointsPerPage = 50;
tChart1.Page.Current = tChart1.Page.Count - 1;
numericUpDown1.Value = tChart1.Page.MaxPointsPerPage;
setting = false;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
if (!setting)
{
tChart1.Page.MaxPointsPerPage = (int)numericUpDown1.Value;
}
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Hi Chistopher,
I tried setting the MaxPointsPerPage value during runtime and it works for the most part.
The issue I am running into is I also have a scroll bar set up and I use the Axes.Bottom.Scroll() method to move the points. When I call this method it changes the Axes.Bottom.Automatic property to false. When this happens, setting the MaxPointsPerPage value during runtime no longer works. I even tried setting Axes.Bottom.Automatic = true right after calling the Scroll() method but setting the MaxPointsPerPage value during runtime still doesn't work.
So to sum ti up, setting the MaxPointsPerPage during runtime always works until the first time you call the Scroll() method.
Any thoughts?
Thanks,
Kevin
I tried setting the MaxPointsPerPage value during runtime and it works for the most part.
The issue I am running into is I also have a scroll bar set up and I use the Axes.Bottom.Scroll() method to move the points. When I call this method it changes the Axes.Bottom.Automatic property to false. When this happens, setting the MaxPointsPerPage value during runtime no longer works. I even tried setting Axes.Bottom.Automatic = true right after calling the Scroll() method but setting the MaxPointsPerPage value during runtime still doesn't work.
So to sum ti up, setting the MaxPointsPerPage during runtime always works until the first time you call the Scroll() method.
Any thoughts?
Thanks,
Kevin
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello Kevin,
Well, you could emulate the Paging functionality while enabling users to scroll the chart with code similar to the following (click and drag the bottom axis to scroll):WD_Gordon wrote: Any thoughts?
Code: Select all
private Steema.TeeChart.Styles.Candle series;
private Steema.TeeChart.Tools.AxisScroll tool;
private double step;
private void InitializeChart()
{
button1.Text = "<<";
button2.Text = "<";
button3.Text = ">";
button4.Text = ">>";
tChart1.Aspect.View3D = false;
tChart1.Series.Add(series = new Candle());
series.FillSampleValues(1000);
tChart1.Axes.Bottom.Labels.Angle = 90;
step = (series.DateValues[1] - series.DateValues[0]) / 2;
//tChart1.Page.MaxPointsPerPage = 50;
//tChart1.Page.Current = tChart1.Page.Count - 1;
tChart1.Axes.Bottom.SetMinMax(series.DateValues[series.Count - 51] - step, series.DateValues[series.Count - 1] + step);
tChart1.Tools.Add(tool = new AxisScroll());
tool.Axis = tChart1.Axes.Bottom;
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Axes.Bottom.SetMinMax(series.DateValues[0] - step, series.DateValues[49] + step);
//tChart1.Page.Current = 1;
}
private void button2_Click(object sender, EventArgs e)
{
int first = series.FirstVisibleIndex - 49;
int last = series.LastVisibleIndex - 49;
if (first < 0)
{
first = 0;
last = 49;
}
tChart1.Axes.Bottom.SetMinMax(series.DateValues[first] - step, series.DateValues[last] + step);
//tChart1.Page.Previous();
}
private void button3_Click(object sender, EventArgs e)
{
int first = series.FirstVisibleIndex + 49;
int last = series.LastVisibleIndex + 49;
if (last >= series.Count)
{
first = series.Count - 51;
last = series.Count - 1;
}
tChart1.Axes.Bottom.SetMinMax(series.DateValues[first] - step, series.DateValues[last] + step);
//tChart1.Page.Next();
}
private void button4_Click(object sender, EventArgs e)
{
tChart1.Axes.Bottom.SetMinMax(series.DateValues[series.Count - 51] - step, series.DateValues[series.Count - 1] + step);
//tChart1.Page.Current = tChart1.Page.Count - 1;
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/