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!

fixed formatting for chart

Blue Mouse361f52e2bee5
diff --git a/src/pages/Project/View/ViewProject.helpers.jsx b/src/pages/Project/View/ViewProject.helpers.jsx
index 2a5391606..ceac4c424 100644
--- a/src/pages/Project/View/ViewProject.helpers.jsx
+++ b/src/pages/Project/View/ViewProject.helpers.jsx
@@ -19,7 +19,7 @@ import _reduce from 'lodash/reduce'
import JSZip from 'jszip'
import { tbsFormatMapper } from 'redux/constants'
-
+import { getTimeFromSeconds, getStringFromTime } from 'utils/generic'
import countries from 'utils/isoCountries'
const getAvg = (arr) => {
@@ -275,7 +275,7 @@ const getSettings = (chart, timeBucket, activeChartMetrics, applyRegions) => {
y2: {
show: activeChartMetrics.bounce || activeChartMetrics.sessionDuration,
tick: {
- format: activeChartMetrics.bounce ? (d) => `${d}%` : (d) => `${d} sec`,
+ format: activeChartMetrics.bounce ? (d) => `${d}%` : (d) => getStringFromTime(getTimeFromSeconds(d)),
},
min: activeChartMetrics.bounce ? 10 : null,
max: activeChartMetrics.bounce ? 100 : null,
diff --git a/src/utils/generic.js b/src/utils/generic.js
index 72de4c49a..39a4cecc9 100644
--- a/src/utils/generic.js
+++ b/src/utils/generic.js
@@ -50,5 +50,9 @@ export const getTimeFromSeconds = (seconds) => {
export const getStringFromTime = (time) => {
const { h, m, s } = time
+ if (h === 0 && m === 0 && s === 0) {
+ return '0s'
+ }
+
return `${h ? `${h}h ` : ''}${m ? `${m}m ` : ''}${s ? `${s}s` : ''}`
}