📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fix: Jumping annotations
Blue Mouse27b47215e5c8
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsxindex 2c149b277..cba0d3b98 100644--- a/web/app/pages/Project/View/ViewProject.helpers.tsx+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx@@ -819,7 +819,7 @@ const getSettings = (},},transition: {- duration: 200,+ duration: 0,},resize: {auto: true,@@ -2154,7 +2154,7 @@ const getSettingsPerf = (},},transition: {- duration: 200,+ duration: 0,},resize: {auto: true,diff --git a/web/app/pages/Project/View/components/MainChart.tsx b/web/app/pages/Project/View/components/MainChart.tsxindex 36db23e25..c0d1a2a38 100644--- a/web/app/pages/Project/View/components/MainChart.tsx+++ b/web/app/pages/Project/View/components/MainChart.tsx@@ -1,5 +1,5 @@import { Chart, ChartOptions, GridLineOptions } from 'billboard.js'-import React, { useEffect, useRef, useMemo } from 'react'+import React, { useEffect, useMemo } from 'react'import BillboardChart from '~/ui/BillboardChart'@@ -23,7 +23,6 @@ export const MainChart = ({xGridLines,}: MainChartProps) => {const { registerChart, unregisterChart } = useChartManager()- const chartRef = useRef<Chart | null>(null)const mergedDeps = useMemo(() => deps || [options, dataNames],@@ -31,22 +30,9 @@ export const MainChart = ({)const handleChartReady = (chart: Chart | null) => {- chartRef.current = chartregisterChart(chartId, chart)-- if (chart && xGridLines) {- chart.xgrids(xGridLines)- }}- useEffect(() => {- if (!chartRef.current || !xGridLines) {- return- }-- chartRef.current.xgrids(xGridLines)- }, [xGridLines])-useEffect(() => {return () => {unregisterChart(chartId)@@ -60,6 +46,7 @@ export const MainChart = ({className={className}onReady={handleChartReady}deps={mergedDeps}+ xGridLines={xGridLines}/>)}diff --git a/web/app/ui/BillboardChart.tsx b/web/app/ui/BillboardChart.tsxindex 4d7476388..46d3ac2ae 100644--- a/web/app/ui/BillboardChart.tsx+++ b/web/app/ui/BillboardChart.tsx@@ -3,6 +3,7 @@ import billboard, {regions,type Chart,type ChartOptions,+ type GridLineOptions,} from 'billboard.js'import cx from 'clsx'import React, { useEffect, useMemo, useRef } from 'react'@@ -15,6 +16,7 @@ interface BillboardChartProps {className?: stringonReady?: (chart: Chart | null) => voiddeps?: any[]+ xGridLines?: GridLineOptions[]}const BillboardChart = ({@@ -23,10 +25,12 @@ const BillboardChart = ({className,onReady,deps,+ xGridLines,}: BillboardChartProps) => {const containerRef = useRef<HTMLDivElement | null>(null)const chartRef = useRef<Chart | null>(null)const isDestroyingRef = useRef(false)+ const appliedXGridLinesRef = useRef<GridLineOptions[] | undefined>(undefined)const mergedDeps = useMemo(() => deps || [options, dataNames],@@ -56,6 +60,16 @@ const BillboardChart = ({...grid(),...regions(),...options,+ grid:+ xGridLines === undefined+ ? options.grid+ : {+ ...options.grid,+ x: {+ ...options.grid?.x,+ lines: xGridLines,+ },+ },bindto: containerRef.current as unknown as HTMLElement,}@@ -140,6 +154,7 @@ const BillboardChart = ({})}chartRef.current = chart+ appliedXGridLinesRef.current = chart ? xGridLines : undefinedif (chart && dataNames) {try {@@ -177,6 +192,25 @@ const BillboardChart = ({// eslint-disable-next-line react-hooks/exhaustive-deps}, mergedDeps)+ useEffect(() => {+ const chart = chartRef.current++ if (+ !chart ||+ xGridLines === undefined ||+ appliedXGridLinesRef.current === xGridLines+ ) {+ return+ }++ try {+ chart.xgrids(xGridLines)+ appliedXGridLinesRef.current = xGridLines+ } catch {+ return+ }+ }, [xGridLines])+// translate='no' + notranslate: page translators rewriting SVG <text> nodes// break billboard.js's tick measurement (getBBox on a non-SVG element)return (