Resize Gantt item programically?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jeremy Johnson
Newbie
Newbie
Posts: 16
Joined: Wed Feb 27, 2013 12:00 am

Resize Gantt item programically?

Post by Jeremy Johnson » Fri Mar 15, 2013 8:54 pm

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!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Resize Gantt item programically?

Post by Sandra » Mon Mar 18, 2013 12:16 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jeremy Johnson
Newbie
Newbie
Posts: 16
Joined: Wed Feb 27, 2013 12:00 am

Re: Resize Gantt item programically?

Post by Jeremy Johnson » Thu Mar 21, 2013 6:03 pm

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).

Post Reply