Skip to content

Commit

Permalink
Summary Table fixes (#314)
Browse files Browse the repository at this point in the history
* Fix resizes

* Better handling of icons with invalid settings

* Bump version for dev release

* Lints
  • Loading branch information
andrjohns authored Aug 7, 2024
1 parent 9d8698f commit de38282
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pbiviz.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"displayName":"SPC Charts",
"guid":"PBISPC",
"visualClassName":"Visual",
"version":"1.4.3.4",
"version":"1.4.4.0",
"description":"A PowerBI custom visual for SPC charts",
"supportUrl":"https://github.com/AUS-DOH-Safety-and-Quality/PowerBI-SPC",
"gitHubUrl":"https://github.com/AUS-DOH-Safety-and-Quality/PowerBI-SPC"
Expand Down
18 changes: 18 additions & 0 deletions src/Classes/settingsClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ export default class settingsClass {
})
})

if (this.settings.nhs_icons.show_variation_icons) {
const patterns: string[] = ["astronomical", "shift", "trend", "two_in_three"];
const anyOutlierPatterns: boolean = patterns.some(d => this.settings.outliers[d]);
if (!anyOutlierPatterns) {
this.validationStatus.status = 1;
this.validationStatus.error = "Variation icons require at least one outlier pattern to be selected";
}
}

if (this.settings.nhs_icons.show_assurance_icons) {
const altTargetPresent: boolean = !isNullOrUndefined(this.settings.lines.alt_target);
const improvementDirection: string = this.settings.outliers.improvement_direction;
if (!altTargetPresent || improvementDirection === "neutral") {
this.validationStatus.status = 1;
this.validationStatus.error = "Assurance icons require an alternative target and a non-neutral improvement direction";
}
}

this.derivedSettings.update(this.settings.spc)
this.derivedSettingsGrouped = new Array<derivedSettingsClass>();
if (is_grouped) {
Expand Down
18 changes: 9 additions & 9 deletions src/Classes/viewModelClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ export default class viewModelClass {
this.initialiseGroupedLines();
}
}
this.plotProperties.update(
options,
this.plotPoints,
this.controlLimits,
this.inputData,
this.inputSettings.settings,
this.inputSettings.derivedSettings,
this.colourPalette
)
}
this.plotProperties.update(
options,
this.plotPoints,
this.controlLimits,
this.inputData,
this.inputSettings.settings,
this.inputSettings.derivedSettings,
this.colourPalette
)
this.firstRun = false;
}

Expand Down
8 changes: 4 additions & 4 deletions src/D3 Plotting Functions/drawSummaryTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ export default function drawSummaryTable(selection: divBaseType, visualObj: Visu
}

const tableSelect = tableRows.selectAll('td')
.data((d) => cols.map(col => {
return {column: col.name, value: d.table_row[col.name]}
}))
.join('td');
.data((d) => cols.map(col => {
return { column: col.name, value: d.table_row[col.name] }
}))
.join('td');

const nhsIconSettings = visualObj.viewModel.inputSettings.settings.nhs_icons;
const draw_icons: boolean = nhsIconSettings.show_variation_icons || nhsIconSettings.show_assurance_icons;
Expand Down
2 changes: 1 addition & 1 deletion src/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const settingsPaneGroupings = {
summary_table: {
"General": ["show_table", "table_text_overflow", "table_opacity", "table_opacity_unselected", "table_outer_border_style", "table_outer_border_width", "table_outer_border_colour", "table_outer_border_top", "table_outer_border_bottom", "table_outer_border_left", "table_outer_border_right"],

"Header": ["table_header_font", "table_header_size", "table_header_text_align",, "table_header_font_weight", "table_header_text_transform", "table_header_text_padding", "table_header_colour", "table_header_bg_colour", "table_header_border_style", "table_header_border_width", "table_header_border_colour", "table_header_border_bottom", "table_header_border_inner"],
"Header": ["table_header_font", "table_header_size", "table_header_text_align", "table_header_font_weight", "table_header_text_transform", "table_header_text_padding", "table_header_colour", "table_header_bg_colour", "table_header_border_style", "table_header_border_width", "table_header_border_colour", "table_header_border_bottom", "table_header_border_inner"],

"Body": ["table_body_font", "table_body_size", "table_body_text_align", "table_body_font_weight", "table_body_text_transform", "table_body_text_padding", "table_body_colour", "table_body_bg_colour", "table_body_border_style", "table_body_border_width", "table_body_border_colour", "table_body_border_top_bottom", "table_body_border_left_right"]
}
Expand Down
7 changes: 4 additions & 3 deletions src/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ export class Visual implements powerbi.extensibility.IVisual {
return currentSelectionId.includes(dot.identity);
});
const currentPointHighlighted: boolean = dot.highlighted;
const newOpacity: number = (currentPointSelected || currentPointHighlighted) ? dot.aesthetics.opacity : dot.aesthetics.opacity_unselected;
d3.select(currentDotNode).style("fill-opacity", newOpacity);
d3.select(currentTableNode).style("opacity", newOpacity);
const newDotOpacity: number = (currentPointSelected || currentPointHighlighted) ? dot.aesthetics.opacity : dot.aesthetics.opacity_unselected;
const newTableOpacity: number = (currentPointSelected || currentPointHighlighted) ? dot.aesthetics["table_opacity"] : dot.aesthetics["table_opacity_unselected"];
d3.select(currentDotNode).style("fill-opacity", newDotOpacity);
d3.select(currentTableNode).style("opacity", newTableOpacity);
}
}
}
Expand Down

0 comments on commit de38282

Please sign in to comment.