# Basic timebar with array of timestamps
config <- timebar(
data = c(1609459200000, 1609545600000, 1609632000000) # Jan 1-3, 2021 in milliseconds
)
# Chart-type timebar with time-value pairs
config <- timebar(
data = list(
list(time = 1609459200000, value = 10),
list(time = 1609545600000, value = 25),
list(time = 1609632000000, value = 15)
),
timebarType = "chart",
width = 600,
height = 100,
position = "top"
)
# With custom callbacks
config <- timebar(
data = c(1609459200000, 1609545600000, 1609632000000),
onChange = JS("(values) => {
console.log('Time changed:', values);
}"),
onPlay = JS("() => {
console.log('Playback started');
}")
)
# With custom time getter function for elements
config <- timebar(
data = c(1609459200000, 1609545600000, 1609632000000),
getTime = JS("(datum) => {
return datum.created_at; // Get time from created_at property
}")
)
Run the code above in your browser using DataLab