Merge pull request #96 from leighmcculloch/typo-fix
Correct typo in internal variables.
This commit is contained in:
commit
202925a536
18
linechart.go
18
linechart.go
@ -60,8 +60,8 @@ type LineChart struct {
|
|||||||
drawingY int
|
drawingY int
|
||||||
axisYHeight int
|
axisYHeight int
|
||||||
axisXWidth int
|
axisXWidth int
|
||||||
axisYLebelGap int
|
axisYLabelGap int
|
||||||
axisXLebelGap int
|
axisXLabelGap int
|
||||||
topValue float64
|
topValue float64
|
||||||
bottomValue float64
|
bottomValue float64
|
||||||
labelX [][]rune
|
labelX [][]rune
|
||||||
@ -78,8 +78,8 @@ func NewLineChart() *LineChart {
|
|||||||
lc.LineColor = ThemeAttr("linechart.line.fg")
|
lc.LineColor = ThemeAttr("linechart.line.fg")
|
||||||
lc.Mode = "braille"
|
lc.Mode = "braille"
|
||||||
lc.DotStyle = '•'
|
lc.DotStyle = '•'
|
||||||
lc.axisXLebelGap = 2
|
lc.axisXLabelGap = 2
|
||||||
lc.axisYLebelGap = 1
|
lc.axisYLabelGap = 1
|
||||||
lc.bottomValue = math.Inf(1)
|
lc.bottomValue = math.Inf(1)
|
||||||
lc.topValue = math.Inf(-1)
|
lc.topValue = math.Inf(-1)
|
||||||
return lc
|
return lc
|
||||||
@ -162,7 +162,7 @@ func (lc *LineChart) calcLabelX() {
|
|||||||
if l+w <= lc.axisXWidth {
|
if l+w <= lc.axisXWidth {
|
||||||
lc.labelX = append(lc.labelX, s)
|
lc.labelX = append(lc.labelX, s)
|
||||||
}
|
}
|
||||||
l += w + lc.axisXLebelGap
|
l += w + lc.axisXLabelGap
|
||||||
} else { // braille
|
} else { // braille
|
||||||
if 2*l >= len(lc.DataLabels) {
|
if 2*l >= len(lc.DataLabels) {
|
||||||
break
|
break
|
||||||
@ -173,7 +173,7 @@ func (lc *LineChart) calcLabelX() {
|
|||||||
if l+w <= lc.axisXWidth {
|
if l+w <= lc.axisXWidth {
|
||||||
lc.labelX = append(lc.labelX, s)
|
lc.labelX = append(lc.labelX, s)
|
||||||
}
|
}
|
||||||
l += w + lc.axisXLebelGap
|
l += w + lc.axisXLabelGap
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ func (lc *LineChart) calcLabelY() {
|
|||||||
span := lc.topValue - lc.bottomValue
|
span := lc.topValue - lc.bottomValue
|
||||||
lc.scale = span / float64(lc.axisYHeight)
|
lc.scale = span / float64(lc.axisYHeight)
|
||||||
|
|
||||||
n := (1 + lc.axisYHeight) / (lc.axisYLebelGap + 1)
|
n := (1 + lc.axisYHeight) / (lc.axisYLabelGap + 1)
|
||||||
lc.labelY = make([][]rune, n)
|
lc.labelY = make([][]rune, n)
|
||||||
maxLen := 0
|
maxLen := 0
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
@ -293,7 +293,7 @@ func (lc *LineChart) plotAxes() Buffer {
|
|||||||
y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 1
|
y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 1
|
||||||
buf.Set(x, y, c)
|
buf.Set(x, y, c)
|
||||||
}
|
}
|
||||||
oft += len(rs) + lc.axisXLebelGap
|
oft += len(rs) + lc.axisXLabelGap
|
||||||
}
|
}
|
||||||
|
|
||||||
// y labels
|
// y labels
|
||||||
@ -301,7 +301,7 @@ func (lc *LineChart) plotAxes() Buffer {
|
|||||||
for j, r := range rs {
|
for j, r := range rs {
|
||||||
buf.Set(
|
buf.Set(
|
||||||
lc.innerArea.Min.X+j,
|
lc.innerArea.Min.X+j,
|
||||||
origY-i*(lc.axisYLebelGap+1),
|
origY-i*(lc.axisYLabelGap+1),
|
||||||
Cell{Ch: r, Fg: lc.AxesColor, Bg: lc.Bg})
|
Cell{Ch: r, Fg: lc.AxesColor, Bg: lc.Bg})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user