Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart "Lines used" cannot exceed 10 #48

Open
andykais opened this issue Oct 20, 2023 · 4 comments
Open

Chart "Lines used" cannot exceed 10 #48

andykais opened this issue Oct 20, 2023 · 4 comments

Comments

@andykais
Copy link

andykais commented Oct 20, 2023

this is best outlined with this output from this bash script (which is taken from the readme)

~ history | awk '{print $2}' | chart -debug
Lines read	10021                                                 
Line format inferred	sf
Lines used	10
Float column count	1
String column count	1
Date/Time column count	0
Chart type	pie
Scale type	linear
Separator	[tab]

there are far more commands used in my history than 10, but it seems like the display never exceeds 10. It just ends up lumping thousands of commands into a column "Other". This is true for various other graphs I attempt as well (at least simple string frequency graphs that I know how to use)

This appears to be by design, is there a way to tell chart to just graph "everything"?

@marianogappa
Copy link
Owner

@andykais I reproduced your issue. chart is actually seeing all your lines as shown in the first line of output. The lines used row is a little misleading. What it actually said in this case is that there are 10 output categories in the pie chart. This is because it's collapsing all categories after the first 9 into an "Other" discrete category.

@marianogappa
Copy link
Owner

If you look at the README short video you can see an example of the same behaviour:
https://github.com/marianogappa/chart

@andykais
Copy link
Author

hey @marianogappa, Im aware that it condensed down the last x categories into "Other". I probably should have framed this issue better, but my question is if there is a way to display all categories rather than condensing them down. Is this some sort of memory safety thing?

@marianogappa
Copy link
Owner

It is hardcoded unfortunately: https://github.com/marianogappa/chart/blob/master/freq.go#L37

It's really not a memory thing. A pie chart with more than 10 items doesn't really tell a very useful story. Typically any pie chart in a presentation or article will either have less categories or some aggregation.

You may argue that this should be up for the client and not the tool to decide.

My rationale was to provide a sensible default behaviour. It does make sense to provide an override, but I didn't want to make the tool too complicated. Please refer to my rationale for that in the Contributing section: https://github.com/marianogappa/chart/blob/master/freq.go#L37 I do think it's a fair enough override, but first I'd like to see how useful it really is to have a pie chart where you can barely see the slices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants