Merge pull request #373 from junderw/betterGraph

Graph hides all fee rates below clicked value
This commit is contained in:
wiz 2021-03-04 19:34:30 +09:00 committed by GitHub
commit 8fa672e312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -449,30 +449,27 @@ Chartist.plugins.legend = function (options: any) {
const legendIndex = parseInt(li.getAttribute('data-legend'));
const legend = legends[legendIndex];
if (!legend.active) {
legend.active = true;
li.classList.remove('inactive');
const activateLegend = (_legendIndex: number): void => {
legends[_legendIndex].active = true;
legendElement.childNodes[_legendIndex].classList.remove('inactive');
var indexOfInactiveLegend = cacheInactiveLegends.indexOf(legendIndex, 0)
const indexOfInactiveLegend = cacheInactiveLegends.indexOf(_legendIndex, 0);
if (indexOfInactiveLegend > -1) {
cacheInactiveLegends.splice(indexOfInactiveLegend, 1);
}
}
} else {
legend.active = false;
li.classList.add('inactive');
cacheInactiveLegends.push(legendIndex);
const deactivateLegend = (_legendIndex: number): void => {
legends[_legendIndex].active = false;
legendElement.childNodes[_legendIndex].classList.add('inactive');
cacheInactiveLegends.push(_legendIndex);
}
const activeCount = legends.filter(function(legend: any) { return legend.active; }).length;
if (!options.removeAll && activeCount == 0) {
// If we can't disable all series at the same time, let's
// reenable all of them:
for (let i = 0; i < legends.length; i++) {
legends[i].active = true;
legendElement.childNodes[i].classList.remove('inactive');
}
cacheInactiveLegends = [];
for (let i = legends.length - 1; i >= 0; i--) {
if (i >= legendIndex) {
if (!legend.active) activateLegend(i);
} else {
if (legend.active) deactivateLegend(i);
}
}