Describe the bug
Braille Mode line charts don't draw the dots in the correct y-axis location. For example, I created a chart with data values between 1 and 2 stepping by .1 (1, 1.1, 1.2 ... 2.0). The PlotMarkerDot mode accurately displays the dots in the 1 - 2 range on the Y axis. However, when using PlotMarkerBraille mode, the dots appear between the range of 0 and 1. The gap is much larger if the the data values are bigger (for example, 100 to 101 stepping by .1)
To Reproduce
Steps to reproduce the behavior:
Run this code:
import (
"github.com/gdamore/tcell/v2"
"github.com/navidys/tvxwidgets"
"github.com/rivo/tview"
)
func getChart(title string, marker tvxwidgets.Marker, data []float64, color tcell.Color) tview.Primitive {
chart := tvxwidgets.NewPlot()
chart.SetBorder(true)
chart.SetTitle(title)
chart.SetLineColor([]tcell.Color{
tcell.ColorGreen,
})
chart.SetAxesColor(color)
chart.SetAxesLabelColor(color)
chart.SetMarker(marker)
chart.SetData([][]float64{data})
return chart
}
func main() {
app := tview.NewApplication()
sampleData := []float64{}
for i := 0; i <= 10; i++ {
sampleData = append(sampleData, 1+0.1*float64(i))
}
bmLineChart := getChart("line chart (braille mode)", tvxwidgets.PlotMarkerBraille, sampleData, tcell.ColorRed)
dmLineChart := getChart("line chart (dot mode)", tvxwidgets.PlotMarkerDot, sampleData, tcell.ColorGold)
layout := tview.NewFlex().SetDirection(tview.FlexColumn)
layout.AddItem(bmLineChart, 0, 1, false)
layout.AddItem(dmLineChart, 0, 1, false)
layout.SetRect(0, 0, 100, 30)
if err := app.SetRoot(layout, false).Run(); err != nil {
panic(err)
}
}
Expected behavior
I expect the Braille Mode to use the correct range for the values.
Screenshots
Notice, the "dot mode" correctly displays in the range of 1 to 2, while the "braille mode" displays in the range of 0 to 1.
Desktop (please complete the following information):
- OS Ubuntu 22.04.2
- tview version
- github.com/rivo/tview v0.0.0-20230621164836-6cc0565babaf
Additional context