sourcecode.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <html>
  2. <head>
  3. <title>Timeline sourcecode documentation</title>
  4. <link rel='stylesheet' href='default.css' type='text/css'>
  5. </head>
  6. <body>
  7. <h1>Timeline sourcecode documentation</h1>
  8. <p>
  9. The timeline is written in pure Javascript. There is a GWT wrapper written
  10. that enables you to use the Timeline from within GWT (Google Web Toolkit).
  11. This page explains how the sourcecode is built up.
  12. For detailed information about all functions, one can use the
  13. <a href="jsdoc">JsDoc</a> reference pages.
  14. </p>
  15. <h2>Timeline Javascript</h2>
  16. <p>
  17. The sourcecode of the Timeline is in one javascript file, <code>timeline.js</code>.
  18. The file contains a class <code>Timeline</code>, which is defined in the
  19. namespace <code>links</code>.
  20. All important local variables and constants are defined in the constructor.
  21. The constructor requires a parameter with teh container element inside which
  22. Timeline will be created.
  23. </p>
  24. <p>
  25. The constructor calls the function <code>create()</code>. This function creates
  26. a frame element. Inside the frame, a canvas is created. The html elements for
  27. the axis and the events are added to the canvas.
  28. </p>
  29. <p>
  30. After the Timeline is constructed, it can be filled and drawn via the function
  31. <code>draw(data, options)</code>. The parameter <code>data</code> is a DataTable which
  32. contains the events. <code>options</code> is an optional name-value map containing
  33. settings for the timeline such as startDate, endDate, widht, height, layout.
  34. The function <code>draw()</code> loads the data, draws the axis, and draws the
  35. events.
  36. </p>
  37. <p>
  38. The Timeline can be moved by dragging it. When moving the Timeline, the canvas
  39. is moved inside the frame. To prevent the user from seeing an undrawn area
  40. when moving, the actual with of the canvas is three times the width of the
  41. screen, and only the middle part is visible.
  42. After the mouse button is up again, the the whole timeline is redrawn again.
  43. When zooming, the timeline is redrawn after each zoom action. This is needed
  44. because the axis changes and possibly the scale too.
  45. </p>
  46. <p>
  47. Todo...
  48. </p>
  49. </body>
  50. </html>