mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
adding destroy, get and set methods back to vis
This commit is contained in:
parent
789707da22
commit
ee4e44df96
4 changed files with 22 additions and 28 deletions
|
@ -159,7 +159,7 @@
|
|||
margin: 5px 10px;
|
||||
}
|
||||
.sidebar-item:hover:hover button.discover-field-toggle {
|
||||
display: inherit;
|
||||
display: block;
|
||||
}
|
||||
.discover-field-details-close {
|
||||
text-align: center;
|
||||
|
@ -229,6 +229,9 @@ disc-field-chooser ul.discover-selected-fields {
|
|||
disc-field-chooser ul.discover-selected-fields li:first-child:nth-last-child(1)[field=_source] button.discover-field-toggle {
|
||||
display: none;
|
||||
}
|
||||
disc-field-chooser .sidebar-item-title {
|
||||
position: relative;
|
||||
}
|
||||
.results h3 {
|
||||
margin: -20px 0 10px 0;
|
||||
text-align: center;
|
||||
|
|
|
@ -102,10 +102,6 @@ define(function (require) {
|
|||
|
||||
return function (selection) {
|
||||
selection.each(function (data) {
|
||||
if (self._attr.destroFlag) {
|
||||
throw new Error('You are trying to render a chart you have destroyed');
|
||||
}
|
||||
|
||||
if (!yScale) {
|
||||
throw new Error('yScale is ' + yScale);
|
||||
}
|
||||
|
|
|
@ -47,21 +47,6 @@ define(function (require) {
|
|||
.text('The container is too small for this chart.');
|
||||
};
|
||||
|
||||
|
||||
Chart.prototype.destroy = function () {
|
||||
this._attr.destroyFlag = true;
|
||||
|
||||
// Removing chart and all elements associated with it
|
||||
d3.select(this.chartEl).selectAll('*').remove();
|
||||
|
||||
// Cleaning up event listeners
|
||||
this.off('click');
|
||||
this.off('hover');
|
||||
this.off('brush');
|
||||
d3.select(window)
|
||||
.on('resize', null);
|
||||
};
|
||||
|
||||
Chart.prototype.set = function (name, val) {
|
||||
this._attr[name] = val;
|
||||
this.render();
|
||||
|
|
|
@ -37,6 +37,10 @@ define(function (require) {
|
|||
throw new Error('No valid data!');
|
||||
}
|
||||
|
||||
if (this._attr.destroyFlag) {
|
||||
throw new Error('You tried rendering a visualization that has been destroyed');
|
||||
}
|
||||
|
||||
// DATA CLASS
|
||||
this.instantiateData(data);
|
||||
|
||||
|
@ -88,7 +92,6 @@ define(function (require) {
|
|||
this.renderCharts(vis, charts);
|
||||
|
||||
this.checkSize();
|
||||
|
||||
};
|
||||
|
||||
Vis.prototype.resize = function () {
|
||||
|
@ -109,20 +112,27 @@ define(function (require) {
|
|||
setTimeout(this.checkSize(), 300);
|
||||
}, 300);
|
||||
|
||||
// Vis.prototype.off = function () {
|
||||
// return this.charts.off.apply(this.charts, arguments);
|
||||
// };
|
||||
|
||||
Vis.prototype.destroy = function () {
|
||||
return this.ChartClass.prototype.destroy.apply(this, arguments);
|
||||
this._attr.destroyFlag = true;
|
||||
|
||||
// Removing chart and all elements associated with it
|
||||
d3.select(this.el).selectAll('*').remove();
|
||||
|
||||
// Cleaning up event listeners
|
||||
this.off('click');
|
||||
this.off('hover');
|
||||
this.off('brush');
|
||||
d3.select(window)
|
||||
.on('resize', null);
|
||||
};
|
||||
|
||||
Vis.prototype.set = function (name, val) {
|
||||
return this.chart.set(name, val);
|
||||
this._attr[name] = val;
|
||||
this.render();
|
||||
};
|
||||
|
||||
Vis.prototype.get = function (name) {
|
||||
return this.chart.get(name);
|
||||
return this._attr[name];
|
||||
};
|
||||
|
||||
return Vis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue