📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fix d3 js
Maksim Mruge2e31a5d3850
diff --git a/app/pages/Project/View/ViewProject.helpers.tsx b/app/pages/Project/View/ViewProject.helpers.tsxindex 0bb9313c1..947558234 100644--- a/app/pages/Project/View/ViewProject.helpers.tsx+++ b/app/pages/Project/View/ViewProject.helpers.tsx@@ -33,14 +33,8 @@ import countries from 'utils/isoCountries'import _toNumber from 'lodash/toNumber'import _toString from 'lodash/toString'import _includes from 'lodash/includes'--// const loadD3 = async () => {-// const d3 = await import('d3')--// return d3-// }--// const d3 = loadD3()+// @ts-ignore+import * as d3 from 'd3'const getAvg = (arr: any) => {const total = _reduce(arr, (acc, c) => acc + c, 0)@@ -556,7 +550,7 @@ const getSettings = (tick: {fit: true,rotate: rotateXAxias ? 45 : 0,- // format: timeFormat === TimeFormat['24-hour'] ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x) : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),+ format: timeFormat === TimeFormat['24-hour'] ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x) : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),},localtime: timeFormat === TimeFormat['24-hour'],type: 'timeseries',@@ -588,11 +582,7 @@ const getSettings = (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>+ <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,@@ -642,10 +632,8 @@ const getSettings = (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 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 = id === 'sessionDuration' ? getStringFromTime(getTimeFromSeconds(compareChart?.[typesOptionsToTypesCompare?.[id]]?.[index])) : compareChart?.[typesOptionsToTypesCompare[id]]?.[index]if (id === 'uniqueCompare' || id === 'totalCompare' || id === 'bounceCompare' || id === 'sessionDurationCompare') {@@ -802,7 +790,7 @@ const getSettingsPerf = (tick: {fit: true,rotate: rotateXAxias ? 45 : 0,- // format: timeFormat === TimeFormat['24-hour'] ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x) : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),+ format: timeFormat === TimeFormat['24-hour'] ? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x) : (x: string) => d3.timeFormat(tbsFormatMapper[timeBucket])(x),},localtime: timeFormat === TimeFormat['24-hour'],type: 'timeseries',@@ -824,8 +812,7 @@ const getSettingsPerf = (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 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: {@@ -860,10 +847,8 @@ const getSettingsPerf = (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 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)) {diff --git a/remix.config.js b/remix.config.jsindex 1981de1f1..ac42f2c32 100644--- a/remix.config.js+++ b/remix.config.js@@ -16,5 +16,7 @@ module.exports = {},serverDependenciesToBundle: ['axios',+ 'd3',+ /^d3-*/,],}