minor legend improvements
This commit is contained in:
parent
1b7f851174
commit
518b52c686
|
@ -144,6 +144,15 @@ func (l *Layout) HandleConsoleEvent(e string) {
|
||||||
}
|
}
|
||||||
case console.KeyUp:
|
case console.KeyUp:
|
||||||
switch l.mode {
|
switch l.mode {
|
||||||
|
case ModeDefault:
|
||||||
|
l.mode = ModeComponentSelect
|
||||||
|
l.selection = 0
|
||||||
|
l.menu.highlight(l.getComponent(l.selection))
|
||||||
|
case ModeComponentSelect:
|
||||||
|
if l.selection > 0 {
|
||||||
|
l.selection--
|
||||||
|
}
|
||||||
|
l.menu.highlight(l.getComponent(l.selection))
|
||||||
case ModeMenuOptionSelect:
|
case ModeMenuOptionSelect:
|
||||||
l.menu.up()
|
l.menu.up()
|
||||||
case ModeComponentMove:
|
case ModeComponentMove:
|
||||||
|
@ -153,6 +162,15 @@ func (l *Layout) HandleConsoleEvent(e string) {
|
||||||
}
|
}
|
||||||
case console.KeyDown:
|
case console.KeyDown:
|
||||||
switch l.mode {
|
switch l.mode {
|
||||||
|
case ModeDefault:
|
||||||
|
l.mode = ModeComponentSelect
|
||||||
|
l.selection = 0
|
||||||
|
l.menu.highlight(l.getComponent(l.selection))
|
||||||
|
case ModeComponentSelect:
|
||||||
|
if l.selection < len(l.components)-1 {
|
||||||
|
l.selection++
|
||||||
|
}
|
||||||
|
l.menu.highlight(l.getComponent(l.selection))
|
||||||
case ModeMenuOptionSelect:
|
case ModeMenuOptionSelect:
|
||||||
l.menu.down()
|
l.menu.down()
|
||||||
case ModeComponentMove:
|
case ModeComponentMove:
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (c *RunChart) renderLegend(buffer *ui.Buffer, rectangle image.Rectangle) {
|
||||||
height = heightOnDetails
|
height = heightOnDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
rowCount := (c.Dx() - yAxisLegendIndent) / (height + yAxisLegendIndent)
|
rowCount := (c.Dy() - 2*yAxisLegendIndent) / (height + yAxisLegendIndent)
|
||||||
columnCount := int(math.Ceil(float64(len(c.lines)) / float64(rowCount)))
|
columnCount := int(math.Ceil(float64(len(c.lines)) / float64(rowCount)))
|
||||||
columnWidth := getColumnWidth(c.mode, c.lines, c.precision)
|
columnWidth := getColumnWidth(c.mode, c.lines, c.precision)
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ func (c *RunChart) renderLegend(buffer *ui.Buffer, rectangle image.Rectangle) {
|
||||||
|
|
||||||
details := [4]string{
|
details := [4]string{
|
||||||
fmt.Sprintf("cur %s", formatValue(getCurrentValue(line), c.precision)),
|
fmt.Sprintf("cur %s", formatValue(getCurrentValue(line), c.precision)),
|
||||||
|
fmt.Sprintf("dlt %s", formatValue(getDiffWithPreviousValue(line), c.precision)),
|
||||||
fmt.Sprintf("max %s", formatValue(line.extrema.max, c.precision)),
|
fmt.Sprintf("max %s", formatValue(line.extrema.max, c.precision)),
|
||||||
fmt.Sprintf("min %s", formatValue(line.extrema.min, c.precision)),
|
fmt.Sprintf("min %s", formatValue(line.extrema.min, c.precision)),
|
||||||
fmt.Sprintf("dif %s", formatValue(getDiffWithPreviousValue(line), c.precision)),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, detail := range details {
|
for i, detail := range details {
|
||||||
|
|
Loading…
Reference in New Issue