📈 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
(improvement) billboard.js styling (#425)
Andrii Romasiun81ddc0b52e52
diff --git a/app/pages/Project/View/ViewProject.helpers.tsx b/app/pages/Project/View/ViewProject.helpers.tsxindex af2fbab3b..0e301974c 100644--- a/app/pages/Project/View/ViewProject.helpers.tsx+++ b/app/pages/Project/View/ViewProject.helpers.tsx@@ -1,4 +1,5 @@import React from 'react'+import type { ChartOptions, GridLineOptions } from 'billboard.js'import type i18next from 'i18next'// @ts-ignoreimport { saveAs } from 'file-saver'@@ -488,9 +489,9 @@ const getSettings = (compareChart?: {[key: string]: string[]},-) => {+): ChartOptions => {const xAxisSize = _size(chart.x)- const lines = []+ const lines: GridLineOptions[] = []const modifiedChart = { ...chart }let regionsconst customEventsToArray = customEvents@@ -514,7 +515,7 @@ const getSettings = (if (!_isEmpty(forecasedChartData) && _isEmpty(compareChart)) {lines.push({- value: _last(chart?.x),+ value: _last(chart?.x) as string,text: 'Forecast',})modifiedChart.x = [...modifiedChart.x, ...forecasedChartData.x]@@ -601,6 +602,7 @@ const getSettings = (sessionDurationCompare: 'rgba(201, 69, 237, 0.4)',...customEventsColors,},+ // @ts-expect-errorregions,axes: {bounce: 'y2',@@ -625,6 +627,7 @@ const getSettings = (tick: {fit: true,rotate: rotateXAxis ? 45 : 0,+ // @ts-expect-errorformat:timeFormat === TimeFormat['24-hour']? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)@@ -643,17 +646,18 @@ const getSettings = (y2: {show: activeChartMetrics.bounce || activeChartMetrics.sessionDuration,tick: {+ // @ts-expect-errorformat: activeChartMetrics.bounce? (d: string) => `${d}%`: (d: string) => getStringFromTime(getTimeFromSeconds(d)),},- min: activeChartMetrics.bounce ? 10 : null,- max: activeChartMetrics.bounce ? 100 : null,- default: activeChartMetrics.bounce ? [10, 100] : null,+ min: activeChartMetrics.bounce ? 10 : undefined,+ max: activeChartMetrics.bounce ? 100 : undefined,+ default: activeChartMetrics.bounce ? [10, 100] : undefined,},},tooltip: {- contents: (item: any, _: any, __: any, color: any) => {+ contents: (item, _, __, color) => {const typesOptionsToTypesCompare: {[key: string]: string} = {@@ -786,13 +790,14 @@ const getSettings = (only: xAxisSize > 1,},pattern: ['circle'],- r: 3,+ r: 2,},legend: {- usePoint: true,item: {tile: {+ type: 'circle',width: 10,+ r: 3,},},hide: ['uniqueCompare', 'totalCompare', 'bounceCompare', 'sessionDurationCompare'],@@ -814,7 +819,7 @@ const getSettingsSession = (timeFormat: string,rotateXAxis: boolean,chartType: string,-) => {+): ChartOptions => {const xAxisSize = _size(chart.x)const columns = getColumns(chart, { views: true }, {})@@ -835,11 +840,6 @@ const getSettingsSession = (sessionDuration: 'y2',},},- // grid: {- // x: {- // lines,- // },- // },transition: {duration: 500,},@@ -853,6 +853,7 @@ const getSettingsSession = (tick: {fit: true,rotate: rotateXAxis ? 45 : 0,+ // @ts-expect-errorformat:timeFormat === TimeFormat['24-hour']? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)@@ -915,13 +916,14 @@ const getSettingsSession = (only: xAxisSize > 1,},pattern: ['circle'],- r: 3,+ r: 2,},legend: {- usePoint: true,item: {tile: {+ type: 'circle',width: 10,+ r: 3,},},hide: ['uniqueCompare', 'totalCompare', 'bounceCompare', 'sessionDurationCompare'],@@ -943,7 +945,7 @@ const getSettingsError = (timeFormat: string,rotateXAxis: boolean,chartType: string,-) => {+): ChartOptions => {const xAxisSize = _size(chart.x)const columns = getColumns(chart, { occurrences: true }, {})@@ -970,6 +972,7 @@ const getSettingsError = (regions: {occurrences: [{+ // @ts-expect-errorstart: regionStart,style: {dasharray: '6 2',@@ -978,11 +981,6 @@ const getSettingsError = (],},},- // grid: {- // x: {- // lines,- // },- // },transition: {duration: 500,},@@ -996,6 +994,7 @@ const getSettingsError = (tick: {fit: true,rotate: rotateXAxis ? 45 : 0,+ // @ts-expect-errorformat:timeFormat === TimeFormat['24-hour']? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)@@ -1043,13 +1042,14 @@ const getSettingsError = (only: xAxisSize > 1,},pattern: ['circle'],- r: 3,+ r: 2,},legend: {- usePoint: true,item: {tile: {+ type: 'circle',width: 10,+ r: 3,},},hide: ['uniqueCompare', 'totalCompare', 'bounceCompare', 'sessionDurationCompare'],@@ -1065,7 +1065,7 @@ const getSettingsError = (}// function to get the settings and data for the funnels chart-const getSettingsFunnels = (funnel: IAnalyticsFunnel[], totalPageviews: number, t: typeof i18next.t) => {+const getSettingsFunnels = (funnel: IAnalyticsFunnel[], totalPageviews: number, t: typeof i18next.t): ChartOptions => {const values = _map(funnel, (step) => {if (_startsWith(step.value, '/')) {return t('project.visitPage', { page: step.value })@@ -1093,6 +1093,7 @@ const getSettingsFunnels = (funnel: IAnalyticsFunnel[], totalPageviews: number,dropoff: 'rgba(37, 99, 235, 0.2)', // blue-600 + opacity},groups: [['events', 'dropoff']],+ // @ts-expect-errororder: (a: any, b: any) => {return a.id < b.id},@@ -1234,7 +1235,7 @@ const getSettingsPerf = (compareChart?: {[key: string]: string[]},-) => {+): ChartOptions => {const xAxisSize = _size(chart.x)return {@@ -1320,6 +1321,7 @@ const getSettingsPerf = (tick: {fit: true,rotate: rotateXAxis ? 45 : 0,+ // @ts-expect-errorformat:timeFormat === TimeFormat['24-hour']? (x: string) => d3.timeFormat(tbsFormatMapper24h[timeBucket])(x)@@ -1330,8 +1332,11 @@ const getSettingsPerf = (},y: {tick: {+ // @ts-expect-errorformat: (d: string) => getStringFromTime(getTimeFromSeconds(d), true),},+ show: true,+ inner: true,},},transition: {@@ -1417,13 +1422,14 @@ const getSettingsPerf = (only: xAxisSize > 1,},pattern: ['circle'],- r: 3,+ r: 2,},legend: {- usePoint: true,item: {tile: {+ type: 'circle',width: 10,+ r: 3,},},hide: perfomanceChartCompare,diff --git a/app/styles/ProjectViewStyle.css b/app/styles/ProjectViewStyle.cssindex 1e5b160d6..367114ec0 100644--- a/app/styles/ProjectViewStyle.css+++ b/app/styles/ProjectViewStyle.css@@ -1,18 +1,86 @@+/*+ .bb-axis .domain - X / Y axis line+ .bb-axis .tick line - ticks+ .bb-axis - [fill] text+ .bb-legend-item text - [fill] text underneath the chart+ .bb-xgrid-focus - line which shows on chart on hover+*/++/* dark theme config */html.dark .bb-legend-item text {- fill: #f9fafb;+ fill: #d1d5db;}html.dark .bb-axis {- fill: #f9fafb;+ fill: #d1d5db;}html.dark .bb-axis .domain {stroke: #334155;}+html.dark .bb-axis .tick line {+ stroke: #334155;+}++html.dark .bb-xgrid-focus {+ /* slate-600 */+ stroke: #475569;+}++/* light theme config */+html.light .bb-legend-item text {+ /* gray-800 */+ fill: #1f2937;+}++html.light .bb-axis {+ /* gray-700 */+ fill: #374151;+}++html.light .bb-axis .domain {+ /* slate-400 */+ stroke: #94a3b8;+}++html.light .bb-axis .tick line {+ /* slate-400 */+ stroke: #94a3b8;+}++html.light .bb-xgrid-focus {+ /* slate-400 */+ stroke: #94a3b8;+}++.bb-xgrid-focus {+ shape-rendering: geometricprecision;+}++.bb-axis {+ font-family:+ 'Inter',+ 'Cantarell',+ 'Roboto',+ system-ui,+ -apple-system,+ BlinkMacSystemFont,+ 'Helvetica Neue',+ 'Oxygen',+ 'Ubuntu',+ sans-serif;+ font-weight: 500;+ letter-spacing: 0.02em;+}++.bb-line {+ stroke-width: 1.5;+}+.bb-bar {fill-opacity: 0.3;- stroke-width: 1 !important;+ stroke-width: 1.5 !important;}.bb-target-unique .bb-bar {@@ -59,7 +127,7 @@ html.dark .bb-axis .domain {stroke: #709775 !important;}-.bb-target-dom_load .bb-bar {+.bb-target-dom-load .bb-bar {stroke: #a5e6ab !important;}@@ -111,10 +179,6 @@ html.dark .bb-axis .domain {stroke: #709775 !important;}-html.dark .bb-axis .tick line {- stroke: #334155;-}-@media (max-width: 640px) {.custom-space-x-style > :not([hidden]) ~ :not([hidden]) {--tw-space-x-reverse: 0 !important;