cheshire137 / competiwatch

Web app to track and visualize your competitive match history in Overwatch.
MIT License
17 stars 4 forks source link

Wins/Losses by Group Member Trend Graph Off-by-One #31

Closed pseudobeard closed 6 years ago

pseudobeard commented 6 years ago

When looking at https://competiwatch.herokuapp.com/trends/9/ATastySnack-1553, I noticed that the wins/losses by group member graph was off by one. It is showing each bar as 1 less than the actual value.

pseudobeard commented 6 years ago

<canvas class="js-win-loss-bar-chart chartjs-render-monitor" data-labels="[&quot;Jamie&quot;,&quot;Rob&quot;,&quot;Siege&quot;,&quot;Zion&quot;]" data-wins="[4,5,5,7]" data-losses="[2,1,1,2]" data-draws="[1,1,1,1]" width="487" height="300" style="display: block; width: 487px; height: 300px;"></canvas>

Relevant source. Looks like because there are no elements with "0", the graph axis scales from min to max. Probably need to force the axis to start at 0 here.

cheshire137 commented 6 years ago

Thanks for the report! I'm going to temporarily make your ATastySnack season 9 publicly visible so I can see the graph.

cheshire137 commented 6 years ago

Here's the chart in question:

atastysnack_1553___season_9___trends_-_competiwatch
cheshire137 commented 6 years ago

I deployed a fix. Turns out Chart.js, the charting library I'm using, has an option to force an axis scale to start at 0, so I used that. Here's the chart now:

atastysnack_1553___season_9___trends_-_competiwatch
pseudobeard commented 6 years ago

Looks much better! Thanks!