Merge pull request #81 from uber-archive/mjr-multi-series

add support for multiple data series in linechart
This commit is contained in:
Caleb Bassi 2018-08-16 17:31:03 -07:00
commit e4bc917824
2 changed files with 181 additions and 126 deletions

View File

@ -19,7 +19,7 @@ import (
"strings" "strings"
"github.com/gizak/termui" "github.com/gizak/termui"
"github.com/gizak/termui/extra" "github.com/gizak/termui/_extra"
) )
const statFilePath = "/proc/stat" const statFilePath = "/proc/stat"

View File

@ -7,6 +7,7 @@ package termui
import ( import (
"fmt" "fmt"
"math" "math"
"sort"
) )
// only 16 possible combinations, why bother // only 16 possible combinations, why bother
@ -35,12 +36,13 @@ var braillePatterns = map[[2]int]rune{
var lSingleBraille = [4]rune{'\u2840', '⠄', '⠂', '⠁'} var lSingleBraille = [4]rune{'\u2840', '⠄', '⠂', '⠁'}
var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'} var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'}
// LineChart has two modes: braille(default) and dot. Using braille gives 2x capacity as dot mode, // LineChart has two modes: braille(default) and dot.
// because one braille char can represent two data points. // A single braille character is a 2x4 grid of dots, so Using braille
// gives 2x X resolution and 4x Y resolution over dot mode.
/* /*
lc := termui.NewLineChart() lc := termui.NewLineChart()
lc.BorderLabel = "braille-mode Line Chart" lc.Border.Label = "braille-mode Line Chart"
lc.Data = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0] lc.Data["name'] = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0]
lc.Width = 50 lc.Width = 50
lc.Height = 12 lc.Height = 12
lc.AxesColor = termui.ColorWhite lc.AxesColor = termui.ColorWhite