summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-09-11 16:48:56 +0100
committerNick White <git@njw.name>2019-09-11 16:48:56 +0100
commiteee54245e560bce314647bbe441da94d19bf8278 (patch)
treed316e782422e0642e0ef9d4304e6ffbd17660ecd
parent7d627f29e76225c99e5ab062a59cfddfbe8fa43c (diff)
Fix bug with graph that prevented the ticks from being correct, thus ruining the graph
-rw-r--r--bookpipeline/graph.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/bookpipeline/graph.go b/bookpipeline/graph.go
index e17bdd0..e347ba4 100644
--- a/bookpipeline/graph.go
+++ b/bookpipeline/graph.go
@@ -37,7 +37,6 @@ func createLine(xvalues []float64, y float64, c drawing.Color) chart.ContinuousS
Style: chart.Style{
Show: true,
StrokeColor: c,
- StrokeDashArray: []float64{10.0, 5.0},
},
}
}
@@ -67,19 +66,20 @@ func Graph(confs map[string]*Conf, bookname string, w io.Writer) error {
var xvalues, yvalues []float64
var annotations []chart.Value2
var ticks []chart.Tick
- i := 0
tickevery := len(graphconf) / maxticks
- for _, c := range graphconf {
- i = i + 1
+ for i, c := range graphconf {
xvalues = append(xvalues, c.Pgnum)
yvalues = append(yvalues, c.Conf)
if c.Conf < goodCutoff {
annotations = append(annotations, chart.Value2{Label: fmt.Sprintf("%.0f", c.Pgnum), XValue: c.Pgnum, YValue: c.Conf})
}
- if tickevery%i == 0 {
+ if i%tickevery == 0 {
ticks = append(ticks, chart.Tick{c.Pgnum, fmt.Sprintf("%.0f", c.Pgnum)})
}
}
+ // make last tick the final page
+ final := graphconf[len(graphconf)-1]
+ ticks[len(ticks)-1] = chart.Tick{final.Pgnum, fmt.Sprintf("%.0f", final.Pgnum)}
mainSeries := chart.ContinuousSeries{
XValues: xvalues,
YValues: yvalues,