Graph hides all fee rates below clicked value
This commit is contained in:
parent
2e8bd7f32e
commit
2c5cf94982
@ -449,30 +449,27 @@ Chartist.plugins.legend = function (options: any) {
|
|||||||
const legendIndex = parseInt(li.getAttribute('data-legend'));
|
const legendIndex = parseInt(li.getAttribute('data-legend'));
|
||||||
const legend = legends[legendIndex];
|
const legend = legends[legendIndex];
|
||||||
|
|
||||||
if (!legend.active) {
|
const activateLegend = (_legendIndex: number): void => {
|
||||||
legend.active = true;
|
legends[_legendIndex].active = true;
|
||||||
li.classList.remove('inactive');
|
legendElement.childNodes[_legendIndex].classList.remove('inactive');
|
||||||
|
|
||||||
var indexOfInactiveLegend = cacheInactiveLegends.indexOf(legendIndex, 0)
|
const indexOfInactiveLegend = cacheInactiveLegends.indexOf(_legendIndex, 0);
|
||||||
if (indexOfInactiveLegend > -1) {
|
if (indexOfInactiveLegend > -1) {
|
||||||
cacheInactiveLegends.splice(indexOfInactiveLegend, 1);
|
cacheInactiveLegends.splice(indexOfInactiveLegend, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
const deactivateLegend = (_legendIndex: number): void => {
|
||||||
legend.active = false;
|
legends[_legendIndex].active = false;
|
||||||
li.classList.add('inactive');
|
legendElement.childNodes[_legendIndex].classList.add('inactive');
|
||||||
cacheInactiveLegends.push(legendIndex);
|
cacheInactiveLegends.push(_legendIndex);
|
||||||
|
}
|
||||||
|
|
||||||
const activeCount = legends.filter(function(legend: any) { return legend.active; }).length;
|
for (let i = legends.length - 1; i >= 0; i--) {
|
||||||
if (!options.removeAll && activeCount == 0) {
|
if (i >= legendIndex) {
|
||||||
// If we can't disable all series at the same time, let's
|
if (!legend.active) activateLegend(i);
|
||||||
// reenable all of them:
|
} else {
|
||||||
for (let i = 0; i < legends.length; i++) {
|
if (legend.active) deactivateLegend(i);
|
||||||
legends[i].active = true;
|
|
||||||
legendElement.childNodes[i].classList.remove('inactive');
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheInactiveLegends = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user