Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix engagements on stat charts.
  • Loading branch information
nickelsen committed Apr 20, 2016
commit 25d1704f2c435dc3486de55174ce917cd6b12878
8 changes: 6 additions & 2 deletions app/assets/javascripts/angular/directives/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ gg.directive('chart', ['$compile', function($compile) {

if (scope.$parent.match.engagements) {
options.xAxis.plotBands = [];
speed_multiplier = 1;
if (scope.$parent.match.expansion_tag == 'LotV') {
speed_multiplier = 1.4;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sc2.LOTV_SPEEDUP ?

_.each(scope.$parent.match.engagements, function(engagement) {
options.xAxis.plotBands.push({
color: 'rgba(150, 50, 50, 0.10)',
from: engagement[0] / 960.0,
to: engagement[1] / 960.0,
from: engagement[0] / 960.0 / speed_multiplier,
to: engagement[1] / 960.0 / speed_multiplier,
zIndex: 10
});
});
Expand Down
11 changes: 8 additions & 3 deletions app/assets/javascripts/angular/directives/macrochart.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ gg.directive('macrochart', [function() {

};

speed_multiplier = 1;
if (scope.$parent.match.expansion_tag == 'LotV') {
speed_multiplier = 1.4;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sc2.LOTV_SPEEDUP ?


if (scope.$parent.match.engagements) {
options.yAxis.plotBands = [];
_.each(scope.$parent.match.engagements, function(engagement) {
options.yAxis.plotBands.push({
color: 'rgba(150, 50, 50, 0.1)',
from: engagement[0] / 960.0,
to: engagement[1] / 960.0,
from: engagement[0] / 960.0 / speed_multiplier,
to: engagement[1] / 960.0 / speed_multiplier,
zIndex: 10
});
});
Expand All @@ -105,7 +110,7 @@ gg.directive('macrochart', [function() {
for (i=0; i<hatches.length; i++) {
times = hatches[i].times;
for (inj=0; inj<times.length; inj++) {
hatchdata.push([i, times[inj] / (16.0 * 60.0), (times[inj] + 16 * 40)/(16.0 * 60.0)])
hatchdata.push([i, times[inj] / (16.0 * 60.0 * speed_multiplier), (times[inj] + 16 * 40)/(16.0 * 60.0 * speed_multiplier)])
}
}
scope.chart.addSeries({
Expand Down
13 changes: 9 additions & 4 deletions app/assets/javascripts/angular/directives/protosschart.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ gg.directive('protosschart', [function() {

macro = scope.match.pmacro;

speed_multiplier = 1;
if (scope.$parent.match.expansion_tag == 'LotV') {
speed_multiplier = 1.4;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use Sc2.LOTV_SPEEDUP here ?


nametoshow = scope.$parent.entity.identity.name;
idtoshow = scope.$parent.entity.identity.id;
nexus_stats = macro[idtoshow];
Expand All @@ -85,7 +90,7 @@ gg.directive('protosschart', [function() {
maxout_blob = nexus_stats[basenum][1];
for (j=0; j<maxout_blob.length; j++) {
maxout = maxout_blob[j]
maxouts.push([basenum, maxout[0] / (16.0 * 60.0), maxout[1] / (16.0 * 60.0)])
maxouts.push([basenum, maxout[0] / (16.0 * 60.0 * speed_multiplier), maxout[1] / (16.0 * 60.0 * speed_multiplier)])
}
}

Expand All @@ -101,8 +106,8 @@ gg.directive('protosschart', [function() {
_.each(scope.$parent.match.engagements, function(engagement) {
options.yAxis.plotBands.push({
color: 'rgba(150, 50, 50, 0.1)',
from: engagement[0] / 960.0,
to: engagement[1] / 960.0,
from: engagement[0] / 960.0 / speed_multiplier,
to: engagement[1] / 960.0 / speed_multiplier,
zIndex: 10
});
});
Expand All @@ -113,7 +118,7 @@ gg.directive('protosschart', [function() {
for (basenum=0; basenum<numbases; basenum++) {
chrono_blob = nexus_stats[basenum][0];
for (chrono=0; chrono<chrono_blob.length; chrono++) {
chronoboosts.push([basenum, chrono_blob[chrono] / (16.0 * 60.0)]);
chronoboosts.push([basenum, chrono_blob[chrono] / (16.0 * 60.0 * speed_multiplier)]);
}
}

Expand Down
13 changes: 9 additions & 4 deletions app/assets/javascripts/angular/directives/terranchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ gg.directive('terranchart', [function() {

macro = scope.match.tmacro;

speed_multiplier = 1;
if (scope.$parent.match.expansion_tag == 'LotV') {
speed_multiplier = 1.4;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use Sc2.LOTV_SPEEDUP here?


nametoshow = scope.$parent.entity.identity.name;
idtoshow = scope.$parent.entity.identity.id;
base_stats = macro[idtoshow];
Expand All @@ -85,7 +90,7 @@ gg.directive('terranchart', [function() {
maxout_blob = base_stats[basenum][3];
for (j=0; j<maxout_blob.length; j++) {
maxout = maxout_blob[j]
maxouts.push([basenum, maxout[0] / (16.0 * 60.0), maxout[1] / (16.0 * 60.0)])
maxouts.push([basenum, maxout[0] / (16.0 * 60.0 * speed_multiplier), maxout[1] / (16.0 * 60.0 * speed_multiplier)])
}
}

Expand All @@ -103,7 +108,7 @@ gg.directive('terranchart', [function() {
for (basenum=0; basenum<numbases; basenum++) {
ability_blob = base_stats[basenum][i];
for (abilnum=0; abilnum<ability_blob.length; abilnum++) {
abilities.push([basenum, ability_blob[abilnum] / (16.0 * 60.0)]);
abilities.push([basenum, ability_blob[abilnum] / (16.0 * 60.0 * speed_multiplier)]);
}
}

Expand Down Expand Up @@ -133,8 +138,8 @@ gg.directive('terranchart', [function() {
_.each(scope.$parent.match.engagements, function(engagement) {
options.yAxis.plotBands.push({
color: 'rgba(150, 50, 50, 0.1)',
from: engagement[0] / 960.0,
to: engagement[1] / 960.0,
from: engagement[0] / 960.0 / speed_multiplier,
to: engagement[1] / 960.0 / speed_multiplier,
zIndex: 10
});
});
Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/angular/resources/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,11 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
// don't graph the last base-time; its y-value is zero by definition
_bases_x.pop();

_bases_x_minutes = _.map(_bases_x, function(_frame_x) { return _frame_x / 960.0 });
speed_multiplier = 1.0;
if (this.expansion_tag == 'LotV') {
speed_multiplier = Sc2.LOTV_SPEEDUP;
}
_bases_x_minutes = _.map(_bases_x, function(_frame_x) { return _frame_x / 960.0 / speed_multiplier });

_series_y = [];
_.each(_bases_x, function(_x) {
Expand Down