📈 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
Improve chart bar styles
Blue Mouse01dcbc9c720c
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsxindex a4a7ddb55..61216e6da 100644--- a/web/app/pages/Project/View/ViewProject.helpers.tsx+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx@@ -1693,6 +1693,17 @@ const getSettingsFunnels = (order: (a: any, b: any) => {return a.id < b.id},+ onover: (_d: any, el: SVGElement) => {+ el?.style?.setProperty('fill-opacity', '0.75', 'important')+ },+ onout: (_d: any, el: SVGElement) => {+ el?.style?.removeProperty('fill-opacity')+ },+ },+ bar: {+ radius: {+ ratio: 0.05,+ },},transition: {duration: 200,@@ -1719,6 +1730,59 @@ const getSettingsFunnels = (inner: true,},},+ onrendered: function () {+ const chart = this as any+ if (!chart?.$?.bar?.bars) return++ try {+ const svg = chart.$.svg.node()+ if (!svg) return++ const isDark = document.documentElement.classList.contains('dark')+ const ns = 'http://www.w3.org/2000/svg'++ let defs = svg.querySelector('defs')+ if (!defs) {+ defs = document.createElementNS(ns, 'defs')+ svg.insertBefore(defs, svg.firstChild)+ }++ const old = defs.querySelector('#funnel-dropoff-stripe')+ if (old) old.remove()++ const pattern = document.createElementNS(ns, 'pattern')+ pattern.setAttribute('id', 'funnel-dropoff-stripe')+ pattern.setAttribute('patternUnits', 'userSpaceOnUse')+ pattern.setAttribute('width', '20')+ pattern.setAttribute('height', '20')+ pattern.setAttribute('patternTransform', 'rotate(-45)')++ const band1 = document.createElementNS(ns, 'rect')+ band1.setAttribute('width', '20')+ band1.setAttribute('height', '20')+ band1.setAttribute('fill', isDark ? '#1e2340' : '#e2e4ef')+ pattern.appendChild(band1)++ const band2 = document.createElementNS(ns, 'rect')+ band2.setAttribute('x', '0')+ band2.setAttribute('y', '0')+ band2.setAttribute('width', '10')+ band2.setAttribute('height', '20')+ band2.setAttribute('fill', isDark ? '#2a3058' : '#d8dbed')+ pattern.appendChild(band2)++ defs.appendChild(pattern)++ chart.$.bar.bars.each(function (this: SVGPathElement, d: any) {+ if (d?.id === 'dropoff') {+ this.style.fill = 'url(#funnel-dropoff-stripe)'+ this.style.stroke = 'none'+ }+ })+ } catch {+ // ignore+ }+ },tooltip: {contents: (items: any) => {const { index = 0 } = items[0] || {}diff --git a/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx b/web/app/pages/Project/tabs/Funnels/FunnelChart.tsxindex 8fd04af21..aecd0fa9c 100644--- a/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx+++ b/web/app/pages/Project/tabs/Funnels/FunnelChart.tsx@@ -1,11 +1,12 @@import { ChartOptions } from 'billboard.js'-import React, { useMemo } from 'react'+import { useMemo } from 'react'import { useTranslation } from 'react-i18next'import { AnalyticsFunnel } from '~/lib/models/Project'import { MainChart } from '../../View/components/MainChart'import { getSettingsFunnels } from '../../View/ViewProject.helpers'+import { cn } from '~/utils/generic'interface FunnelChartProps {funnel: AnalyticsFunnel[]@@ -44,7 +45,7 @@ export const FunnelChart = ({chartId='funnel-chart'options={options}dataNames={dataNames}- className={className}+ className={cn('funnel-chart', className)}deps={deps}/>)diff --git a/web/app/styles/ProjectViewStyle.css b/web/app/styles/ProjectViewStyle.cssindex ccfeaf57c..a534d9ce2 100644--- a/web/app/styles/ProjectViewStyle.css+++ b/web/app/styles/ProjectViewStyle.css@@ -177,7 +177,20 @@ body.dark .bb-ygrid {}.bb-target-dropoff .bb-bar {- stroke: rgba(71, 85, 105, 0.4) !important;+ stroke: none !important;+ stroke-width: 0 !important;+}++.funnel-chart .bb-bar {+ fill-opacity: 1 !important;+ stroke: none !important;+ stroke-width: 0 !important;+ transition: fill-opacity 0.15s ease-out;+}++.funnel-chart .bb-target-events.bb-defocused .bb-bar,+.funnel-chart .bb-target-dropoff.bb-defocused .bb-bar {+ fill-opacity: 0.6 !important;}.bb-target-Technical-Expenses .bb-bar {