DataArray example

How do you import vtk.js? Because your code seems fine.

The only thing that is weird in your end goal below is the use of field while getCellData/getPointData/getFieldData that would dictate to which part of your mesh that field is supposed to be linked to. Also you can have only 1 scalar per Point/Cell. It might be better to just do AddArray and configure the mapper to select which one you want to see in case you have more than 1.

  polydata.getCellData().setScalars( vtkDataArray.newInstance({
     name: 'var1',
     field: FieldDataTypes.POINT
     values: Float32Array.from(valuesArray)
 }));