Skip to content

Commit

Permalink
Merge pull request #922 from finos/fixes-4-3
Browse files Browse the repository at this point in the history
Event regression fix
  • Loading branch information
texodus authored Feb 12, 2020
2 parents 5d29483 + a6aadf7 commit ee8f29e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion cpp/perspective/src/cpp/view_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ t_view_config::fill_aggspecs(const t_schema& schema) {
t_aggtype agg_type;

// use the `any` agg for columns used as pivots/column_only views
if (is_pivot || m_row_pivots.size() == 0 || m_column_only) {
if (m_row_pivots.size() == 0 || m_column_only) {
agg_type = t_aggtype::AGGTYPE_ANY;
} else if (m_aggregates.count(column) > 0) {
auto col = m_aggregates.at(column);
Expand All @@ -211,6 +211,8 @@ t_view_config::fill_aggspecs(const t_schema& schema) {
} else {
agg_type = str_to_aggtype(col.at(0));
}
} else if (is_pivot) {
agg_type = t_aggtype::AGGTYPE_ANY;
} else {
t_dtype dtype = schema.get_dtype(column);
agg_type = _get_default_aggregate(dtype);
Expand Down
8 changes: 4 additions & 4 deletions packages/perspective-viewer-d3fc/src/js/axis/ordinalAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const component = settings => {
const axisGroups = domain => {
const groups = [];
domain.forEach(tick => {
const split = tick.split ? tick.split("|") : [tick];
const split = tick && tick.split ? tick.split("|") : [tick];
split.forEach((s, i) => {
while (groups.length <= i) groups.push([]);

Expand All @@ -145,16 +145,16 @@ export const component = settings => {

const getGroupTickLayout = group => {
const width = settings.size.width;
const maxLength = Math.max(...group.map(g => g.text.length));
const maxLength = Math.max(...group.map(g => (g.text ? g.text.length : 0)));

if (orient === "horizontal") {
// x-axis may rotate labels and expand the available height
if (group.length * 16 > width - 100) {
if (group && group.length * 16 > width - 100) {
return {
size: maxLength * 5 + 10,
rotation: 90
};
} else if (group.length * (maxLength * 6 + 10) > width - 100) {
} else if (group && group.length * (maxLength * 6 + 10) > width - 100) {
return {
size: maxLength * 3 + 20,
rotation: 45
Expand Down
11 changes: 9 additions & 2 deletions packages/perspective-workspace/src/js/workspace/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ export class PerspectiveWorkspace extends DiscreteSplitPanel {
}
const table = this.tables.get(viewer.getAttribute("table") || config.table);
const widget = new PerspectiveViewerWidget({name, table, node, viewer});
const event = new CustomEvent("workspace-new-view", {
detail: {config, widget}
});
this.element.dispatchEvent(event);
widget.title.closable = true;
this.element.appendChild(widget.viewer);
this._addWidgetEventListeners(widget);
Expand Down Expand Up @@ -650,9 +654,12 @@ export class PerspectiveWorkspace extends DiscreteSplitPanel {
return [...this.masterPanel.widgets, ...toArray(this.dockpanel.widgets())];
}

/*********************************************************************
* Workspace updated event
/***************************************************************************
*
* `workspace-layout-update` event
*
*/

_fireUpdateEvent() {
const layout = this.save();
if (layout) {
Expand Down

0 comments on commit ee8f29e

Please sign in to comment.