mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 17:15:37 +01:00
Updated grid layouts. Fixed chart tooltip.
This commit is contained in:
parent
96c2c32d14
commit
1d24e23a34
9 changed files with 64 additions and 79 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useRef, useEffect, useMemo, ReactNode, HTMLAttributes } from 'react';
|
||||
import { useState, useRef, useEffect, useMemo, HTMLAttributes } from 'react';
|
||||
import { Loading } from '@umami/react-zen';
|
||||
import ChartJS, { LegendItem, ChartOptions } from 'chart.js/auto';
|
||||
import { Legend } from '@/components/metrics/Legend';
|
||||
|
|
@ -14,7 +14,6 @@ export interface ChartProps extends HTMLAttributes<HTMLDivElement> {
|
|||
onUpdate?: (chart: any) => void;
|
||||
onTooltip?: (model: any) => void;
|
||||
chartOptions?: ChartOptions;
|
||||
tooltip?: ReactNode;
|
||||
}
|
||||
|
||||
export function Chart({
|
||||
|
|
@ -27,7 +26,6 @@ export function Chart({
|
|||
onUpdate,
|
||||
onTooltip,
|
||||
chartOptions,
|
||||
tooltip,
|
||||
...props
|
||||
}: ChartProps) {
|
||||
const canvas = useRef(null);
|
||||
|
|
@ -53,6 +51,7 @@ export function Chart({
|
|||
},
|
||||
tooltip: {
|
||||
enabled: false,
|
||||
intersect: true,
|
||||
external: onTooltip,
|
||||
},
|
||||
},
|
||||
|
|
@ -139,7 +138,6 @@ export function Chart({
|
|||
<canvas ref={canvas} />
|
||||
</div>
|
||||
<Legend items={legendItems} onClick={handleLegendClick} />
|
||||
{tooltip}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue