Code for specifying the number of page turns:

echart.dispatchAction({
     type: "legendScroll".// dispatchAction will not trigger page-turning
     scrollDataIndex: 5.// Specify five pages to turn
})

// Note: Echart is an example
Copy the code

However, if I need to use the native page turn button to operate, I will have the following problems:

echart.on("legendscroll".params= > {
          // Prevent bubbling
          event.stopPropagation();
          // Scroll event dispatch --(note this is an infinite loop)
          echart.dispatchAction({
            type: "legendScroll".Params. type is an all-lowercase event name and cannot be sent successfully
            scrollDataIndex: params.scrollDataIndex + 1.// Currently, I have 5 entries per page, while the scrollDataIndex page is only 4 entries, which is a Bug of Echart.
            legendId: params.legendId
          });
 });


// Note: Prevent bubbling because the scroll page is a scroll page event. My echart has a page jump event wrapped around it, so I need to prevent bubbling.
Copy the code

This code is an infinite loop because dispatchAction activates the LEGENdScroll event that JS’s ON listens for.

Because the last data of the previous page will be retained when the chart page is turned, the requirement I received is that the last data of the previous page is not needed. It cannot be solved for the time being.