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
17 changes: 17 additions & 0 deletions dist/js/funnel-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5907,11 +5907,28 @@ var destroySVG = exports.destroySVG = function destroySVG(_ref14) {
return function () {
var svg = getRootSvg(context.getId());
if (svg) {
// destroy tooltip
var tooltipElement = (0, _d3Selection.select)("#d3-funnel-js-tooltip");
if (tooltipElement) {
tooltipElement.remove();
}

// destroy all in specific path listeners
var paths = rootSvg.selectAll('path');
if (paths) {
paths.on('.all', null);
}

// Stop any ongoing transitions
svg.selectAll('*').interrupt();

// remove all other listeners
svg.selectAll('*').on('.all', null);

// Remove all SVG elements
svg.selectAll('*').remove();

// remove the svg itself
svg.remove();
}
};
Expand Down
2 changes: 1 addition & 1 deletion dist/js/funnel-graph.min.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions examples/example-details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<a href="example.html">Back</a>

<h1>
Drill Down Page
</h1>
<p>You click on area: <span id="indexParam"></span> </p>


<script>

function getQueryParams() {
const params = new URLSearchParams(window.location.search);
const index = params.get('index');
return { index };
}

const params = getQueryParams();
document.getElementById('indexParam').textContent = `Index: ${params.index}`;

</script>
1 change: 1 addition & 0 deletions examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
callbacks: {
click: (event, metadata) => {
console.log("click handler", metadata);
window.location.href = `example-details.html?index=${metadata.index}`;
},
// adding a tooltip handler instead of the ootb tooltip display
// tooltip: (event, metadata) => {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-funnel-graph",
"version": "1.0.9",
"version": "1.0.10",
"description": "SVG Funnel Graph Javascript Library",
"main": "dist/js/funnel-graph.min.js",
"style": "dist/funnel-graph.min.css",
Expand All @@ -26,7 +26,8 @@
"funnel-chart",
"funnel-graph",
"svg-funnel-chart",
"svg-funnel-graph"
"svg-funnel-graph",
"d3-funnel-graph"
],
"browserslist": [
"last 2 versions"
Expand Down
18 changes: 18 additions & 0 deletions src/js/d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,29 @@ const destroySVG = ({ context }) => () => {
const svg = getRootSvg(context.getId());

if (svg) {

// destroy tooltip
const tooltipElement = select("#d3-funnel-js-tooltip");
if (tooltipElement) {
tooltipElement.remove();
}

// destroy all in specific path listeners
const paths = rootSvg.selectAll('path');
if (paths) {
paths.on('.all', null);
}

// Stop any ongoing transitions
svg.selectAll('*').interrupt();

// remove all other listeners
svg.selectAll('*').on('.all', null);

// Remove all SVG elements
svg.selectAll('*').remove();

// remove the svg itself
svg.remove();
}
}
Expand Down