test: add test for legend, series and theme
This commit is contained in:
parent
a128a2513c
commit
c289ba7cde
11 changed files with 828 additions and 43 deletions
|
|
@ -30,11 +30,16 @@ type LineSeries struct {
|
|||
BaseSeries
|
||||
}
|
||||
|
||||
func (bs LineSeries) Render(r chart.Renderer, canvasBox chart.Box, xrange, yrange chart.Range, defaults chart.Style) {
|
||||
style := bs.Style.InheritFrom(defaults)
|
||||
// 如果是居中,画线时重新调整
|
||||
if bs.TickPosition == chart.TickPositionBetweenTicks {
|
||||
xrange = wrapRange(xrange, bs.TickPosition)
|
||||
func (ls LineSeries) getXRange(xrange chart.Range) chart.Range {
|
||||
if ls.TickPosition != chart.TickPositionBetweenTicks {
|
||||
return xrange
|
||||
}
|
||||
chart.Draw.LineSeries(r, canvasBox, xrange, yrange, style, bs)
|
||||
// 如果是居中,画线时重新调整
|
||||
return wrapRange(xrange, ls.TickPosition)
|
||||
}
|
||||
|
||||
func (ls LineSeries) Render(r chart.Renderer, canvasBox chart.Box, xrange, yrange chart.Range, defaults chart.Style) {
|
||||
style := ls.Style.InheritFrom(defaults)
|
||||
xrange = ls.getXRange(xrange)
|
||||
chart.Draw.LineSeries(r, canvasBox, xrange, yrange, style, ls)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue