mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 01:25:37 +01:00
Added filter buttons for realtime.
This commit is contained in:
parent
5a73c224b7
commit
f1624780ee
13 changed files with 194 additions and 105 deletions
|
|
@ -2,7 +2,7 @@ import React, { useMemo, useRef } from 'react';
|
|||
import { format, parseISO, startOfMinute, subMinutes, isBefore } from 'date-fns';
|
||||
import PageviewsChart from './PageviewsChart';
|
||||
import { getDateArray } from 'lib/date';
|
||||
import { DEFAULT_ANIMATION_DURATION } from 'lib/constants';
|
||||
import { DEFAULT_ANIMATION_DURATION, REALTIME_RANGE } from 'lib/constants';
|
||||
|
||||
function mapData(data) {
|
||||
let last = 0;
|
||||
|
|
@ -26,7 +26,7 @@ function mapData(data) {
|
|||
|
||||
export default function RealtimeChart({ data, unit, ...props }) {
|
||||
const endDate = startOfMinute(new Date());
|
||||
const startDate = subMinutes(endDate, 30);
|
||||
const startDate = subMinutes(endDate, REALTIME_RANGE);
|
||||
const prevEndDate = useRef(endDate);
|
||||
|
||||
const chartData = useMemo(() => {
|
||||
|
|
@ -51,7 +51,7 @@ export default function RealtimeChart({ data, unit, ...props }) {
|
|||
return (
|
||||
<PageviewsChart
|
||||
{...props}
|
||||
height={300}
|
||||
height={200}
|
||||
unit={unit}
|
||||
data={chartData}
|
||||
animationDuration={animationDuration}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue