class HeatMapSeattleBodyModel extends AreaModel {
override getRowCount(): number {
return times.length;
}
override getRowHeight(_rowIndex: number): number {
return defaultRowHeights;
}
override getValueAt(rowIndex: number, columnIndex: number): any {
if (columnIndex === 0) return times[rowIndex];
return "";
}
override getTooltipAt(rowIndex: number, columnIndex: number): any {
if (columnIndex === 0) {
return "";
}
columnIndex--;
const date = days[columnIndex];
const time = times[rowIndex];
if (map[date] && map[date][time]) {
return `${date} ${time} → ${map[date][time].temperature}`;
}
return "";
}
override getCustomStyleAt(rowIndex: number, columnIndex: number): { [p: string]: string } | undefined {
if (columnIndex === 0) {
return undefined;
}
columnIndex--;
const date = days[columnIndex];
const time = times[rowIndex];
if (!map[date] || !map[date][time]) return undefined;
const n = map[date][time].temperature;
// const red = new ColorRgb(255, 0, 0);
// const blue = new ColorRgb(0, 0, 255);
// const p = new TwoColorGradientArg(MIN, red, MAX, blue);
// -> "background": GeCssColorUtil.getTwoColorGradientRGB(n, p),
const minColor = new ColorRgb(67, 1, 84);
const middleColor = new ColorRgb(31, 144, 141);
const maxColor = new ColorRgb(250, 230, 37);
const MIDDLE = (MAX + MIN) / 2;
const p = new ThreeColorGradientArg(MIN, minColor, MIDDLE, middleColor, MAX, maxColor);
return {
"background": GeCssColorUtil.getThreeColorGradientRGB(n, p),
"color": "transparent" // we only want to show the bg color
};
}
}