Closed jeffrey4l closed 5 years ago
Here is the testing code
package main import ( "math" ui "github.com/gizak/termui" ) func main() { err := ui.Init() if err != nil { panic(err) } defer ui.Close() lc0 := ui.NewLineChart() lc0.BorderLabel = "Line Chart" lc0.Data["default"] = (func() []float64 { n := 10 ps := make([]float64, n) for i := 0; i < n; i++ { ps[i] = 1 + math.Sin(float64(i)/5) } return ps })() lc0.Mode = "dot" lc0.Width = 50 lc0.Height = 12 lc0.X = 0 lc0.Y = 0 lc0.AxesColor = ui.ColorWhite lc0.LineColor["first"] = ui.ColorGreen ui.Render(lc0) uiEvents := ui.PollEvents() for { e := <-uiEvents switch e.ID { case "q", "<C-c>": return } } }
And i got following graph
the labels on x axis do not match the points. if i increase the points from n:=10 to n := 50 , it works as expected.
n:=10
n := 50
The question is: could we fix the graph when there is no much points? or did u use it in wrong?
thanks.
Hi, this should be fixed in 958a28575d7411492d25e42da3ad5a6e5947d9a4 on master. Do note that a lot of breaking changes have been introduced in that commit.
Here is the testing code
And i got following graph![065](https://user-images.githubusercontent.com/354768/50165771-911dd900-0320-11e9-9ec3-2803376da27e.jpg)
the labels on x axis do not match the points. if i increase the points from![066](https://user-images.githubusercontent.com/354768/50165895-d93cfb80-0320-11e9-911a-937ed5601492.jpg)
n:=10
ton := 50
, it works as expected.The question is: could we fix the graph when there is no much points? or did u use it in wrong?
thanks.