Fixed Show to Hidden due to 5f42a580a9

This commit is contained in:
Jamie Isaacs 2019-11-15 17:43:09 -08:00
parent 14773ce69c
commit e7c4045740

View file

@ -220,7 +220,7 @@ func (sbc StackedBarChart) drawHorizontalBar(r Renderer, canvasBox Box, yoffset
barHeight := int(math.Ceil(bv.Value * float64(canvasBox.Width()))) barHeight := int(math.Ceil(bv.Value * float64(canvasBox.Width())))
barBox := Box{ barBox := Box{
Top: boxTop, Top: boxTop,
Left: util.Math.MinInt(xOffset-barHeight, canvasBox.Left+DefaultStrokeWidth), Left: MinInt(xOffset-barHeight, canvasBox.Left+DefaultStrokeWidth),
Right: xOffset, Right: xOffset,
Bottom: boxBottom, Bottom: boxBottom,
} }
@ -291,7 +291,7 @@ func (sbc StackedBarChart) drawXAxis(r Renderer, canvasBox Box) {
} }
func (sbc StackedBarChart) drawHorizontalXAxis(r Renderer, canvasBox Box) { func (sbc StackedBarChart) drawHorizontalXAxis(r Renderer, canvasBox Box) {
if sbc.XAxis.Show { if !sbc.XAxis.Hidden {
axisStyle := sbc.XAxis.InheritFrom(sbc.styleDefaultsAxes()) axisStyle := sbc.XAxis.InheritFrom(sbc.styleDefaultsAxes())
axisStyle.WriteToRenderer(r) axisStyle.WriteToRenderer(r)
r.MoveTo(canvasBox.Left, canvasBox.Bottom) r.MoveTo(canvasBox.Left, canvasBox.Bottom)
@ -302,7 +302,7 @@ func (sbc StackedBarChart) drawHorizontalXAxis(r Renderer, canvasBox Box) {
r.LineTo(canvasBox.Left, canvasBox.Bottom+DefaultVerticalTickHeight) r.LineTo(canvasBox.Left, canvasBox.Bottom+DefaultVerticalTickHeight)
r.Stroke() r.Stroke()
ticks := seq.RangeWithStep(0.0, 1.0, 0.2) ticks := LinearRangeWithStep(0.0, 1.0, 0.2)
for _, t := range ticks { for _, t := range ticks {
axisStyle.GetStrokeOptions().WriteToRenderer(r) axisStyle.GetStrokeOptions().WriteToRenderer(r)
tx := canvasBox.Left + int(t*float64(canvasBox.Width())) tx := canvasBox.Left + int(t*float64(canvasBox.Width()))
@ -356,7 +356,7 @@ func (sbc StackedBarChart) drawYAxis(r Renderer, canvasBox Box) {
} }
func (sbc StackedBarChart) drawHorizontalYAxis(r Renderer, canvasBox Box) { func (sbc StackedBarChart) drawHorizontalYAxis(r Renderer, canvasBox Box) {
if sbc.YAxis.Show { if !sbc.YAxis.Hidden {
axisStyle := sbc.YAxis.InheritFrom(sbc.styleDefaultsHorizontalAxes()) axisStyle := sbc.YAxis.InheritFrom(sbc.styleDefaultsHorizontalAxes())
axisStyle.WriteToRenderer(r) axisStyle.WriteToRenderer(r)
@ -480,7 +480,7 @@ func (sbc StackedBarChart) getHorizontalAdjustedCanvasBox(r Renderer, canvasBox
totalHeight += bar.GetWidth() + sbc.GetBarSpacing() totalHeight += bar.GetWidth() + sbc.GetBarSpacing()
} }
if sbc.YAxis.Show { if !sbc.YAxis.Hidden {
yAxisWidth := DefaultHorizontalTickWidth yAxisWidth := DefaultHorizontalTickWidth
axisStyle := sbc.YAxis.InheritFrom(sbc.styleDefaultsHorizontalAxes()) axisStyle := sbc.YAxis.InheritFrom(sbc.styleDefaultsHorizontalAxes())
@ -498,7 +498,7 @@ func (sbc StackedBarChart) getHorizontalAdjustedCanvasBox(r Renderer, canvasBox
lines := Text.WrapFit(r, bar.Name, barLabelBox.Width(), axisStyle) lines := Text.WrapFit(r, bar.Name, barLabelBox.Width(), axisStyle)
linesBox := Text.MeasureLines(r, lines, axisStyle) linesBox := Text.MeasureLines(r, lines, axisStyle)
yAxisWidth = util.Math.MaxInt(linesBox.Height()+(2*DefaultXAxisMargin), yAxisWidth) yAxisWidth = MaxInt(linesBox.Height()+(2*DefaultXAxisMargin), yAxisWidth)
} }
} }
return Box{ return Box{
@ -552,7 +552,7 @@ func (sbc StackedBarChart) styleDefaultsTitle() Style {
} }
func (sbc StackedBarChart) getScaledFontSize() float64 { func (sbc StackedBarChart) getScaledFontSize() float64 {
effectiveDimension := util.Math.MinInt(sbc.GetWidth(), sbc.GetHeight()) effectiveDimension := MinInt(sbc.GetWidth(), sbc.GetHeight())
if effectiveDimension >= 2048 { if effectiveDimension >= 2048 {
return 48.0 return 48.0
} else if effectiveDimension >= 1024 { } else if effectiveDimension >= 1024 {