sbc looking alright, need to debug bar gaps at the bottom
This commit is contained in:
parent
e44cdd5600
commit
1269397821
2 changed files with 7 additions and 3 deletions
|
@ -26,9 +26,9 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||||
{Value: 5, Label: "Blue"},
|
{Value: 5, Label: "Blue"},
|
||||||
{Value: 5, Label: "Green"},
|
{Value: 5, Label: "Green"},
|
||||||
{Value: 4, Label: "Gray"},
|
{Value: 4, Label: "Gray"},
|
||||||
{Value: 4, Label: "Orange"},
|
{Value: 3, Label: "Orange"},
|
||||||
{Value: 3, Label: "Test"},
|
{Value: 3, Label: "Test"},
|
||||||
{Value: 3, Label: "??"},
|
{Value: 2, Label: "??"},
|
||||||
{Value: 1, Label: "!!"},
|
{Value: 1, Label: "!!"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -197,13 +197,17 @@ func (sbc StackedBarChart) drawYAxis(r Renderer, canvasBox Box) {
|
||||||
|
|
||||||
ticks := Sequence.Float64(1.0, 0.0, 0.2)
|
ticks := Sequence.Float64(1.0, 0.0, 0.2)
|
||||||
for _, t := range ticks {
|
for _, t := range ticks {
|
||||||
|
axisStyle.GetStrokeOptions().WriteToRenderer(r)
|
||||||
ty := canvasBox.Bottom - int(t*float64(canvasBox.Height()))
|
ty := canvasBox.Bottom - int(t*float64(canvasBox.Height()))
|
||||||
r.MoveTo(canvasBox.Right, ty)
|
r.MoveTo(canvasBox.Right, ty)
|
||||||
r.LineTo(canvasBox.Right+DefaultHorizontalTickWidth, ty)
|
r.LineTo(canvasBox.Right+DefaultHorizontalTickWidth, ty)
|
||||||
r.Stroke()
|
r.Stroke()
|
||||||
|
|
||||||
|
axisStyle.GetTextOptions().WriteToRenderer(r)
|
||||||
text := fmt.Sprintf("%0.0f%%", t*100)
|
text := fmt.Sprintf("%0.0f%%", t*100)
|
||||||
Draw.Text(r, text, canvasBox.Right+DefaultYAxisMargin, ty, axisStyle)
|
|
||||||
|
tb := r.MeasureText(text)
|
||||||
|
Draw.Text(r, text, canvasBox.Right+DefaultYAxisMargin+5, ty+(tb.Height()>>1), axisStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue