Skip to content

Commit

Permalink
Fix rendering crash when only drawing some assurance icons
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Feb 27, 2025
1 parent 6e9302c commit 9d86279
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 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.4.22",
"version":"1.4.4.23",
"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
23 changes: 13 additions & 10 deletions src/D3 Plotting Functions/drawSummaryTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,19 @@ function drawTableCells(selection: divBaseType, cols: { name: string; label: str
const parentNode = d3.select(currNode.property("parentNode"));
const rowData = parentNode.datum() as plotData;
if (showGrouped && draw_icons && (d.column === "variation" || d.column === "assurance")) {
const scaling = inputSettings.nhs_icons[`${d.column}_icons_scaling`];
currNode
.append("svg")
.attr("width", `${thisSelDims.width * 0.5 * scaling}px`)
.attr("viewBox", "0 0 378 378")
.classed("rowsvg", true)
.call(initialiseIconSVG, d.value)
.selectAll(".icongroup")
.selectAll(`.${d.value}`)
.call(nhsIcons[d.value]);
// Only attempt to draw icon if one is specified
if (d.value !== "none") {
const scaling = inputSettings.nhs_icons[`${d.column}_icons_scaling`];
currNode
.append("svg")
.attr("width", `${thisSelDims.width * 0.5 * scaling}px`)
.attr("viewBox", "0 0 378 378")
.classed("rowsvg", true)
.call(initialiseIconSVG, d.value)
.selectAll(".icongroup")
.selectAll(`.${d.value}`)
.call(nhsIcons[d.value]);
}
} else {
const value: string = typeof d.value === "number"
? d.value.toFixed(inputSettings.spc.sig_figs)
Expand Down

0 comments on commit 9d86279

Please sign in to comment.