mostly works.
This commit is contained in:
parent
e9a36274ac
commit
abfdc3e0d9
14 changed files with 465 additions and 159 deletions
|
|
@ -14,13 +14,35 @@ type AnnotationSeries struct {
|
|||
Annotations []Annotation
|
||||
}
|
||||
|
||||
// GetName returns the name of the time series.
|
||||
func (as AnnotationSeries) GetName() string {
|
||||
return as.Name
|
||||
}
|
||||
|
||||
// GetStyle returns the line style.
|
||||
func (as AnnotationSeries) GetStyle() Style {
|
||||
return as.Style
|
||||
}
|
||||
|
||||
// GetYAxis returns which YAxis the series draws on.
|
||||
func (as AnnotationSeries) GetYAxis() YAxisType {
|
||||
return as.YAxis
|
||||
}
|
||||
|
||||
// Render draws the series.
|
||||
func (as AnnotationSeries) Render(r Renderer, canvasBox Box, xrange, yrange Range) {
|
||||
func (as AnnotationSeries) Render(r Renderer, canvasBox Box, xrange, yrange Range, defaults Style) {
|
||||
if as.Style.Show {
|
||||
style := as.Style.WithDefaultsFrom(Style{
|
||||
FillColor: DefaultAnnotationFillColor,
|
||||
FontSize: DefaultAnnotationFontSize,
|
||||
StrokeColor: defaults.StrokeColor,
|
||||
StrokeWidth: defaults.StrokeWidth,
|
||||
Padding: DefaultAnnotationPadding,
|
||||
})
|
||||
for _, a := range as.Annotations {
|
||||
lx := xrange.Translate(a.X) + canvasBox.Left
|
||||
lx := canvasBox.Right - xrange.Translate(a.X)
|
||||
ly := yrange.Translate(a.Y) + canvasBox.Top
|
||||
DrawAnnotation(r, canvasBox, xrange, yrange, as.Style, lx, ly, a.Label)
|
||||
DrawAnnotation(r, canvasBox, xrange, yrange, style, lx, ly, a.Label)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue