[GH-ISSUE #117] Linechart: custom labels aren't placed under correct data value #77

Closed
opened 2026-03-03 16:22:09 +03:00 by kerem · 4 comments
Owner

Originally created by @keithknott26 on GitHub (Feb 12, 2019).
Original GitHub issue: https://github.com/mum4k/termdash/issues/117

Hello,

When no custom labels are used (default label map) the labels scale along with the data as its added to the chart. So for example if you add 1440 records the labels would read 0...1440 as you'd expect.

When a custom label map is used ( HH:MM timestamps for example), the labels don't correspond with the data. The graph simply displays as many labels as will fit on the screen and then stops. No replacements or substitutions are made as data is added.

I'd expect that the labels would be substituted so that you'd end up with 00:00 ... 23:59 assuming a label map was created.

Here is what happens when you insert 1440 records and a map of HH:MM (1440 count mapped to int):

image

Am I doing something wrong or is this a bug?

//Variables:
//inputLabels contains a list of labels from 00:00 thru 23:59
//inputs contains 1440 data points

labelMap := make(map[int]string)
		for i, s := range inputLabels {
			labelMap[i] = s
		}
if err := lc.Series("first", inputs,
			linechart.SeriesCellOpts(cell.FgColor(cell.ColorNumber(GraphLineTwo))),
			linechart.SeriesXLabels(labelMap),
		); err != nil {
			return err
		}
Originally created by @keithknott26 on GitHub (Feb 12, 2019). Original GitHub issue: https://github.com/mum4k/termdash/issues/117 Hello, When no custom labels are used (default label map) the labels scale along with the data as its added to the chart. So for example if you add 1440 records the labels would read 0...1440 as you'd expect. When a custom label map is used ( HH:MM timestamps for example), the labels don't correspond with the data. The graph simply displays as many labels as will fit on the screen and then stops. No replacements or substitutions are made as data is added. I'd expect that the labels would be substituted so that you'd end up with 00:00 ... 23:59 assuming a label map was created. Here is what happens when you insert 1440 records and a map of HH:MM (1440 count mapped to int): ![image](https://user-images.githubusercontent.com/16966683/52642328-a41bd800-2e8f-11e9-8f50-c5a9dcd22e51.png) Am I doing something wrong or is this a bug? ``` //Variables: //inputLabels contains a list of labels from 00:00 thru 23:59 //inputs contains 1440 data points labelMap := make(map[int]string) for i, s := range inputLabels { labelMap[i] = s } if err := lc.Series("first", inputs, linechart.SeriesCellOpts(cell.FgColor(cell.ColorNumber(GraphLineTwo))), linechart.SeriesXLabels(labelMap), ); err != nil { return err } ```
kerem 2026-03-03 16:22:10 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@mum4k commented on GitHub (Feb 13, 2019):

This is indeed a bug, thank you very much for reporting it.

<!-- gh-comment-id:463051086 --> @mum4k commented on GitHub (Feb 13, 2019): This is indeed a bug, thank you very much for reporting it.
Author
Owner

@mum4k commented on GitHub (Feb 13, 2019):

This was fixed in a hotfix release v0.6.1.

Please reopen if you are still seeing an issue when you build at that tag.

<!-- gh-comment-id:463054939 --> @mum4k commented on GitHub (Feb 13, 2019): This was fixed in a hotfix release [v0.6.1](https://github.com/mum4k/termdash/releases/tag/v0.6.1). Please reopen if you are still seeing an issue when you build at that tag.
Author
Owner

@keithknott26 commented on GitHub (Feb 13, 2019):

It's fixed! Thank you very much for taking care of this so quickly!

<!-- gh-comment-id:463059562 --> @keithknott26 commented on GitHub (Feb 13, 2019): It's fixed! Thank you very much for taking care of this so quickly!
Author
Owner

@mum4k commented on GitHub (Feb 13, 2019):

Thanks for confirming. Please don't hesitate to let me know if you see anything else that doesn't work.

<!-- gh-comment-id:463062898 --> @mum4k commented on GitHub (Feb 13, 2019): Thanks for confirming. Please don't hesitate to let me know if you see anything else that doesn't work.
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/termdash#77
No description provided.