@flourish/info-popup
Advanced tools
Comparing version 4.0.4 to 4.1.0
{ | ||
"name": "@flourish/info-popup", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"description": "Popup with data insertion", | ||
@@ -5,0 +5,0 @@ "main": "info-popup.js", |
@@ -60,5 +60,5 @@ # Flourish Info Popup | ||
d3.selectAll(...) // datapoints | ||
.on("mouseover", function(data) { | ||
.on("mouseover", function() { | ||
const el = this; | ||
popup.mouseover(el, data); | ||
popup.mouseover(el, el.__data__); | ||
}) | ||
@@ -68,4 +68,5 @@ .on("mouseout", function() { | ||
}) | ||
.on("click", function(data) { | ||
.on("click", function() { | ||
const el = this; | ||
const data = el.__data__ | ||
const locked_id = data.id | ||
@@ -122,2 +123,4 @@ popup.click(el, data, locked_id); // See step 8 for more information on locked_id | ||
If there are columns you'd like to be available for custom content, but don't want to show in the default popup or panel content (eg. long series data), you can exclude them using `.hideColumnNames()`. This takes an array of binding names. In the above example, calling `.hideColumnNames(["binding_four"])` will not show the Party information in the default popup or panel. | ||
### 7 - Updating the popup with `.update()` | ||
@@ -208,2 +211,6 @@ | ||
### Misc methods | ||
- `popup.onPanelClose(fn)` will fire when the panel gets closed | ||
## Templates to reference | ||
@@ -210,0 +217,0 @@ |
@@ -0,1 +1,4 @@ | ||
# 4.1.0 | ||
* Add `.hideColumnNames()` | ||
# 4.0.4 | ||
@@ -2,0 +5,0 @@ * Make `popupDirections()` a getter |
@@ -30,2 +30,3 @@ function getDefaultHTML(instance, d, mode) { | ||
for (var binding in instance._column_names) { | ||
if (instance._column_names_hidden.indexOf(binding) > -1) continue; | ||
if (binding == instance._title_key) continue; | ||
@@ -32,0 +33,0 @@ if (binding == instance._subtitle_key) continue; |
@@ -21,2 +21,4 @@ import Popup from "@flourish/popup"; | ||
this._popup_directions = ["top", "bottom", "left", "right"]; | ||
this._column_names = [], | ||
this._column_names_hidden = [], | ||
this._getLockedPosition = function() { return null; }; | ||
@@ -189,2 +191,8 @@ | ||
InfoPopup.prototype.hideColumnNames = function (column_names) { | ||
this._column_names_hidden = column_names; | ||
return this; | ||
}; | ||
InfoPopup.prototype._showDefaultPanelContent = function () { | ||
@@ -191,0 +199,0 @@ var instance = this; |
Sorry, the diff of this file is too big to display
216678
4914
220