You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "maksperskiy (via GitHub)" <gi...@apache.org> on 2024/08/05 09:08:34 UTC

[I] Bug crossing lines in line/area chart [superset]

maksperskiy opened a new issue, #29854:
URL: https://github.com/apache/superset/issues/29854

   ### Bug description
   
   Line doesn't render between points if values crossed by X Axis.
   ![image](https://github.com/user-attachments/assets/0274ae01-8485-46f9-b975-fa6108fb04c1)
   Data:
   ```sql
   select * from (
   values ('first', 2023, 172520663.69, 172520663.69),
   ('first', 2024, 96318876.44, 96318876.44),
   ('second', 2023, 27512555.11, 27512555.11),
   ('second', 2024, 32673437.12, 34673437.12),
   ('third', 2023, 12536226.56, 12536226.),
   ('third', 2024, 9236723.51, 9236723.51),
   ('fourth', 2023, 70255125.99, 15255125.99),
   ('fourth', 2024, 61255558.42, 32255558.42)
   ) s("type", year, score, amount)
   ```
   
   Version: 4.0.0
   
   ### How to reproduce the bug
   
   1. Create dataset (use SQL from description)
   2. Create Line Chart with "total" as X-AXIS, "SUM(score)" as METRICS, "type" as DIMENSIONS
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   4.0.2
   
   ### Python version
   
   I don't know
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug crossing lines in line/area chart [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29854:
URL: https://github.com/apache/superset/issues/29854#issuecomment-2268575271

   <!-- Greeting -->
   Hey there, @maksperskiy! đź‘‹ I'm here to help you with bug squashing, questions, and becoming a contributor. Let's crack this bug together!
   
   <!-- Answer -->
   To address the issue where the line chart in Superset version 4.0.2 fails to render lines between points when the values cross the X-axis, you can follow these steps:
   
   1. **Ensure Data Formatting**: Make sure your data points are correctly formatted and sorted. There should be no gaps or missing values that could cause rendering issues.
   
   2. **Chart Configuration**:
      - Set the `lineInterpolation` property to `'linear'` to ensure lines are drawn correctly between points:
        ```js
        const lineInterpolation = 'linear';
        ```
      - Set the `clipEdge` property to `false` to avoid clipping the lines at the edges:
        ```js
        chart.clipEdge(false);
        ```
   
   3. **Handling Missing Values**: Superset includes null values in the `trendLineData` array to cover the time range. Ensure your dataset handles missing values appropriately.
   
   4. **Negative Values**: Superset can handle and render negative values in line charts. Ensure your dataset includes negative values correctly if applicable.
   
   Here is an example of how the data should be structured:
   ```ts
   export default [
     {
       key: ['Christopher'],
       values: [
         { x: -157766400000.0, y: 24703 },
         { x: -126230400000.0, y: 27861 },
         { x: -94694400000.0, y: 29436 },
         { x: -63158400000.0, y: 31463 },
         { x: -31536000000.0, y: 35718 },
         { x: 0.0, y: 41758 },
         { x: 31536000000.0, y: 48172 },
         { x: 63072000000.0, y: 52092 },
         { x: 94694400000.0, y: 48217 },
         { x: 126230400000.0, y: 48476 },
         { x: 157766400000.0, y: 46438 },
         { x: 189302400000.0, y: 45086 },
         { x: 220924800000.0, y: 46610 },
         { x: 252460800000.0, y: 47107 },
         { x: 283996800000.0, y: 50514 },
         { x: 315532800000.0, y: 48969 },
         { x: 347155200000.0, y: 50108 },
         { x: 378691200000.0, y: 59055 },
         { x: 410227200000.0, y: 59188 },
         { x: 441763200000.0, y: 59859 },
         { x: 473385600000.0, y: 59516 },
         { x: 504921600000.0, y: 56633 },
         { x: 536457600000.0, y: 54466 },
         { x: 567993600000.0, y: 52996 },
         { x: 599616000000.0, y: 53205 },
         { x: 631152000000.0, y: 52322 },
         { x: 662688000000.0, y: 47109 },
         { x: 694224000000.0, y: 42470 },
         { x: 725846400000.0, y: 38257 },
         { x: 757382400000.0, y: 34823 },
         { x: 788918400000.0, y: 32728 },
         { x: 820454400000.0, y: 30988 },
         { x: 852076800000.0, y: 29179 },
         { x: 883612800000.0, y: 27083 },
         { x: 915148800000.0, y: 25700 },
         { x: 946684800000.0, y: 24959 },
         { x: 978307200000.0, y: 23180 },
         { x: 1009843200000.0, y: 21731 },
         { x: 1041379200000.0, y: 20793 },
         { x: 1072915200000.0, y: 19739 },
         { x: 1104537600000.0, y: 19190 },
         { x: 1136073600000.0, y: 19674 },
         { x: 1167609600000.0, y: 19986 },
         { x: 1199145600000.0, y: 17771 },
       ],
     },
     // Additional data series...
   ];
   ```
   
   If the issue persists, consider checking for any updates or patches for Superset that might address this rendering issue <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-preset-chart-nvd3/Line/data.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug crossing lines in line/area chart [superset]

Posted by "osullivryan (via GitHub)" <gi...@apache.org>.
osullivryan commented on issue #29854:
URL: https://github.com/apache/superset/issues/29854#issuecomment-2635675019

   Hello, I am also experiencing the same with my data set. While I have a date within my query to return data in a specific range my x-axis is not temporal. This can make line plots a bit hard to follow with the discontinuity. I think an option to “continue” or even some interpolations would be great options. 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug crossing lines in line/area chart [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29854:
URL: https://github.com/apache/superset/issues/29854#issuecomment-2917294518

   No matter the data (or axis) type, if there are points along the X axis that are NOT present in one series but not others, any missing data points are treated as null. If you want to plot contiguous lines along the X axis where there are not data points, the Advanced Analytics section's "fill rule" is your friend... you can choose zero imputation, linear interpolation, etc., and get the lines you're looking for. 
   
   I'll close this one out as answered, but if there's more to be addressed here, holler and we can reopen!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug crossing lines in line/area chart [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #29854: Bug crossing lines in line/area chart
URL: https://github.com/apache/superset/issues/29854


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug crossing lines in line/area chart [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29854:
URL: https://github.com/apache/superset/issues/29854#issuecomment-2269486895

   I think dosu is on the right path here... in essence, the x axis is usually time, and we'd expect to see values for all series at each interval. In a case like that, we'd either assume the missing data point is either null and not draw it (like you see here) or you can use the Advanced Analytics to resample the data and enable 'zero imputation' to make the missing datapoints a zero. However, when using a numeric axis like this, I'm not sure we should make these same assumptions... it might make sense to just make all series contiguous lines like you're expecting. I'm sure there are use cases where people _won't_ want that behavior (i.e. if you're expecting a point for each series at each x axis tick) so maybe we'll need a "contiguous lines" checkbox or something.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org