snapshot.
This commit is contained in:
parent
7bb82ae691
commit
e9a36274ac
23 changed files with 551 additions and 445 deletions
26
annotation_series.go
Normal file
26
annotation_series.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package chart
|
||||
|
||||
// Annotation is a label on the chart.
|
||||
type Annotation struct {
|
||||
X, Y float64
|
||||
Label string
|
||||
}
|
||||
|
||||
// AnnotationSeries is a series of labels on the chart.
|
||||
type AnnotationSeries struct {
|
||||
Name string
|
||||
Style Style
|
||||
YAxis YAxisType
|
||||
Annotations []Annotation
|
||||
}
|
||||
|
||||
// Render draws the series.
|
||||
func (as AnnotationSeries) Render(r Renderer, canvasBox Box, xrange, yrange Range) {
|
||||
if as.Style.Show {
|
||||
for _, a := range as.Annotations {
|
||||
lx := xrange.Translate(a.X) + canvasBox.Left
|
||||
ly := yrange.Translate(a.Y) + canvasBox.Top
|
||||
DrawAnnotation(r, canvasBox, xrange, yrange, as.Style, lx, ly, a.Label)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue