Setting new points
To display a new set of points in an already initialized visualization, re-create and set the new set of layers.
Lingo4G plugins handle the updates automatically.
If you use the Lingo4G plugin, the plugin
automatically
performs all the necessary updates when you set a new lingo4g:result value.
Assuming your code defines a method for creating layers, for example:
const createLayers = (points) => {
// Elevations layer.
const elevations = {
points: points.filter(p => p.elevation !== undefined),
type: "elevation"
};
// Point markers layer.
const markers = {
points: points.filter(p => p.markerSize !== undefined),
type: "marker",
markerSizeMultiplier: 10
};
// Labels layer.
const labels = {
points: points.filter(p => p.label !== undefined),
type: "label"
};
return { elevations, markers, labels };
}
you can redraw the visualization with new data by setting the layers
property to the newly created layers:
const { elevations, markers, labels } = createLayers(points);
dotatlas.set("layers", [
elevations,
markers,
labels
]);