Search code examples
javascripttypescriptecharts

How to draw a bump chart from non random data?


The example ECharts provides for bump charts partly uses randomly generated data. For people new to JS or TS, it makes the code completely cryptic. How would the code look like without data generation?


Solution

  • You could replace the generateRankingData function with something like

    const generateRankingData = () => {
      const map = new Map();
      map.set("Series 1", [1,2,3,4,5,6]);
      map.set("Series 2", [2,3,4,5,6,7]);
      return map;
    };
    

    That removes the requirement for the shuffle function so you could delete that too.