Merge 3ec31560e9f3851ef6469b4244b643664f872bc7 into master

This commit is contained in:
Arjun Choudhary 2022-11-22 11:00:51 +05:30
commit aefc788932
2 changed files with 14 additions and 2 deletions

View File

@ -98,7 +98,6 @@
text-align: left;
padding: 0px;
pointer-events: none;
.title {
display: block;
padding: 16px;
@ -114,6 +113,12 @@
margin: 0;
white-space: nowrap;
list-style: none;
&.tooltip-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 5px;
}
}
li {

View File

@ -42,6 +42,7 @@ export default class SvgTip {
this.hideTip();
this.title = this.container.querySelector('.title');
this.list = this.container.querySelector('.data-point-list');
this.dataPointList = this.container.querySelector('.data-point-list');
this.parent.addEventListener('mouseleave', () => {
@ -59,13 +60,19 @@ export default class SvgTip {
} else {
title = `${this.titleName}<strong>${this.titleValue}</strong>`;
}
if (this.listValues.length > 4) {
this.list.classList.add('tooltip-grid');
} else {
this.list.classList.remove('tooltip-grid');
}
this.title.innerHTML = title;
this.dataPointList.innerHTML = '';
this.listValues.map((set, i) => {
const color = this.colors[i] || 'black';
let value = set.formatted === 0 || set.formatted ? set.formatted : set.value;
let li = $.create('li', {
innerHTML: `<div class="tooltip-legend" style="background: ${color};"></div>
<div>