8000 Optimize performance of setCategoryIndex by hy9be · Pull Request #1544 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Optimize performance of setCategoryIndex #1544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 10, 2017
Merged
Prev Previous commit
Next Next commit
Build the lookup map for initialized categories
  • Loading branch information
hy9be authored Apr 3, 2017
commit b3fb03d45b8b46fb81e0e7c6e8530d50d8f1f83e
7 changes: 7 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,13 @@ plots.doCalcdata = function(gd, traces) {
// to be filled in later by ax.d2c
for(i = 0; i < axList.length; i++) {
axList[i]._categories = axList[i]._initialCategories.slice();

//Build the lookup map for initialized categories
axList[i]._categoriesMap = {};
for (var j = 0; j < axList[i]._categories.length; j++) {
axList[i]._categoriesMap[axList[i]._categories[j]] = j;
}

if(axList[i].type === 'category') hasCategoryAxis = true;
}

Expand Down
0