I am developing a small app based on stackoverflow survey data for 2019. I am trying to show the Top 10 languages per Dev. Type and respected salary ranges. Dev. Type is a pie chart. I use row chart for top 10 languages and another row chart for the salary ranges. Additionally I have boxplot chart that shows the relation between compensation and job satisfaction. I included screenshots of the charts and I will try to explain the issue that I am facing. Sorry for the quality of the pictures. Windows snipping tool behaves funky when I attempt to take screenshot of charts. It does not show the additional on-screen element. Therefor I took picture of my charts with my phone camera instead.
For the record, respondents can have multiple DevTypes and LanguageWorkedWith as shown in single_document.png. I split them inside my js code and group them using reduceAdd and reduceRemove functions.
The original data has 80K+ datapoints and after some manipulation and cleaning I ended up having 50K+ data points. For the test purposes I worked with limited dataset that has only 1000 points. I have to mention that the data have no null values.
When the data first loaded everything looks fine. The function counts occurrence of DevType, LanguageWorkedWith and ConvertedComp (salary in USD) correctly. pie_fullstack.jpg shows that full-stack developer occured 534 times, meaning 534 out of 1000 people answered have full-stack as the language they worked with. After clicking on full-stack on pie chart the other charts adjusted accordingly but they show wrong counts. sixtyk_js.jpg shows that the top salary range for full-stack developer is 60k+ and when I hover the mouse over the that particular bar it shows that it is based on 29 people. If it worked properly the sum of counts of people in each salary range should be equal to 534. When I sum all the counts in each salary range it makes only 124.
Further I went ahead and hovered the mouse over JS in top 10 languages section. JS has 109 occurrences (picture top_10_JS.jpg). It is kind of strange that only 109 out of 534 full-stack developers know JS. I summed the number of occurrence of each language and got 599. Given that respondents can chose multiple languages and full-stack developers must be proficient in multiple languages, count 599 is only true if only 65 out of 534 developers know more than 1 languages, which is highly unlikely.
I then clicked JS and the rest of the charts recalculated and redrawn. When I checked salary range there is only one salary range and that is based on only one person (ninetyk_clicked.jpg). I expect it to have the same number as 109 (even though 109 is not correct either).
As I mentioned above when the data is loaded the first time and no chart was clicked all the values seem OK. When I start clicking it behaves funky I do not know how to fix this problem.
Hope someone has patience to read through this and help me:)
Thank you.