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


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -339,21 +346,28 @@ export default function transformProps(
 
     const lineStyle: LineStyleOption = {};
     if (derivedSeries) {
-      // Get the time offset for this series to assign different dash patterns
       const offset = getTimeOffset(entry, array) || seriesName;
-      if (!offsetLineWidths[offset]) {
-        offsetLineWidths[offset] = Object.keys(offsetLineWidths).length + 1;
+      
+      const configuredOffsetIndex = array.indexOf(offset);
+      
+      if (offsetPatternIndexes[offset] === undefined) {
+        offsetPatternIndexes[offset] =
+          configuredOffsetIndex >= 0
+            ? configuredOffsetIndex
+            : Object.keys(offsetPatternIndexes).length;

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Logic Bug in Dash Pattern Assignment</b></div>
   <div id="fix">
   
   The logic for assigning patternIndex to unconfigured time offsets may 
collide with configured ones, causing different offsets to share the same dash 
pattern. This could confuse users distinguishing series. It looks like the 
intent is consistent patterns based on configured order, but the fallback needs 
adjustment to avoid overlap.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -  const offsetPatternIndexes: { [key: string]: number } = {};
    +  const offsetPatternIndexes: { [key: string]: number } = {};
    +  let unconfiguredIndex = array.length;
    @@ -354,5 +355,5 @@
    -      if (offsetPatternIndexes[offset] === undefined) {
    -        offsetPatternIndexes[offset] =
    -          configuredOffsetIndex >= 0
    -            ? configuredOffsetIndex
    -            : Object.keys(offsetPatternIndexes).length;
    +      if (offsetPatternIndexes[offset] === undefined) {
    +        offsetPatternIndexes[offset] =
    +          configuredOffsetIndex >= 0
    -            ? configuredOffsetIndex
    -            : unconfiguredIndex++;
    +            : unconfiguredIndex++;
           }
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #268f78</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