From 23ea20132539785a260a9be5d81c555a62aa91b2 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Wed, 18 Sep 2024 15:07:29 +0530 Subject: [PATCH] Fixed an issue where graph visualizer pie chart was showing X axis, Y axis and grid lines. --- web/pgadmin/static/js/chartjs/index.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/pgadmin/static/js/chartjs/index.jsx b/web/pgadmin/static/js/chartjs/index.jsx index b4413a50b..ed7aacbd9 100644 --- a/web/pgadmin/static/js/chartjs/index.jsx +++ b/web/pgadmin/static/js/chartjs/index.jsx @@ -112,7 +112,7 @@ export default function BaseChart({type='line', id, options, data, redraw=false, }, []); useEffect(()=>{ - let theme1 = { + let scaleColors = { scales: { x: { ticks: { @@ -130,7 +130,11 @@ export default function BaseChart({type='line', id, options, data, redraw=false, }, }, }; - let merged = _.merge(options, theme1); + let merged = options; + // Override only if scales are actually defined. + if(options.scales && Object.keys(options.scales).length > 0) { + merged = _.merge(options, scaleColors); + } chartObj.current.options = merged; chartObj.current.update(props.updateOptions || {}); },[theme]); @@ -213,7 +217,7 @@ export function PieChart({options, ...props}) { let optionsMerged = _.merge({ responsive: true, maintainAspectRatio: false, - normalized: true + normalized: true, }, options); return (