tests are pretty helpful
This commit is contained in:
parent
9c96af2a22
commit
bf38f3e718
4 changed files with 5 additions and 4 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||
sbc := chart.StackedBarChart{
|
||||
Height: 512,
|
||||
XAxis: chart.Style{
|
||||
Show: true,
|
||||
},
|
||||
|
@ -48,8 +49,8 @@ func drawChart(res http.ResponseWriter, req *http.Request) {
|
|||
},
|
||||
}
|
||||
|
||||
res.Header().Set("Content-Type", "image/svg+xml")
|
||||
err := sbc.Render(chart.SVG, res)
|
||||
res.Header().Set("Content-Type", "image/png")
|
||||
err := sbc.Render(chart.PNG, res)
|
||||
if err != nil {
|
||||
fmt.Printf("Error rendering chart: %v\n", err)
|
||||
}
|
||||
|
|
BIN
images/stacked_bar.png
Normal file
BIN
images/stacked_bar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -9,6 +9,6 @@ import (
|
|||
func TestGenerateTicksWithStep(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
ticks := GenerateContinuousTicksWithStep(&ContinuousRange{Min: 1.0, Max: 10.0, Domain: 100}, 1.0, FloatValueFormatter)
|
||||
ticks := GenerateContinuousTicksWithStep(&ContinuousRange{Min: 1.0, Max: 10.0, Domain: 100}, 1.0, FloatValueFormatter, false)
|
||||
assert.Len(ticks, 10)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ func TestYAxisGetTicks(t *testing.T) {
|
|||
}
|
||||
vf := FloatValueFormatter
|
||||
ticks := ya.GetTicks(r, yr, styleDefaults, vf)
|
||||
assert.Len(ticks, 35)
|
||||
assert.Len(ticks, 36)
|
||||
}
|
||||
|
||||
func TestYAxisGetTicksWithUserDefaults(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue