This project hasn't bee worked on in a long time. Feel free to reference/use it and/or pieces of it, but know that there are probably better ways to do this now.
A silly little library for generating histograms off of time-ranged events that can overlap
// Data types used (already defined)
type EventList []Event
type Event struct {
Begin time.Time
End time.Time
Data int64
}
// Generate a histogram
hist := Histogram(
myEventList, // Some list of events
time.Hour, // 1hr resolution on render
time.Now(), // Start time
time.Now().Add(time.Hour), // End time
)
// Marshal to flot-friendly JSON
flotSeries := json.Marshal(hist)
For concrete, see the tests.