mWater / mwater-visualization

GNU Lesser General Public License v3.0
3 stars 5 forks source link

background color by data in table widget #471

Closed broncha closed 1 year ago

broncha commented 2 years ago

@grassick I implemented this for each column, adding a separate backgroundColorAxis which includes the expression from textAxis and only xform and colormap from the backgroundColorAxis is used. Added showExpr to AxisComponent as expression would be duplicated for the column!

@Autio here is how the implementation looks.

Screen Shot 2022-10-28 at 15 51 55 Screen Shot 2022-10-28 at 15 51 59 Screen Shot 2022-10-28 at 15 52 03
grassick commented 2 years ago

There is some complexity around aggregate columns that isn't being taken care of. If I:

I get: image

Also, it seems to default the backgroundColorAxis to the textAxis, but then doesn't keep them in sync thereafter. But there's no way to edit the expression of the backgroundColorAxis!

Maybe the two axes should be independent? @Autio ? That is, you can color by something that isn't the same expression as the textAxis. This would get rid of the need for showExpr

Also, note that the textAxis is really just using the expression inside the axis, not the entire axis, for weird historical reasons.

The aggrNeed: "required" in backgroundColorAxis is going to cause you trouble, as it doesn't always need to be aggregate. But if it is, the table compiler should take it into account and add groupings to all other fields.

broncha commented 1 year ago

@grassick I removed showExpr in AxisComponent, fixed the grouping in background color axis query. What do you suggest for aggrNeed? I have removed that also for now. And color axis is no longer dependant on the textAxis

grassick commented 1 year ago

This is great @broncha ! I added aggrNeed: "optional" and it works perfectly. Merging it in!