Comments added

This commit is contained in:
Luis Fernando Molina committed 2018-03-03 13:06:56 +01:00
1 parent d3124dbd93
commit 2cbc9c7557
3 files changed
+14 -1

No files matched your search

+13
View File
@@ -86,6 +86,19 @@ function newTimeLineCoordinateSystem() {
function transformThisPoint(point) {
/*
This is the straigh fordward transformation this object provides. The input is a point on the data set that wants to be plotted in a timeline.
The x value of the point must be a datetime.valueOf() and is going to be transformed into an x value on the coordinate system of the timeline.
The y value should be a value in the dataset at that moment in time. Depending on how this coordinate system was initialized then are the
possible values y can have. For sure it must be in the range between the min and max y declared at initialization. The y value has a special
treatment since the browser canvas object used, has a zero y value at the top, while the timeline we use has a zero y value at the botton,
for that reason y is flipped.
Besides this, what we do is to multiply by the scale, which in turn is calculated at initialization time depending on the values provided.
*/
point = {
x: (point.x - this.min.x) * this.scale.x,
y: maxHeight - (point.y - this.min.y) * this.scale.y