marianogappa / chart Goto Github PK
View Code? Open in Web Editor NEWQuick & smart charting for STDIN
Home Page: https://marianogappa.github.io/chart/
License: MIT License
Quick & smart charting for STDIN
Home Page: https://marianogappa.github.io/chart/
License: MIT License
If I render a line chart with or without the -zero-based argument, the y-axis is always anchored at zero. Is the default y-axis supposed to be based on the minimum value?
There's a very common case for input that looks like this:
1
5
10
11
12
...
It's not clear what chart
should do in this case. The two most likely charts that one wants in this case (in my opinion) are:
At the moment, however, chart
just returns: FATA[0000] couldn't find values to plot
.
Given that we don't support histograms, 2) should be supported instead.
as my main use case would be in a terminal, i'd prefer not to open a browser but get the gist of it right where i'm working with the data. horizontal bar chart would be best i guess?
Pie charts exceed viewport after updating Chart.js to 2.6.
We've looked into it briefly with no success. Since pie charts have very disimilar aspect ratio constraints compared to all other charts, unless anyone has a better idea I will simply conditionally just use half the viewport when it's a pie chart to solve this.
Let's say the data is separated by commas. This input:
1,2,3
1,,3
1,2,3
Should be interpreted as 3 rows and 3 columns with all floats, the second row having a zero for its second column.
This is not what happens at the moment. Instead, the second row is ignored as it's interpreted as having only 2 columns. This doesn't make sense except in the case where the separator is a space, where many subsequent spaces are trimmed to one as a preprocessing step.
This preprocessing should only be applied when the separator is a space.
I'm attempting to use chart
to graph large number of outbound requests. My data structure my log tool outputs looks like so:
{"timestamp":"2017-08-07T23:59:21.434927285Z"}
{"timestamp":"2017-08-07T23:59:21.4703704Z"}
{"timestamp":"2017-08-07T23:59:21.797074466Z"}
{"timestamp":"2017-08-07T23:59:21.891435198Z"}
{"timestamp":"2017-08-07T23:59:21.993443695Z"}
Using chart, I was expecting like the following to produce a line graph that groups the entries and increases the Y axis. I'm obviously doing something wrong as instead I get a flat line.
The command I had come up with to handle the format my logs output is the following:
cat test.json | jq -r .timestamp | awk '{print $0 "\t" "1"}' | chart line log --date-format 2006-01-02T15:04:05.999999999Z
Is grouping on the y axis something that chart supports? Or is it something that should be done before hand? If anyone would like to play with something like this themselves, I've uploaded a ~200000 lines of logs in the above format. http://www38.zippyshare.com/v/xAMPdzeg/file.html
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"?
The code adds linear scale to categorical line charts on the x axis. This confuses Chart.js into thinking it's a scatter line chart. Moreover there are no cheat stheet examples for categorical line charts!
This needs to be resolved ASAP.
2016-08-29 0.0125
2016-09-06 0.0272
2016-09-07 0.0000
2016-09-08 0.0000
2016-09-15 0.0000
2016-09-16 0.0281
2016-09-19 0.0000
2016-09-22 3.6831
2016-09-28 8.1081
2016-10-06 8.1375
2016-10-14 14.0035
2016-10-20 0.5704
2016-10-25 15.0896
2016-10-26 1.1138
2016-10-28 8.4493
2016-11-01 3.6618
2016-11-03 0.1425
2016-11-16 100.0000
2016-11-17 2.2675
2016-11-22 5.2985
2016-11-23 0.0000
2016-11-24 0.0061
At the moment, line charts don't show legends, which can make the chart hard to read when there are multiple series. It'd be great if there is an optional command line option for a comma separated headers for each field, and when it's specified, the headers are used for rendering legends for lines.
With e.g.
a 2017-03-12 20:21:53
a 2017-03-12 20:21:56
a 2017-03-12 20:21:57
a 2017-03-12 20:21:58
a 2017-03-12 20:22:01
a 2017-03-12 20:35:15
a 2017-03-12 20:40:04
a 2017-03-12 20:40:05
a 2017-03-12 20:45:15
cat /tmp/a | chart line --date-format "2006-01-02 03:04:05"
FATA[0000] Could not construct chart because [Couldn't find values to plot.]
Debug reveals the format was recognised but the lines weren't used, but it doesn't clarify why
$ cat /tmp/a | chart line --date-format "2006-01-02 03:04:05" -debug
Lines read 1065
Line format inferred sd
Lines used 0
Float column count 0
String column count 0
Date/Time column count 0
Date format 2006-01-02 03:04:05
Chart type line
Scale type linear
Separator [tab]
Charting doesn't work even if a float is used instead if a string
141763146 2017-03-12 20:40:05
141763147 2017-03-12 20:40:05
141763148 2017-03-12 20:40:05
141763149 2017-03-12 20:40:05
141763150 2017-03-12 20:40:05
141763151 2017-03-12 20:40:05
141763152 2017-03-12 20:40:05
141763153 2017-03-12 20:40:05
141763156 2017-03-12 20:45:15
Lines read 1065
Line format inferred fd
Lines used 0
Float column count 0
String column count 0
Date/Time column count 0
Date format 2006-01-02 03:04:05
Chart type pie
Scale type linear
Separator [tab]
There are some cases in which chart doesn't know what to do with the input. In those cases, it'd be better to explain briefly why the data cannot be plotted.
Bar and pie charts show data points on mouseover, but line charts do not seem to be. This is seen locally and on https://marianogappa.github.io/chart/
Tooltips are referenced at https://github.com/marianogappa/chart/blob/master/line.go#L107
Are line chart tooltips currently supported?
$ chart -help
# waits for stdin
^C
but,
$ echo | chart -help
-date-format string
Sets the date format, according to https://golang.org/src/time/format.go.
-debug
Use to make sure to double-check the chart is showing what you expect.
-h Show help.
-help
Show help.
...
I expect -help
to show help immediately without waiting for stdin
.
Bezier curves are not only slower to render but more importantly confusing in some cases, concretely when they violate the function definition, by appearing to have more than one value of y for a single value of x.
At the moment, this can't be plotted on a bar chart:
A 1 2
B 3 4
This is a great tool to be sure, and I think it would be much better if it supported histograms. Often, when you are just trying to get a sense for some data, histogram is the most useful initial visualization.
When running go install github.com/marianogappa/chart@latest
I am getting
go: github.com/marianogappa/chart imports
github.com/Sirupsen/logrus: github.com/Sirupsen/[email protected]: parsing go.mod:
module declares its path as: github.com/sirupsen/logrus
but was required as: github.com/Sirupsen/logrus
Cons
As the codebase grew, the structure became unwieldy for modifications.
A wealth of use cases would be enabled if charts could be made programatically instead of using the CLI tool proper, e.g. #16
Required changes are minimal:
I get the error in the title when passing the following input to the chart program
0 1
2 463008
In the following case, --debug
is ignored
chart line --date-format 2006-01-02 ' ' --debug
For example, I want to generate the bar chart for below csv
GaryZ@GaryZhus-MacBook-Pro-2 ~/Desktop $ cat test2.csv
,jack,jame
age,25,30
height,168,172
After running this command: cat test2.csv | chart bar ,
it generates below chart. Instead of showing jack
and jame
it shows category 0
and category 1
at the bottom.
Because we judge the values in a bar chart by the lengths of the bars, not by the positions of the ends of the bars, the axis scale must include zero. By chopping off the bottoms of the bars, we increase the resolution of the chart, but we distort the apparent values encoded by the bars.
Maybe introduce an command line option -o
or something like that, which is followed by a file path for writing the chart to. It can be super useful for generating a lot of charts using scripts.
Running a frequency pie chart off a 250k line file takes about 10 seconds on a fast laptop. This is a ballpark figure, but the use case is not that far-fetched. I'd expect it to be quite common to base charts off a million lines or so; at least for my use cases.
While not interested in adding complexity to chart
's source code, there are some quick wins that can improve the response time quite a bit:
I found your tool while trying to figure out gnuplot.
The README's releases link goes to a GitHub 404 error page.
https://github.com/marianogappa/chart/v4/releases
The releases that do exist are about 5 years old.
Where can I get the latest release?
For example, with the following data
foo 2017-06-23 1
foo 2017-06-24 2
foo 2017-06-25 3
foo 2017-06-26 4
foo 2017-06-27 5
foo 2017-06-28 6
bar 2017-06-23 9
bar 2017-06-24 8
bar 2017-06-25 7
bar 2017-06-26 6
bar 2017-06-27 5
bar 2017-06-28 4
chart line --date-format 2006-01-02
can generate a line chart with 2 series, foo
and bar
.
When there are a lot of lines/bars etc in a chart, the same color gets reused, which can make it hard to read.
The following dataset
2 4
1 3
4 4
3 3
Yields the following scatter line chart
While this behaviour is very flexible, I believe anyone wanting to plot a scatter line chart would expect the x values to be sorted, and this should be the default behaviour.
The aforementioned issue also happens when the x axis is composed of time-based data points.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.