Closed wraseman closed 6 years ago
I think I see what you're saying, but can you post a code example for each case just to be sure?
First off, we do have a ton to do still! So again, let's put this on the back burner for now. But yeah, hopefully this example clarifies things a bit.
Say we want to use the Parasol.aggregateScores() method right now, we would do something like this:
var ps = Parasol(data)('.parcoords')
.aggregateScores({ weights: weights });
// update charts
ps.charts.forEach(
(pc) => {
pc
.render()
.updateAxes(0)
}
Or using the new global implementation of Parcoords methods...
var ps = Parasol(data)('.parcoords')
.aggregateScores({ weights: weights });
.render()
.updateAxes(0)
}
It seems to me that only certain methods (e.g., Parasol.clustering(hidden=false), Parasol.aggregateScores(), Parasol.hideAxes(), Parasol.showAxes()) require .render() and .updatesAxes(), so shouldn't we just automatically call those rendering/update methods every time we call a method that changes the number of axes that are shown? That would be done in the JavaScript source code for the API. That way the user could just do this:
var ps = Parasol(data)('.parcoords')
.aggregateScores({ weights: weights }); // rendering and updating axes done within method
}
What you have for the final result is already the way it's setup. In scoring.html
we have,
var ps = Parasol(data)('.parcoords')
.aggregateScores({ weights: weights });
// update charts
ps.charts.forEach(
(pc) => {
pc
.hideAxis(['name'])
.reorderable()
.render()
.updateAxes(0)
}
)
but note that if you were to comment out the entire "update charts" section, it would still work. The purpose of that section is to remove the name
axis (requires updateAxes) and make the charts reorderable (requires render).
The same should be true for all features that edit the number of axes/dimensions, but I'll double check.
I see, thanks for clarifying
I could be mistaken, but it seems that we only need to render/update axes when the number of dimensions are changed. For example, I found that calling Parasol.cluster() did not require render() or updateAxes() but Parasol.aggregateScores() did.
This is low priority, I know we have a lot of other things to go through. I just figured it would be cleaner if the user didn't have to call render() and updateAxes() all the time. I also realized I don't quite understand when it is necessary.