You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/11/02 14:18:27 UTC

[GitHub] [echarts] hughess commented on issue #15102: Bar stacking doesn't work if the x-axis is value type instead of category type

hughess commented on issue #15102:
URL: https://github.com/apache/echarts/issues/15102#issuecomment-957677200


   +1 for needing stacking on a value axis. 
   
   Biggest problem for me with this is missing values - there may be parts of your x-axis where none of your series have any observations. It's a pain to have to iterate through the dataset and prepare it so that it shows missing data.
   
   For example:
   ```javascript
   series1 = [
      [3, 10],
      [4, 13],
      [5, 16],
      [8, 21]
   ]
   
   series2 = [
      [3, 15],
      [4, 17],
      [5, 21],
      [8, 23]
   ]
   ```
   
   Using a `category` axis with this data won't show 6 or 7 on the axis. Using `value` would work if stacking was possible.
   
   The current workaround for this would be to iterate through each of these series, see which x values are missing, and recreate the data so that 6 and 7 are included as rows in each dataset. 
   
   One approach that might work is to treat this situation in the same way as a histogram:
   - Assume a default interval based on the data provided to the chart (e.g., if it's years or integers, interval = 1. If it's a continuous variable, have some default logic to assume an interval)
   - Bin the data using the interval
   - Plot the data, effectively treating the x-axis as a category axis
   - You could probably even explicitly treat the axis as category - at least for me, I don't care if the axis is value or category. I would just prefer not to have to write the code to check/fill values for each chart I build


-- 
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: commits-unsubscribe@echarts.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org