Skip to content

Commit

Permalink
Ids are no longer required
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Mar 15, 2021
1 parent 1981c84 commit 2de4d0b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
5 changes: 1 addition & 4 deletions src/visualizations/heatmap/Heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ export default class Heatmap {
this.settings = this.fillOptions(options);

this.element = elementIdentifier;
if (!this.element.id) {
this.element.id = "U_HEATMAP_" + Math.floor(Math.random() * 2**16);
}

const preprocessor = new Preprocessor();
this.rows = preprocessor.preprocessFeatures(rowLabels);
Expand Down Expand Up @@ -952,7 +949,7 @@ export default class Heatmap {
private initTooltip() {
return d3.select("body")
.append("div")
.attr("id", this.element.id + "-tooltip")
.attr("id", Math.floor(Math.random() * 2**16) + "-tooltip")
.attr("class", "tip")
.style("position", "absolute")
.style("z-index", "10")
Expand Down
8 changes: 2 additions & 6 deletions src/visualizations/sunburst/Sunburst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ export default class Sunburst {
) {
this.settings = this.fillOptions(options);

if (!this.element.id) {
this.element.id = "U_SUNBURST_" + Math.floor(Math.random() * 2**16);
}

const preprocessor = new SunburstPreprocessor();
const processedData = preprocessor.preprocessData(data);

if (this.settings.enableTooltips) {
this.tooltip = TooltipUtilities.initTooltip(this.element.id);
this.tooltip = TooltipUtilities.initTooltip(Math.floor(Math.random() * 2**16).toString());
}

this.currentMaxLevel = this.settings.levels;
Expand Down Expand Up @@ -82,7 +78,7 @@ export default class Sunburst {
// @ts-ignore
this.breadCrumbs = d3.select(this.element)
.append("div")
.attr("id", this.element.id + "-breadcrumbs")
.attr("id", Math.floor(Math.random() * 2**16) + "-breadcrumbs")
.attr("class", "sunburst-breadcrumbs")
.append("ul");

Expand Down
6 changes: 1 addition & 5 deletions src/visualizations/treemap/Treemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ export default class Treemap {
) {
this.settings = this.fillOptions(options);

if (!this.element.id) {
this.element.id = "U_TREEMAP_" + Math.floor(Math.random() * 2**16);
}

if (this.settings.enableTooltips) {
this.tooltip = TooltipUtilities.initTooltip(this.element.id);
this.tooltip = TooltipUtilities.initTooltip(Math.floor(Math.random() * 2**16).toString());
}

this.initCss();
Expand Down
6 changes: 1 addition & 5 deletions src/visualizations/treeview/Treeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@ export default class Treeview {
) {
this.settings = this.fillOptions(options);

if (!this.element.id) {
this.element.id = "U_TREEVIEW_" + Math.floor(Math.random() * 2**16);
}

if (this.settings.enableTooltips) {
this.tooltip = TooltipUtilities.initTooltip(this.element.id);
this.tooltip = TooltipUtilities.initTooltip(Math.floor(Math.random() * 2**16).toString());
}

const dataProcessor = new TreeviewPreprocessor();
Expand Down

0 comments on commit 2de4d0b

Please sign in to comment.