gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

linechart: remember if data labels were automatically calculated #103

Closed martinlindhe closed 7 years ago

martinlindhe commented 7 years ago

The issue exists when calcLayout() is ran on the linechart and linechart.Data is non-empty. Initial labels will be created and if linechart.Data later grows, this will never be accounted for because of the checks here

func (lc *LineChart) calcLayout() {
    // set datalabels if it is not provided
    if lc.DataLabels == nil || len(lc.DataLabels) == 0 {