After successfully implementing monitoring for changes in the dataview and mod properties in my D3 network chart mod on Spotfire, I found that everything is working really well. The simulation running in the D3 network chart only needs to restart when the actual data rendered changes. Is there a way to check within the dataView object for more detailed changes like axis expression changes for Color By or Size by column without rerunning the entire network simulation?
For example, updating the color or size of a node or applying markings to the network chart should not trigger the simulation restart. However, if there are changes in the data columns, then the network simulation should rerun.
An additional use case could involve updating the network only if a large amount of data has been filtered out after applying filtering.
Are there any methods in the API that can be used to check these more specific changes in the DataView passed into the reader?
This is how my reader is set up:
/**
* Create the read function.
*/
const reader = readerWithChangeChecker(
mod.createReader(
mod.visualization.data(),
mod.windowSize(),
mod.property("network_strength"),
mod.property("display_labels"),
mod.property("network_type"),
mod.property("apply_color")
)
);
I have an updateNetwork function in the async render function which subscribes to the reader. Then, some logic checks are passed to the updateNetwork chart function:
// check what has changed
let data_requires_update = false;
let simulation_requires_update = false;
let window_requires_update = false;
let rendering_requires_update = false;
if (reader.hasValueChanged(dataView)) {
data_requires_update = true;
simulation_requires_update = true;
}
if (
reader.hasValueChanged(network_strength) ||
reader.hasValueChanged(network_type)
) {
simulation_requires_update = true;
}
if (reader.hasValueChanged(windowSize)) {
window_requires_update = true;
}
if (
reader.hasValueChanged(display_labels) ||
reader.hasValueChanged(apply_color)
) {
rendering_requires_update = true;
}
// trigger loading network
updateNetwork(
data_requires_update,
simulation_requires_update,
window_requires_update,
rendering_requires_update
);
Is it possible to add more detail to the dataView check to detect axes changes, main data table changes, and filter events?