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!

do not apply chart regions for 'yesterday' and 'custom' periods

Blue Moused71781114ff0
diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsx
index ecdd1b65a..619df5b47 100644
--- a/src/pages/Project/View/ViewProject.jsx
+++ b/src/pages/Project/View/ViewProject.jsx
@@ -75,14 +75,39 @@ const getColumns = (chart, showTotal, t) => {
]
}
-const getSettings = (chart, timeBucket, showTotal = true, t) => {
+const noRegionPeriods = ['custom', 'yesterday']
+
+const getSettings = (chart, timeBucket, showTotal, applyRegions, t) => {
const xAxisSize = _size(chart.x)
- let regionStart
+ let regions
+
+ if (applyRegions) {
+ let regionStart
+
+ if (xAxisSize > 1) {
+ regionStart = dayjs(chart.x[xAxisSize - 2]).toDate()
+ } else {
+ regionStart = dayjs(chart.x[xAxisSize - 1]).toDate()
+ }
- if (xAxisSize > 1) {
- regionStart = dayjs(chart.x[xAxisSize - 2]).toDate()
- } else {
- regionStart = dayjs(chart.x[xAxisSize - 1]).toDate()
+ regions = {
+ [t('project.unique')]: [
+ {
+ start: regionStart,
+ style: {
+ dasharray: '6 2',
+ },
+ },
+ ],
+ [t('project.total')]: [
+ {
+ start: regionStart,
+ style: {
+ dasharray: '6 2',
+ },
+ },
+ ]
+ }
}
return {
@@ -94,24 +119,7 @@ const getSettings = (chart, timeBucket, showTotal = true, t) => {
[t('project.unique')]: '#2563EB',
[t('project.total')]: '#D97706',
},
- regions: {
- [t('project.unique')]: [
- {
- start: regionStart,
- style: {
- dasharray: '6 2',
- },
- },
- ],
- [t('project.total')]: [
- {
- start: regionStart,
- style: {
- dasharray: '6 2',
- },
- },
- ]
- },
+ regions,
},
axis: {
x: {
@@ -334,7 +342,8 @@ const ViewProject = ({
if (_isEmpty(params)) {
setIsPanelsDataEmpty(true)
} else {
- const bbSettings = getSettings(chart, timeBucket, showTotal, t)
+ const applyRegions = !_includes(noRegionPeriods, activePeriod.period)
+ const bbSettings = getSettings(chart, timeBucket, showTotal, applyRegions, t)
setChartData(chart)
setPanelsData({