Skip to content

Commit

Permalink
ui(report): allow for React component in Chart title
Browse files Browse the repository at this point in the history
This removes the toolbar on the right side to download chart as png, svg.. but I don't think this was widely used
  • Loading branch information
Almouro committed Mar 4, 2024
1 parent 1b0bb2d commit abade33
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ It’s worth noting that results might be higher than expected since we measure
here for more details
)
Frame rate (FPS)
Total CPU Usage (%)
CPU Usage per thread (%)
Threads
Thread
Average CPU Usage (%)
Expand Down Expand Up @@ -174,7 +177,8 @@ Binder #5
0
JITWorker
0
0"
0
RAM Usage (MB)"
`;

exports[`flashlight measure interactive it displays measures: Web app with measures and threads opened - 2. FULL 1`] = `
Expand Down Expand Up @@ -735,6 +739,11 @@ exports[`flashlight measure interactive it displays measures: Web app with measu
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Frame rate (FPS)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand All @@ -748,12 +757,22 @@ exports[`flashlight measure interactive it displays measures: Web app with measu
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Total CPU Usage (%)
</div>
<apex-charts
height="500"
options="[object Object]"
series="[object Object]"
type="line"
/>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
CPU Usage per thread (%)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -3155,6 +3174,11 @@ exports[`flashlight measure interactive it displays measures: Web app with measu
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
RAM Usage (MB)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ Coefficient of variation :

2.7
%
Frame rate (FPS)
Total CPU Usage (%)
CPU Usage per thread (%)
Threads
Thread
1-before-memo.apk
Expand Down Expand Up @@ -909,6 +912,7 @@ Binder:4646_5
Binder:3978_4
0
0
RAM Usage (MB)
Showing average of 10 test iterations"
`;

Expand Down Expand Up @@ -2302,6 +2306,11 @@ exports[`<ReporterView /> renders the comparison view 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Frame rate (FPS)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand All @@ -2315,12 +2324,22 @@ exports[`<ReporterView /> renders the comparison view 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Total CPU Usage (%)
</div>
<apex-charts
height="500"
options="[object Object]"
series="[object Object],[object Object]"
type="line"
/>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
CPU Usage per thread (%)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -12054,6 +12073,11 @@ exports[`<ReporterView /> renders the comparison view 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
RAM Usage (MB)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -12178,6 +12202,9 @@ It’s worth noting that results might be higher than expected since we measure

here for more details
)
Frame rate (FPS)
Total CPU Usage (%)
CPU Usage per thread (%)
Threads
Thread
1-before-memo.apk
Expand Down Expand Up @@ -12444,6 +12471,7 @@ Binder:9067_4
pool-47-thread-
0
0
RAM Usage (MB)
Iteration
10
/
Expand Down Expand Up @@ -13354,6 +13382,11 @@ exports[`<ReporterView /> renders the comparison view 4`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Frame rate (FPS)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand All @@ -13367,12 +13400,22 @@ exports[`<ReporterView /> renders the comparison view 4`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Total CPU Usage (%)
</div>
<apex-charts
height="500"
options="[object Object]"
series="[object Object],[object Object]"
type="line"
/>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
CPU Usage per thread (%)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -18062,6 +18105,11 @@ exports[`<ReporterView /> renders the comparison view 4`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
RAM Usage (MB)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -18596,7 +18644,11 @@ Coefficient of variation :

0.8
%
Frame rate (FPS)
Total CPU Usage (%)
CPU Usage per thread (%)
Threads
RAM Usage (MB)
Reset
Play all
RN0720RC1_true_thousandtexts (com.rn0720rc1_true_thousandtexts)
Expand Down Expand Up @@ -20123,6 +20175,11 @@ exports[`<ReporterView /> renders the comparison view with videos 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Frame rate (FPS)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand All @@ -20136,12 +20193,22 @@ exports[`<ReporterView /> renders the comparison view with videos 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
Total CPU Usage (%)
</div>
<apex-charts
height="500"
options="[object Object]"
series="[object Object],[object Object]"
type="line"
/>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
CPU Usage per thread (%)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down Expand Up @@ -20191,6 +20258,11 @@ exports[`<ReporterView /> renders the comparison view with videos 2`] = `
<div
class="mx-8 p-6 bg-dark-charcoal border border-gray-800 rounded-lg"
>
<div
class="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium"
>
RAM Usage (MB)
</div>
<apex-charts
height="500"
options="[object Object]"
Expand Down
29 changes: 16 additions & 13 deletions packages/core/web-reporter-ui/src/components/Charts/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Chart = ({
visibleSeriesNames,
}: {
type: Exclude<ApexChartProps["type"], undefined>;
title: string;
title: string | React.ReactNode;
series: ApexAxisChartSeries;
options?: ApexOptions;
height: number;
Expand All @@ -50,7 +50,6 @@ export const Chart = ({
const commonOptions: ApexOptions = useMemo(
() => ({
chart: {
id: title,
animations: {
enabled: true,
easing: "linear",
Expand All @@ -61,15 +60,8 @@ export const Chart = ({
zoom: {
enabled: false,
},
},
title: {
text: title,
align: "left",
style: {
color: "#FFFFFF",
fontSize: "24px",
fontFamily: "Inter, sans-serif",
fontWeight: 500,
toolbar: {
show: false,
},
},
dataLabels: {
Expand Down Expand Up @@ -97,7 +89,7 @@ export const Chart = ({
strokeDashArray: 3,
},
}),
[colors, title]
[colors]
);

const chartOptions = useMemo(() => merge(commonOptions, options), [commonOptions, options]);
Expand All @@ -119,6 +111,17 @@ export const Chart = ({
}, [visibleSeriesNames]);

return (
<ReactApexChart ref={ref} options={chartOptions} series={series} type={type} height={height} />
<>
<div className="mb-[5px] ml-[10px] text-2xl text-white flex flex-row font-medium">
{title}
</div>
<ReactApexChart
ref={ref}
options={chartOptions}
series={series}
type={type}
height={height}
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ReportChart = ({
formatter,
onPointClick,
}: {
title: string;
title: string | React.ReactNode;
series: LineSeriesType;
height: number;
timeLimit?: number | null;
Expand Down

0 comments on commit abade33

Please sign in to comment.