Fork me on GitHub
#reveal
<
2020-11-23
>
Ed19:11:07

Hey. Is it possible to apply some styling to a table cell (for example) based on the results of calling a function. Like highlighting all the negative numbers in red? Or something similar?

vlaaad20:11:32

Hi! You mean in any kind of table, or in table-view provided by reveal?

Ed14:11:33

I mean in a table view in reveal ... Maybe allowing me to enter a function to call on each row or cell to apply a style? ... Is it something I could do by implementing a custom view? ... I was thinking about it in terms of analysing a large data set, so you could get a quick visual idea of rows some categories in the data ...

vlaaad20:11:16

In default table view it's not possible, but it's possible to do, although it will require copying most of the reveal's table view source and modifying it.

vlaaad20:11:57

the place that will require change is vlaaad.reveal.view/describe-cell

vlaaad20:11:00

I tried this to highlight all keywords:

(defn- describe-cell [x]
  {:content-display :graphic-only
   :style-class "reveal-table-cell"
   :style {:-fx-background-color (if (keyword? x) :red :transparent)}
   :graphic {:fx/type summary :value x}})
scary, yet indicative 😄

Ed18:11:12

😉 ... many thanks ... I'll have a look and see if I can create something ... I think ideally i'd like to be able to input the function from the ui rather than hardcode keyword? or whatever ...

Ed18:11:53

kind of like using grasp, but for the data visualisation 😉

vlaaad21:11:58

hmm, I like this idea... I'll keep it in mind

Ed15:11:47

I was also thinking of trying to implement a graph view of data ... For things like state machines or nodes in a graph ... It'd be really useful to be able to highlight nodes in a graph that match other criteria ... Like people who bought this product also bought these products... And highlight the products over $100 .... Or whatever

Ed15:11:21

Maybe multiple colours for different criteria?

Ed15:11:10

I found this https://github.com/brunomnsilva/JavaFXSmartGraph ... But have not tried to go any further, and probably won't have time to for a few weeks at least

Ed16:11:15

But I'm pretty impressed with reveal ... Many thanks for releasing it into the world