Skip to content

Commit 5d88f69

Browse files
committed
Make the visualization stick while scrolling the chart options along with making every chart details query unique
1 parent 53b9b62 commit 5d88f69

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/charts/[chartID]/components/ChartGenVizPreview.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
304304
refetch: any;
305305
error: any;
306306
isError: boolean;
307-
} = useQuery([`chartDetailsForViz`], () =>
307+
} = useQuery([`chartDetailsForViz-${JSON.stringify(chartData)}`], () =>
308308
GraphQL(
309309
getResourceChartForViz,
310310
{
@@ -320,8 +320,6 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
320320
if (chartDetailsRes?.data?.resourceChart) {
321321
const chartRes = chartDetailsRes?.data?.resourceChart;
322322

323-
console.log('chartData updated :::::::::', chartRes);
324-
325323
setChartData({
326324
chartId: params.chartID,
327325
name: chartRes?.name,
@@ -679,22 +677,25 @@ const ChartGenVizPreview = ({ params }: { params: any }) => {
679677

680678
<div className="border-t-2 border-solid border-greyExtralight pt-8">
681679
<div className="flex flex-row justify-center gap-6">
682-
<div className="flex flex-[7] justify-center">
683-
<div className="w-full rounded-4 border-1 border-solid border-greyExtralight object-contain">
684-
{chartData.chart?.options &&
685-
Object.keys(chartData.chart?.options).length > 0 ? (
680+
{/* Chart Preview */}
681+
<div className="flex-[7]">
682+
{chartData.chart?.options &&
683+
Object.keys(chartData.chart?.options).length > 0 ? (
684+
<div className="sticky top-36 w-full items-center rounded-4 border-1 border-solid border-greyExtralight">
686685
<ReactECharts
687686
option={chartData.chart?.options}
688687
ref={chartRef}
689688
/>
690-
) : (
691-
<div className="h-full w-full">
692-
<Text variant="bodyLg">No Chart Data</Text>
693-
</div>
694-
)}
695-
</div>
689+
</div>
690+
) : (
691+
<div className="sticky top-36 flex w-full items-center justify-center">
692+
<Text variant="bodyLg">No Chart Data</Text>
693+
</div>
694+
)}
696695
</div>
697-
<div className="flex flex-[3] flex-col rounded-4 border-2 border-solid border-greyExtralight p-3">
696+
697+
{/* Chart Customization */}
698+
<div className="flex h-full flex-[3] flex-col rounded-4 border-2 border-solid border-greyExtralight p-3">
698699
<Tabs value={selectedTab}>
699700
<TabList fitted border>
700701
<Tab

0 commit comments

Comments
 (0)