gizak / termui

Golang terminal dashboard
MIT License
13.23k stars 786 forks source link

Add option to show data labels of Plot #214

Open cjbassi opened 5 years ago

cjbassi commented 5 years ago

Basically copy over gotop's linechart labels.

keithknott26 commented 5 years ago

Are you planning to include the superior braille and line colors that gotop uses? Would love to see that get merged in.

cjbassi commented 5 years ago

What do you mean by superior? :D You can use the same colors gotop uses, just have to set the right colors in your termui program.

keithknott26 commented 5 years ago

The lines can be different colors depending on their height? I'll have to try that out thank you

cjbassi commented 5 years ago

Yah, can change the color values in your plot widget by checking if incoming data meets a certain threshold and modifying the corresponding entry in the LineColors field.

keithknott26 commented 5 years ago

Thank you I was able to get the LineColors threshold bit working, although I noticed if you instantiate multiple plots when you control the LineColors of one plot, it applies the same line color to all of the plots. Each plot only has one line so perhaps it has something to do with it. I was able to control the LineColors when there were more than one line (but only one plot instance).

Also, I'm really looking forward to the data label addition. Currently the labels only appear as numbers despite datalabels [] being set.

cjbassi commented 5 years ago

Thank you I was able to get the LineColors threshold bit working, although I noticed if you instantiate multiple plots when you control the LineColors of one plot, it applies the same line color to all of the plots. Each plot only has one line so perhaps it has something to do with it. I was able to control the LineColors when there were more than one line (but only one plot instance).

Huh that sounds strange. What should be happening is that you can set the default Plot LineColors in the Theme, but otherwise the plots should be independent. If that's not the case then feel free to create a bug report, and an example of the bug would be good too.

Also, I'm really looking forward to the data label addition. Currently the labels only appear as numbers despite datalabels [] being set.

So it looks like the DataLabels field of the Plot doesn't actually do anything atm, but I'll try to get the datalabels going soon!