Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/ScatterplotPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,30 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) :
});
}
else {

// Use the clusters set for points color
dropRegions << new DropWidget::DropRegion(this, "Color", description, "palette", true, [this, candidateDataset]() {
_settingsAction.getColoringAction().addColorDataset(candidateDataset);
_settingsAction.getColoringAction().setCurrentColorDataset(candidateDataset);
});
if (candidateDataset.isValid())
{
// Check to set whether the number of data points comprised throughout all clusters is the same number
// as the number of data points in the dataset we are trying to color
int totalNumIndices = 0;
for (const Cluster& cluster : candidateDataset->getClusters())
{
totalNumIndices += cluster.getIndices().size();
}

if (totalNumIndices == _positionDataset->getNumPoints())
{
// Use the clusters set for points color
dropRegions << new DropWidget::DropRegion(this, "Color", description, "palette", true, [this, candidateDataset]() {
_settingsAction.getColoringAction().addColorDataset(candidateDataset);
_settingsAction.getColoringAction().setCurrentColorDataset(candidateDataset);
});
}
else
{
// Number of indices in clusters doesn't match point dataset
dropRegions << new DropWidget::DropRegion(this, "Incompatible data", "Cluster data does not match number of data points", "exclamation-circle", false);
}
}
}
}
else {
Expand Down
Loading