title: Time Trackbar or Very Large Values using Trackbar
body: <p>I am writing a vehicle tracking application using GMAP.NET </p>
  
  <p>I want to display simultaneous movement of multiple vehicle markers based on date/time.</p>
  
  <p>For this, I would like to use a Trackbar such that when the User slides the trackbar, the corresponding movement of multiple markers is shown. </p>
  
  <p><em>I did the same application on the browser and it worked very well. I converted the datetime attribute of the marker tag to a UNIX Timestamp and then set the trackbar (NOUI Slider) values to the the UNIX Timestamp range.</em> </p>
  
  <p>But, Now I find that I cannot do this at all with the Windows Desktop C# Trackbar. </p>
  
  <p>The problems are:</p>
  
  <ol>
  <li><p>The trackbar is unable to take very large timestamp values. Eg. 5 years data. </p></li>
  <li><p>Even after reducing the very large numbers, the trackbar still cannot take such high values and keeps lagging or crashing. </p></li>
  </ol>
  
  <blockquote>
    <p>Eg. I need to show data for 5 years. In this case, my trackbar would have minimum value - 1262304000 (i.e. 01-01-2010) to 1425203100 (i.e. 01-03-2015 | 09:45).</p>
    
    <p>But such large values just don't work with my trackbar. </p>
    
    <p>I have even taken reduction eg. setting  1262304000 as 1 and then 162899100 (i.e. 1425203100 - 1262304000) becomes my maximum value. </p>
    
    <p>But even this is very intensive and the trackbar does not work.</p>
  </blockquote>
  
  <p><strong>Please suggest if there is a time-trackbar which can show very a large datetimerange or how I can use a regular trackbar with very large values.</strong></p>
  
  <p>The code as follows - </p>
  
  <p>A. The function to convert datetime to a UNIX Timestamp</p>
  
  <pre><code>    public Int32 UnixTimeStampUTC(DateTime datetime)
      {
          Int32 unixTimeStamp;
  
          DateTime zuluTime = datetime.ToUniversalTime();
          DateTime unixEpoch = new DateTime(1970, 1, 1).ToUniversalTime();
          unixTimeStamp = (Int32)(zuluTime.Subtract(unixEpoch)).TotalSeconds;
          return unixTimeStamp;
      }
  </code></pre>
  
  <p>B. Taking the DateTime from a DataTable by Concatenating Date &amp; Time Columns and Adding a third Column to hold the Unix TimeStamp of the DateTime Column </p>
  
  <pre><code>            for (int z = 0; z &lt; dt.Rows.Count; z++)
              {
  
                  if (reviseddt.Rows[z]["date"].ToString() != "")
                  {
                      dte = DateTime.Parse(reviseddt.Rows[z]["date"].ToString());
  
                      dteticks = UnixTimeStampUTC(dte);
  
                  }
                  else
                  {
                      dteticks = 0;
                  }
  
                  if (reviseddt.Rows[z]["time"].ToString() != "")
                  {
                      tm = DateTime.Parse(reviseddt.Rows[z]["time"].ToString());
  
                      tmticks = UnixTimeStampUTC(tm);
                  }
                  else
                  {
                      tmticks = 0;
                  }
  
  
                  Int32 fullDt = dteticks + tmticks;
  
                  reviseddt.Rows[z]["datetime"] = fullDt.ToString();
                  reviseddt.Rows[z]["datetimestring"] = reviseddt.Rows[z]["date"].ToString() + reviseddt.Rows[z]["time"].ToString();
  </code></pre>
  
  <p>C. Initalising the Trackbar by Getting the min and max values from the datetime column in the datatable and then taking the range as the difference between the min and max values. Hence, Trackbar range = 1 to (Max-Min)</p>
  
  <pre><code>string strminlevel = toplotDataTable.Compute("min(datetime)", String.Empty).ToString();
  string strmaxLevel = toplotDataTable.Compute("max(datetime)", String.Empty).ToString();
  
  Int32 minLevel = Convert.ToInt32(strminlevel);
  Int32 maxLevel = Convert.ToInt32(strmaxLevel);
  
  Int32 rangeint = maxLevel - minLevel;
  
  trackBarMoveTarget.Maximum = rangeint;
  trackBarMoveTarget.Minimum = 1;
  trackBarMoveTarget.LargeChange = 100;
  trackBarMoveTarget.SmallChange = 1;
  </code></pre>