Skip to content

Commit

Permalink
[FE-17686] Human-readable missing hit test cols error string (#665)
Browse files Browse the repository at this point in the history
* Replace heavydb error string with human-readable error display

* Formatting, make constant uppercase

* Prettier fixes

* Fix conditional

* Empty space

---------

Co-authored-by: Chris Matzenbach <[email protected]>
  • Loading branch information
cmatzenbach and Chris Matzenbach authored Apr 9, 2024
1 parent be60779 commit 2a86cff
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/charts/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ export default function heatMap(parent, chartGroup) {
rows = _rowScale.domain(rows)
cols = _colScale.domain(cols)
_chart.dockedAxesSize(_chart.getAxisSizes(cols.domain(), rows.domain()))
let rowCount = rows.domain().length,
const rowCount = rows.domain().length,
colCount = cols.domain().length,
availWidth = _chart.width() - _dockedAxesSize.left,
availHeight = _chart.height() - _dockedAxesSize.bottom,
Expand Down
2 changes: 1 addition & 1 deletion src/charts/row-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export default function rowChart(parent, chartGroup) {
/* --------------------------------------------------------------------------*/

function translateX(d) {
let x = _x(_chart.cappedValueAccessor(d)),
const x = _x(_chart.cappedValueAccessor(d)),
x0 = rootValue(),
s = x > x0 ? x0 : x
return "translate(" + s + ",0)"
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/cap-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function capMixin(_chart) {
let _othersLabel = "Others"

let _othersGrouper = function(topRows) {
let topRowsSum = d3.sum(topRows, _chart.valueAccessor()),
const topRowsSum = d3.sum(topRows, _chart.valueAccessor()),
allRows = _chart.group().all(),
allRowsSum = d3.sum(allRows, _chart.valueAccessor()),
topKeys = topRows.map(_chart.keyAccessor()),
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ export default function coordinateGridMixin (_chart) {
if (_y === undefined) {
_y = d3.scale.linear()
}
let min = _chart.yAxisMin() || 0,
const min = _chart.yAxisMin() || 0,
max = _chart.yAxisMax() || 0
_y.domain([min, max]).rangeRound([_chart.yAxisHeight(), 0])
}
Expand Down Expand Up @@ -1363,7 +1363,7 @@ export default function coordinateGridMixin (_chart) {

// borrowed from Crossfilter example
_chart.resizeHandlePath = function (d) {
let e = Number(d === "e"),
const e = Number(d === "e"),
x = e ? 1 : -1,
y = brushHeight() / 3
return (
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/coordinate-grid-raster-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default function coordinateGridRasterMixin (_chart, _mapboxgl, browser) {
}

_chart.unproject = function (pt) {
let xscale = _chart.x(),
const xscale = _chart.x(),
yscale = _chart.y()
const x = (xscale ? xscale.invert(pt.x) : 0)
const y = (yscale ? yscale.invert(pt.y) : 0)
Expand Down Expand Up @@ -1404,7 +1404,7 @@ axis in dc.js is simply an instance of a [d3 axis

// borrowed from Crossfilter example
_chart.resizeHandlePath = function (d) {
let e = Number(d === "e"),
const e = Number(d === "e"),
x = e ? 1 : -1,
y = brushHeight() / 3
return "M" + (0.5 * x) + "," + y + "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) + "V" + (2 * y - 6) + "A6,6 0 0 " + e + " " + (0.5 * x) + "," + (2 * y) + "Z" + "M" + (2.5 * x) + "," + (y + 8) + "V" + (2 * y - 8) + "M" + (4.5 * x) + "," + (y + 8) + "V" + (2 * y - 8)
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/d3.box.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import d3 from "d3"
function box(g) {
g.each(function(d, i) {
d = d.map(value).sort(d3.ascending)
let g = d3.select(this),
const g = d3.select(this),
n = d.length,
min = d[0],
max = d[n - 1]
Expand All @@ -26,7 +26,7 @@ import d3 from "d3"
const quartileData = (d.quartiles = quartiles(d))

// Compute whiskers. Must return exactly 2 elements, or null.
let whiskerIndices = whiskers && whiskers.call(this, d, i),
const whiskerIndices = whiskers && whiskers.call(this, d, i),
whiskerData = whiskerIndices && whiskerIndices.map(i => d[i])

// Compute outliers. If no whiskers are specified, all data are 'outliers'.
Expand Down
8 changes: 7 additions & 1 deletion src/mixins/raster-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const validLayerTypes = [
]

const { getImageSize, replaceAsync, parseUrlParts } = utils
const MISSING_HIT_TEST_COLUMN_ERROR =
"$HEAVYAI_ERROR_COLUMN_NOT_FOUND_IN_HIT_TEST_CACHE$"

export default function rasterLayer(layerType) {
const _layerType = layerType
Expand Down Expand Up @@ -355,7 +357,11 @@ export default function rasterLayer(layerType) {
const columnSet = new Set(popupColumns)
for (const key in data) {
if (columnSet.has(key)) {
newData[key] = data[key]
// check for missing hit test cache columns and substitute readable message
newData[key] =
data[key] === MISSING_HIT_TEST_COLUMN_ERROR
? "Column Not Found"
: data[key]
data[key] instanceof Date ? moment(data[key]).utc() : data[key]

if (typeof chart.useLonLat === "function" && chart.useLonLat()) {
Expand Down

0 comments on commit 2a86cff

Please sign in to comment.