bito-code-review[bot] commented on code in PR #35915:
URL: https://github.com/apache/superset/pull/35915#discussion_r2478956795


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx:
##########
@@ -112,8 +112,49 @@ const config: ControlPanelConfig = {
               ...sharedControls.x_axis_time_format,
               default: 'smart_date',
               description: `${D3_TIME_FORMAT_DOCS}. 
${TIME_SERIES_DESCRIPTION_TEXT}`,
+              visibility: ({ controls }: ControlPanelsContainerProps) => {
+                // check if x axis is a time column
+                const xAxisColumn = controls?.x_axis?.value;
+                const xAxisOptions = controls?.x_axis?.options;
+
+                if (!xAxisColumn || !Array.isArray(xAxisOptions))
+                {
+                  return false;
+                }
+
+                const xAxisType = xAxisOptions.find(option => 
option.column_name === xAxisColumn)?.type;
+                
+                return typeof xAxisType === 'string' && 
xAxisType.toUpperCase().includes('TIME');

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incorrect time format visibility for DATE 
columns</b></div>
   <div id="fix">
   
   The visibility logic for the x_axis_time_format control only checks if the 
column type includes 'TIME', which excludes DATE columns. However, DATE is a 
time-related data type that should also have access to time formatting options. 
This prevents users from formatting DATE columns properly on the x-axis, 
impacting chart usability for date-based data. The fix extends the condition to 
include types containing 'DATE' as well.
   </div>
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
                   return typeof xAxisType === 'string' && 
(xAxisType.toUpperCase().includes('TIME') || 
xAxisType.toUpperCase().includes('DATE'));
   ````
   
   </div>
   </details>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/35915#issuecomment-3469177632>#2e97c7</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to