tests pass
This commit is contained in:
parent
fa93bd8abb
commit
781a45d770
5 changed files with 35 additions and 5 deletions
11
chart.go
11
chart.go
|
|
@ -103,6 +103,8 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error {
|
|||
canvasBox := c.getDefaultCanvasBox()
|
||||
xf, yf, yfa := c.getValueFormatters()
|
||||
|
||||
Debugf(c.Log, "chart; canvas box: %v", canvasBox)
|
||||
|
||||
xr, yr, yra = c.setRangeDomains(canvasBox, xr, yr, yra)
|
||||
|
||||
err = c.checkRanges(xr, yr, yra)
|
||||
|
|
@ -116,6 +118,8 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error {
|
|||
canvasBox = c.getAxesAdjustedCanvasBox(r, canvasBox, xr, yr, yra, xt, yt, yta)
|
||||
xr, yr, yra = c.setRangeDomains(canvasBox, xr, yr, yra)
|
||||
|
||||
Debugf(c.Log, "chart; axes adjusted canvas box: %v", canvasBox)
|
||||
|
||||
// do a second pass in case things haven't settled yet.
|
||||
xt, yt, yta = c.getAxesTicks(r, xr, yr, yra, xf, yf, yfa)
|
||||
canvasBox = c.getAxesAdjustedCanvasBox(r, canvasBox, xr, yr, yra, xt, yt, yta)
|
||||
|
|
@ -126,6 +130,8 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error {
|
|||
canvasBox = c.getAnnotationAdjustedCanvasBox(r, canvasBox, xr, yr, yra, xf, yf, yfa)
|
||||
xr, yr, yra = c.setRangeDomains(canvasBox, xr, yr, yra)
|
||||
xt, yt, yta = c.getAxesTicks(r, xr, yr, yra, xf, yf, yfa)
|
||||
|
||||
Debugf(c.Log, "chart; annotation adjusted canvas box: %v", canvasBox)
|
||||
}
|
||||
|
||||
c.drawCanvas(r, canvasBox)
|
||||
|
|
@ -382,14 +388,17 @@ func (c Chart) getAxesAdjustedCanvasBox(r Renderer, canvasBox Box, xr, yr, yra R
|
|||
axesOuterBox := canvasBox.Clone()
|
||||
if !c.XAxis.Style.Hidden {
|
||||
axesBounds := c.XAxis.Measure(r, canvasBox, xr, c.styleDefaultsAxes(), xticks)
|
||||
Debugf(c.Log, "chart; x-axis measured %v", axesBounds)
|
||||
axesOuterBox = axesOuterBox.Grow(axesBounds)
|
||||
}
|
||||
if !c.YAxis.Style.Hidden {
|
||||
axesBounds := c.YAxis.Measure(r, canvasBox, yr, c.styleDefaultsAxes(), yticks)
|
||||
Debugf(c.Log, "chart; y-axis measured %v", axesBounds)
|
||||
axesOuterBox = axesOuterBox.Grow(axesBounds)
|
||||
}
|
||||
if !c.YAxisSecondary.Style.Hidden {
|
||||
if !c.YAxisSecondary.Style.Hidden && c.hasSecondarySeries() {
|
||||
axesBounds := c.YAxisSecondary.Measure(r, canvasBox, yra, c.styleDefaultsAxes(), yticksAlt)
|
||||
Debugf(c.Log, "chart; y-axis secondary measured %v", axesBounds)
|
||||
axesOuterBox = axesOuterBox.Grow(axesBounds)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue