mayfield commented on issue #19814:
URL: https://github.com/apache/echarts/issues/19814#issuecomment-2050576828

   Not a solution but I'm going to use this monkey patch to workaround the 
issue in my project until this gets a proper fix/release...
   
   ```javascript
   function monkeyPatchEchartsDownsampling(eChartsModule) {
       const dummy = eChartsModule.init(document.createElement('div'));
       dummy.setOption({xAxis: {}, yAxis: {}, series: {type: 'line'}});
       const model = dummy.getModel();
       const DataStore = 
model.getSeriesByIndex(0).getData().getStore().constructor;
       DataStore.prototype.indexOfRawIndex = function(rawIndex) {
           if (rawIndex >= this._rawCount || rawIndex < 0) {
               return -1;
           }
           if (!this._indices) {
               return rawIndex;
           }
           const indices = this._indices;
           const rawDataIndex = indices[rawIndex];
           if (rawDataIndex != null && rawDataIndex < this._count && 
rawDataIndex === rawIndex) {
               return rawIndex;
           }
           let left = 0;
           let right = this._count - 1;
           let mid = -1;
           while (left <= right) {
               mid = (left + right) / 2 | 0;
               if (indices[mid] < rawIndex) {
                   left = mid + 1;
               } else if (indices[mid] > rawIndex) {
                   right = mid - 1;
               } else {
                   return mid;
               }
           }
           return mid;
       };
   }
   ```
   
   The function is a copy/paste of `indexOfRawIndex` but with the final bailout 
return value being the closet `mid` value instead of `-1`.


-- 
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