Closed Inao0 closed 1 year ago
Hi, I have added class RSHeatmap
in package Roassal3-DSM
There are 3 new examples about this:
| builder |
builder := RSHeatmap new.
builder objectsX: #('A' 'B' 'C').
builder objectsY: #('tomato' 'pumpkin').
builder dataMatrix: #(#(1 2 5) #(3 4 6)).
^ builder
Example with months
And with vegetables
builder colorPalette: (NSScale linear range: {Color gray. Color purple muchDarker}).
dataMatrix:
because that method computes the domain for the given matrix.
builder dataMatrix: values.
builder colorPalette: (NSScale linear range: {Color gray. Color purple muchDarker}).
color:aBlockOrColor
. By default is using the colorPalette
builder color: [:matrixValue | Color random ].
builder shouldShowCellLabels: false.
@Inao0 can we close this issue?
Yes, perfect, thanks :)
An example of heatmap :
What is already existing :
In Roassal there is the
RSDSM
(Dependency structural matrix) which is the closest thing to a heatmap. There is also, in a package not loaded,RSHeatmap
which is outdated and inherits directly fromObject
(Still works though). For now, the RSDSM name is quite cryptic and for someone looking for a heatmap, this is going to be hard to find.Differences in APIs :
Expected APIs are different. This is the second example for RSDSM:
Here we can see here that DSM takes objects, either one list for both axis or two different lists, and a dependency bloc that given an object will return which objects it depends on (either one object or a list of objects). Cells that are at the intersection of rows and columns will be colored. The colors can be altered by giving a block able to compute the color of a cell from a the tuple of the row object and column object.
In a heatmap, the expected API would be something like this:
The objects on the axis could be only labels if it's simpler. We do not need the objects to compute dependencies, the color of a scale is a number inside the matrix and the position is already determined. Maybe the heatmap could take a block to calculate the value matrix, in this case, labels would not be enough, and objects would be required.
Default values
Some more examples of heatmaps : https://chartio.com/learn/charts/heatmap-complete-guide/