Visidata: Add the ability to place sparklines in the cells of a column.

Created on 14 Jun 2019  路  9Comments  路  Source: saulpw/visidata

Visidata allows you to graph results in a separate canvas, but it would be useful if it could condense the values of several columns to single column with a sparkline. The sparkline would combine the values of the other columns.

I have some data with multiple columns containing 0 or 1 (N or Y). With the headers and the line separators it can be hard to get a feel for where different rows match on particular column or are different. It seems like this could provide a visual map into the other columns.

(There is a new plugin suggestion in my future...)

help wanted wishlist

Most helpful comment

I have to say, the reason this issue made me click on it was because i read it as "Add the ability to place sparklinesS" ...i'm half asleep.. :P

All 9 comments

This is an awesome idea, @frosencrantz. If you can write def sparkline(values) which takes a list of numeric values and returns a unicode braille sparkline, then we can make a nice VisiData plugin to bring it all together. I'm thinking a command addcol-sparkline on the columns sheet that would add a sparkline column from the selected columns (maybe override &). Or on the source sheet, from the visible numeric columns. It would be a fun little feature.

I won't be able to provide any code. I'd be willing to provide feedback. I have data that this feature would be useful for.

Hi @frosencrantz! We currently have quite a few things we are working on, and have to prioritise features where we get collaborative help over ones where we do not.

This is a really cool feature though, and if anyone is willing to provide the sparkline function code, we can jump right on it.

Some possibly helper material: https://shapr.github.io/posts/2019-06-16-tmux-sparklines.html

Hi @frosencrantz, I have a first implementation for a sparkline column in 8be3612 if you would like to review.

If you'd also like to test it out and don't want to run the custom branch, I can also provide as a vd plugin.

Hi @layertwo I tried the latest version as a plugin, but it was not working for me. There are three issues:

  1. There was a missing addGlobals() call to export the SparklineColumn,
  2. There is a missing self. before sparkline on line 9.
  3. An issue I haven't tracked down, type issues on line 14, at least one value in values is a SparklineColumn, when it should be a number.

Hi @anjakefala, I understand that without coding support feature requests will not have priority. I might only provide feedback such as bugs reports, feature requests, calls to add tests, etc. Please prioritize as needed. I'll repeat myself, I'm a big fan of this tool. My feedback is always meant to be helpful and respectful. I understand you might not be able to act on that feedback, but I believe it is useful to start those conversations.

I have to say, the reason this issue made me click on it was because i read it as "Add the ability to place sparklinesS" ...i'm half asleep.. :P

Hi @frosencrantz, I've made some updated changes now. For using in vd, I import as import sparklines as well as from sparklines import SparklineColumn

Let me know if you have any other questions or concerns.

Hi @layertwo where do you put those import lines? In your $HOME/.visidatarc?

Based on https://github.com/saulpw/visidata/issues/286#issuecomment-500272731 you should import plugins.mypluginname if you do that, SparklineColumn is not available, causing addcol-sparkline to throw an exception.

Livesearch annotates the function with @Sheet.api, which makes the function available. Doing that works for me. The plugin documentation does not provide enough guidance to say which is correct.

Hi @frosencrantz, if you would like to make a PR to update the plugin documentation that would be really helpful.

I am not sure if there is a difference in correctness (@saulpw?).

In any case, thanks for reminding me that the work on this issue has been merged in (https://github.com/saulpw/visidata/pull/305) and we can close it. =) Thanks @layertwo. :tada:

Was this page helpful?
0 / 5 - 0 ratings