updatehandler.go 3.1 KB
Newer Older
liming6's avatar
liming6 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package tchart

import (
	"github.com/NimbleMarkets/ntcharts/linechart"
)

// DateUpdateHandler is used by timeserieslinechart to enable
// zooming in and out with the mouse wheel or page up and page down,
// moving the viewing window by holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by day increments.
// Uses linechart Canvas Keymap for keyboard messages.
func DateUpdateHandler(i int) linechart.UpdateHandler {
	daySeconds := 86400 * i // number of seconds in a day
	return linechart.XAxisUpdateHandler(float64(daySeconds))
}

// DateNoZoomUpdateHandler is used by timeserieslinechart to enable
// moving the viewing window by using the mouse scroll wheel,
// holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by day increments.
// Uses linechart Canvas Keymap for keyboard messages.
func DateNoZoomUpdateHandler(i int) linechart.UpdateHandler {
	daySeconds := 86400 * i // number of seconds in a day
	return linechart.XAxisNoZoomUpdateHandler(float64(daySeconds))
}

// HourUpdateHandler is used by timeserieslinechart to enable
// zooming in and out with the mouse wheel or page up and page down,
// moving the viewing window by holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by hour increments.
// Uses linechart Canvas Keymap for keyboard messages.
func HourUpdateHandler(i int) linechart.UpdateHandler {
	hourSeconds := 3600 * i // number of seconds in a hour
	return linechart.XAxisUpdateHandler(float64(hourSeconds))
}

// HourNoZoomUpdateHandler is used by timeserieslinechart to enable
// moving the viewing window by using the mouse scroll wheel,
// holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by hour increments.
// Uses linechart Canvas Keymap for keyboard messages.
func HourNoZoomUpdateHandler(i int) linechart.UpdateHandler {
	hourSeconds := 3600 * i // number of seconds in a hour
	return linechart.XAxisNoZoomUpdateHandler(float64(hourSeconds))
}

// SecondUpdateHandler is used by timeserieslinechart to enable
// zooming in and out with the mouse wheel or page up and page down,
// moving the viewing window by holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by second increments.
// Uses linechart Canvas Keymap for keyboard messages.
func SecondUpdateHandler(i int) linechart.UpdateHandler {
	return linechart.XAxisUpdateHandler(float64(i))
}

// SecondNoZoomUpdateHandler is used by timeserieslinechart to enable
// moving the viewing window by using the mouse scroll wheel,
// holding down mouse button and moving,
// and moving the viewing window with the arrow keys.
// There is only movement along the X axis by second increments.
// Uses linechart Canvas Keymap for keyboard messages.
func SecondNoZoomUpdateHandler(i int) linechart.UpdateHandler {
	return linechart.XAxisNoZoomUpdateHandler(float64(i))
}