Skip to content

Commit d8664db

Browse files
revert old change to backend MAU, fix frontend MAU
1 parent 05ed277 commit d8664db

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetChartsResolver.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,8 @@ private TimeSeriesChart getActiveUsersTimeSeriesChart(
8585
final String title,
8686
final DateInterval interval) {
8787

88-
final DateRange dateRange;
89-
90-
// adjust month to show 1st of month rather than last day of previous month
91-
if (interval == DateInterval.MONTH) {
92-
dateRange =
93-
new DateRange(
94-
String.valueOf(beginning.plusDays(1).getMillis()), // Shift start by 1 day
95-
String.valueOf(end.plusDays(1).getMillis()) // Shift end by 1 day
96-
);
97-
} else {
98-
// week display starting Sundays
99-
dateRange =
100-
new DateRange(String.valueOf(beginning.getMillis()), String.valueOf(end.getMillis()));
101-
}
88+
final DateRange dateRange =
89+
new DateRange(String.valueOf(beginning.getMillis()), String.valueOf(end.getMillis()));
10290

10391
final List<NamedLine> timeSeriesLines =
10492
_analyticsService.getTimeseriesChart(

datahub-web-react/src/app/analyticsDashboard/components/TimeSeriesChart.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,32 @@ export function computeLines(chartData: TimeSeriesChartType, insertBlankPoints:
8484
return returnLines;
8585
}
8686

87+
const formatAxisDate = (value: number, chartData: TimeSeriesChartType) => {
88+
const date = new Date(value);
89+
90+
// force UTC
91+
const utcDate = new Date(
92+
Date.UTC(
93+
date.getUTCFullYear(),
94+
date.getUTCMonth(),
95+
date.getUTCDate()
96+
)
97+
);
98+
99+
return chartData.interval === 'MONTH'
100+
? utcDate.toLocaleDateString('en-US', {
101+
month: 'short',
102+
year: 'numeric',
103+
timeZone: 'UTC'
104+
})
105+
: utcDate.toLocaleDateString('en-US', {
106+
year: 'numeric',
107+
month: 'short',
108+
day: 'numeric',
109+
timeZone: 'UTC'
110+
});
111+
};
112+
87113
export const TimeSeriesChart = ({
88114
chartData,
89115
width,
@@ -117,6 +143,7 @@ export const TimeSeriesChart = ({
117143
strokeWidth={style?.axisWidth}
118144
tickLabelProps={{ fill: 'black', fontFamily: 'inherit', fontSize: 10 }}
119145
numTicks={3}
146+
tickFormat={(value) => formatAxisDate(value, chartData)}
120147
/>
121148
<Axis
122149
orientation="right"
@@ -151,9 +178,10 @@ export const TimeSeriesChart = ({
151178
tooltipData?.nearestDatum && (
152179
<div>
153180
<div>
154-
{new Date(
155-
Number(accessors.xAccessor(tooltipData.nearestDatum.datum)),
156-
).toDateString()}
181+
{formatAxisDate(
182+
accessors.xAccessor(tooltipData.nearestDatum.datum),
183+
chartData
184+
)}
157185
</div>
158186
<div>{accessors.yAccessor(tooltipData.nearestDatum.datum)}</div>
159187
</div>

0 commit comments

Comments
 (0)