tensorflow.jsvega-lite

TypeError: set[i].test is not a function when using 'tfvis.render.linechart'


I tried to use @tensorflow/tfjs-vis to draw charts in my React project. But I always get this error, even the example from the main site:

Uncaught (in promise) TypeError: set[i].test is not a function

my code is:

const series1 = Array(100).fill(0)
  .map(y => Math.random() * 100 - (Math.random() * 50))
  .map((y, x) => ({ x, y }));

const series2 = Array(100).fill(0)
  .map(y => Math.random() * 100 - (Math.random() * 150))
  .map((y, x) => ({ x, y }));

const series = ['First', 'Second'];
const data = { values: [series1, series2], series }

const surface = { name: 'Line chart', tab: 'Charts' };
tfvis.render.linechart(surface, data);

It seems this error happened in vega-lite. I have no idea how to fix it, can anyone give me a hint?

I'm using @tensorflow/tfjs-vis/1.5.1

I want to use tfjs-vis to draw charts without error.


Solution

  • I fixed it by downgrading @tensorflow/tfjs-vis to 1.1.0