Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ module.exports = require("datasaur-local").extend("PerspectiveDataModel", {

try {
await Promise.all(promises);
resolve(false);
const rects = getSubrects.call(this.grid.renderer);
resolve(!!rects.find(uncachedRow, this));
} catch (e) {
resolve(true);
} finally {
Expand Down Expand Up @@ -152,7 +153,7 @@ module.exports = require("datasaur-local").extend("PerspectiveDataModel", {
function uncachedRow(rect) {
let start_row = this.data[rect.origin.y];
let end_row = this.data[Math.min(rect.corner.y, this.getRowCount() - 1)];
return !(start_row && start_row[rect.origin.x] !== undefined && end_row && end_row[rect.corner.x] !== undefined);
return !(start_row && start_row[rect.origin.x] !== undefined && end_row && end_row[rect.corner.x - 1] !== undefined);
}

function cellStyle(gridCellConfig) {
Expand Down
7 changes: 4 additions & 3 deletions packages/perspective/src/js/perspective.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,18 @@ export default function(Module) {
formatter.addRow(data, row);
}
} else if (this.sides() === 1) {
// TODO slice.column_names should return the column names in the slice, respecting start_col and end_col
const col_names = extract_vector(slice.get_column_names());
for (let ridx = start_row; ridx < end_row; ridx++) {
const row = formatter.initRowValue();
for (let cidx = start_col; cidx < end_col; cidx++) {
const col_name = col_names[cidx];
if (cidx === 0) {
if (cidx === start_col) {
const row_path = slice.get_row_path(ridx);
formatter.initColumnValue(data, row, col_name);
formatter.initColumnValue(data, row, "__ROW_PATH__");
for (let i = 0; i < row_path.size(); i++) {
const value = __MODULE__.scalar_vec_to_val(row_path, i);
formatter.addColumnValue(data, row, col_name, value);
formatter.addColumnValue(data, row, "__ROW_PATH__", value);
}
row_path.delete();
} else {
Expand Down
11 changes: 11 additions & 0 deletions packages/perspective/test/js/to_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ module.exports = perspective => {
}
});

it("one-sided views with start_col > 0 should have row paths", async function() {
let table = perspective.table(int_float_string_data);
let view = table.view({
row_pivot: ["int"]
});
let json = await view.to_json({start_col: 1});
for (let d of json) {
expect(d.__ROW_PATH__).toBeDefined();
}
});

it("one-sided column-only views should not have row paths", async function() {
let table = perspective.table(int_float_string_data);
let view = table.view({
Expand Down