Skip to content

the last bar is always one number wide #101

@naknak-

Description

@naknak-

Data 0 1 19 20 should print ▁▁██ but prints ▁▁▇█

The problem is the number 7 in your character index calculation. A working formula for the index is int( 8 * (n-min)/(max-min) ) with n==max special-cased to give 7.

See also https://rosettacode.org/wiki/Talk:Sparkline_in_unicode#Most_of_these_are_buggy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions