Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Merge pull request #281 from kruzhambus/billboard-animations

Andrii Romasiun286e8ca3afed
diff --cc src/pages/Project/View/ViewProject.helpers.tsx
index 4bf46b975,00f2db170..8ead0fe8b
--- a/src/pages/Project/View/ViewProject.helpers.tsx
+++ b/src/pages/Project/View/ViewProject.helpers.tsx
@@@ -786,72 -700,32 +793,79 @@@ const getSettingsPerf =
},
},
},
+ transition: {
+ duration: 500,
+ },
+ resize: {
+ auto: true,
+ timer: false,
+ },
tooltip: {
- format: {
- title: (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),
- },
- contents: {
- template: `
- <ul class='bg-gray-100 dark:text-gray-50 dark:bg-slate-800 rounded-md shadow-md px-3 py-1'>
- <li class='font-semibold'>{=TITLE}</li>
- <hr class='border-gray-200 dark:border-gray-600' />
- {{
- <li class='flex justify-between'>
- <div class='flex justify-items-start'>
- <div class='w-3 h-3 rounded-sm mt-1.5 mr-2' style=background-color:{=COLOR}></div>
- <span>{=NAME}</span>
- </div>
- <span class='pl-4'>{=VALUE}</span>
- </li>
- }}
- </ul>`,
+ contents: (item: any, _: any, __: any, color: any) => {
+ if (_isEmpty(compareChart)) {
+ return `<ul class='bg-gray-100 dark:text-gray-50 dark:bg-slate-800 rounded-md shadow-md px-3 py-1'>
+ <li class='font-semibold'>${timeFormat === TimeFormat['24-hour'] ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(item[0].x) : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(item[0].x)}</li>
+ <hr class='border-gray-200 dark:border-gray-600' />
+ ${_map(item, (el: {
+ id: string,
+ index: number,
+ name: string,
+ value: string,
+ x: Date,
+ }) => {
+ return `
+ <li class='flex justify-between'>
+ <div class='flex justify-items-start'>
+ <div class='w-3 h-3 rounded-sm mt-1.5 mr-2' style=background-color:${color(el.id)}></div>
+ <span>${el.name}</span>
+ </div>
+ <span class='pl-4'>${getStringFromTime(getTimeFromSeconds(el.value), true)}</span>
+ </li>
+ `
+ }).join('')}`
+ }
+
+ return `
+ <ul class='bg-gray-100 dark:text-gray-50 dark:bg-slate-800 rounded-md shadow-md px-3 py-1'>
+ ${_map(item, (el: {
+ id: string,
+ index: number,
+ name: string,
+ value: string,
+ x: Date,
+ }) => {
+ const {
+ id, index, name, value, x,
+ } = el
+
+ const xDataValueCompare = timeFormat === TimeFormat['24-hour'] ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(dayjs(compareChart?.x[index]).toDate()) : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(dayjs(compareChart?.x[index]).toDate())
+ const xDataValue = timeFormat === TimeFormat['24-hour'] ? d3.timeFormat(tbsFormatMapperTooltip24h[timeBucket])(x) : d3.timeFormat(tbsFormatMapperTooltip[timeBucket])(x)
+ const valueCompare = getValueForTooltipPerfomance(compareChart, id, index)
+
+ if (_includes(perfomanceChartCompare, id)) {
+ return ''
+ }
+
+ return `
+ <div class='flex justify-between'>
+ <div class='flex justify-items-start'>
+ <div class='w-3 h-3 rounded-sm mt-1.5 mr-2' style=background-color:${color(id)}></div>
+ <span>${name}</span>
+ </div>
+ </div>
+ <hr class='border-gray-200 dark:border-gray-600' />
+ <li class='mt-1 ml-2'>
+ <p>
+ <span>${xDataValue}</span> - <span>${getStringFromTime(getTimeFromSeconds(value), true)}</span>
+ </p>
+ ${valueCompare ? `<p>
+ <span>${xDataValueCompare}</span> -
+ <span>${getStringFromTime(getTimeFromSeconds(valueCompare), true)}</span>
+ </p>` : ''}
+ </li>
+ `
+ }).join('')}
+ </ul>`
},
},
point: {