Page 1 of 1
Resize Gantt item programically?
Posted: Fri Mar 15, 2013 8:54 pm
by 15665264
I need to update the end time on Gantt items programically. What's the best way to accomplish this?
This graph has several series with a large number of data points and is updated in real time, so efficiency is important.
Thanks!
Re: Resize Gantt item programically?
Posted: Mon Mar 18, 2013 12:16 pm
by 10050769
Hello Jeremy Johnson,
The data are updated automatically as you can see in next simple example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.Candle candle;
double tmpOpen, tmpClose;
Timer timer1;
Random r;
DateTime dt;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
//Series
candle = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
PopulateSeries();
// Set custom axes
candle.Pointer.InflateMargins = false;
tChart1.Axes.Bottom.Labels.DateTimeFormat = "mm:ss";
tChart1.Axes.Bottom.Labels.Angle = 90;
//Timer
timer1 = new Timer();
timer1.Start();
timer1.Interval = 1000;
timer1.Tick += new EventHandler(timer1_Tick);
}
void timer1_Tick(object sender, EventArgs e)
{
PopulateSeries();
}
private void PopulateSeries()
{
r = new Random();
dt = DateTime.Now;
tChart1.AutoRepaint = false;
// show only 50 points - delete the rest
while (candle.Count > 1000)
{
candle.Delete(0);
}
if (candle.Count > 1000)
{
candle.Delete(0);
}
else
{
for (int t = 0; t < 10; t++)
{ //Candle;
tmpOpen = r.Next(100);
tmpClose = tmpOpen - r.Next(100);
candle.Add(dt, tmpOpen, tmpOpen + r.Next(50), tmpClose - r.Next(50), tmpClose);
dt = dt.AddSeconds(15);
}
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
}
Could you tell us if previous code help you to solve your problems?
I hope will helps.
Thanks,
Re: Resize Gantt item programically?
Posted: Thu Mar 21, 2013 6:03 pm
by 15665264
Thanks, so I gather that to resize an item I need to delete it and then add a new item of appropriate size.
It seems I may have a more fundamental problem with performance, though (see post to follow).