[GH-ISSUE #31] Support for charts #22

Closed
opened 2026-03-04 01:01:12 +03:00 by kerem · 2 comments
Owner

Originally created by @vladimirvivien on GitHub (Jan 14, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/31

Great work!
Was waiting for a project like this (almost went with nodejs blessed since termui seems unmaintained). Any plans for chart components (see nodejs blessed contrib or even termui charts) ?

Originally created by @vladimirvivien on GitHub (Jan 14, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/31 Great work! Was waiting for a project like this (almost went with [nodejs blessed](https://github.com/chjj/blessed) since termui seems unmaintained). Any plans for chart components (see nodejs [blessed contrib](https://github.com/yaronn/blessed-contrib) or even termui charts) ?
kerem closed this issue 2026-03-04 01:01:12 +03:00
Author
Owner

@rivo commented on GitHub (Jan 14, 2018):

Thanks, glad you like it. Actually, this was discussed before, see #11.

<!-- gh-comment-id:357518392 --> @rivo commented on GitHub (Jan 14, 2018): Thanks, glad you like it. Actually, this was discussed before, see #11.
Author
Owner

@derivaro commented on GitHub (Mar 1, 2019):

// Try this
// :-)
// Rivo,
// thanks for ur job, it s just amazing
// --------------------------------------------------
package main

import (
"fmt"
"math"
"strings"

tm "github.com/buger/goterm"

"github.com/rivo/tview"

)

func main() {
app := tview.NewApplication()

tt := tview.NewTextView()

term(tt)
if err := app.SetRoot(tt, true).Run(); err != nil {
	panic(err)
}

}

func term(tt *tview.TextView) {
chart := tm.NewLineChart(100, 20)

data := new(tm.DataTable)
data.AddColumn("Time")
data.AddColumn("Sin(x)")

for i := 0.1; i < 10; i += 0.1 {
	data.AddRow(i, math.Sin(i))
}
fmt.Fprintln(tt, rp(chart.Draw(data)))

}

func rp(st string) string {
st = strings.Replace(st, "[31m", "", -1)
st = strings.Replace(st, "[0m", "", -1)
return st
}

<!-- gh-comment-id:468725654 --> @derivaro commented on GitHub (Mar 1, 2019): // Try this // :-) // Rivo, // thanks for ur job, it s just amazing // -------------------------------------------------- package main import ( "fmt" "math" "strings" tm "github.com/buger/goterm" "github.com/rivo/tview" ) func main() { app := tview.NewApplication() tt := tview.NewTextView() term(tt) if err := app.SetRoot(tt, true).Run(); err != nil { panic(err) } } func term(tt *tview.TextView) { chart := tm.NewLineChart(100, 20) data := new(tm.DataTable) data.AddColumn("Time") data.AddColumn("Sin(x)") for i := 0.1; i < 10; i += 0.1 { data.AddRow(i, math.Sin(i)) } fmt.Fprintln(tt, rp(chart.Draw(data))) } func rp(st string) string { st = strings.Replace(st, "[31m", "", -1) st = strings.Replace(st, "[0m", "", -1) return st }
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#22
No description provided.