Changeset 212935 in webkit
- Timestamp:
- Feb 23, 2017 7:12:37 PM (7 years ago)
- Location:
- trunk/Websites/perf.webkit.org
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/perf.webkit.org/ChangeLog
r212923 r212935 1 2017-02-23 Ryosuke Niwa <rniwa@webkit.org> 2 3 REGRESSION(r212542): Make TimeSeriesChart.computeTimeGrid stops x-axis grid prematurely 4 https://bugs.webkit.org/show_bug.cgi?id=168812 5 6 Reviewed by Joseph Pecoraro. 7 8 Add time iterator of two months, three months, and four months with some tests. 9 10 Also for one-month time iterator, round the day of month to 1 or 15 whichever is closer. 11 12 * browser-tests/time-series-chart-tests.js: Added more tests. 13 * public/v3/components/time-series-chart.js: 14 (TimeSeriesChart._timeIterators.next): 15 (TimeSeriesChart._timeIterators): 16 1 17 2017-02-22 Ryosuke Niwa <rniwa@webkit.org> 2 18 -
trunk/Websites/perf.webkit.org/browser-tests/time-series-chart-tests.js
r212923 r212935 307 307 }); 308 308 }); 309 310 it('should generate seven one-month labels for six and half months interval starting before 15th when maxLabels is 7', () => { 311 return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart').then((TimeSeriesChart) => { 312 const endTime = new Date('2017-01-15T18:53:00Z'); 313 const labels = TimeSeriesChart.computeTimeGrid(new Date('2016-07-12T18:53:00Z'), new Date('2017-01-18T08:17:53Z'), 7); 314 expect(labels).to.be.a('array'); 315 expect(labels.length).to.be(7); 316 checkGridItem(labels[0], '7/15', '2016-07-15T00:00:00Z'); 317 checkGridItem(labels[1], '8/15', '2016-08-15T00:00:00Z'); 318 checkGridItem(labels[2], '9/15', '2016-09-15T00:00:00Z'); 319 checkGridItem(labels[3], '10/15', '2016-10-15T00:00:00Z'); 320 checkGridItem(labels[4], '11/15', '2016-11-15T00:00:00Z'); 321 checkGridItem(labels[5], '12/15', '2016-12-15T00:00:00Z'); 322 checkGridItem(labels[6], '1/15', '2017-01-15T00:00:00Z'); 323 }); 324 }); 325 326 it('should generate seven one-month labels for six months interval staring after 15th when maxLabels is 7', () => { 327 return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart').then((TimeSeriesChart) => { 328 const endTime = new Date('2017-01-15T18:53:00Z'); 329 const labels = TimeSeriesChart.computeTimeGrid(new Date('2016-07-18T18:53:00Z'), new Date('2017-01-18T08:17:53Z'), 7); 330 expect(labels).to.be.a('array'); 331 expect(labels.length).to.be(6); 332 checkGridItem(labels[0], '8/1', '2016-08-01T00:00:00Z'); 333 checkGridItem(labels[1], '9/1', '2016-09-01T00:00:00Z'); 334 checkGridItem(labels[2], '10/1', '2016-10-01T00:00:00Z'); 335 checkGridItem(labels[3], '11/1', '2016-11-01T00:00:00Z'); 336 checkGridItem(labels[4], '12/1', '2016-12-01T00:00:00Z'); 337 }); 338 }); 339 340 it('should generate six two-months labels for one year interval when maxLabels is 7', () => { 341 return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart').then((TimeSeriesChart) => { 342 const endTime = new Date('2017-01-15T18:53:00Z'); 343 const labels = TimeSeriesChart.computeTimeGrid(new Date('2016-07-11T18:53:00Z'), new Date('2017-07-27T08:17:53Z'), 7); 344 expect(labels).to.be.a('array'); 345 expect(labels.length).to.be(6); 346 checkGridItem(labels[0], '9/1', '2016-09-01T00:00:00Z'); 347 checkGridItem(labels[1], '11/1', '2016-11-01T00:00:00Z'); 348 checkGridItem(labels[2], '1/1', '2017-01-01T00:00:00Z'); 349 checkGridItem(labels[3], '3/1', '2017-03-01T00:00:00Z'); 350 checkGridItem(labels[4], '5/1', '2017-05-01T00:00:00Z'); 351 checkGridItem(labels[5], '7/1', '2017-07-01T00:00:00Z'); 352 }); 353 }); 354 355 it('should generate four three-months labels for one year interval when maxLabels is 5', () => { 356 return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart').then((TimeSeriesChart) => { 357 const endTime = new Date('2017-01-15T18:53:00Z'); 358 const labels = TimeSeriesChart.computeTimeGrid(new Date('2016-07-11T18:53:00Z'), new Date('2017-07-27T08:17:53Z'), 5); 359 expect(labels).to.be.a('array'); 360 expect(labels.length).to.be(4); 361 checkGridItem(labels[0], '10/1', '2016-10-01T00:00:00Z'); 362 checkGridItem(labels[1], '1/1', '2017-01-01T00:00:00Z'); 363 checkGridItem(labels[2], '4/1', '2017-04-01T00:00:00Z'); 364 checkGridItem(labels[3], '7/1', '2017-07-01T00:00:00Z'); 365 }); 366 }); 309 367 }); 310 368 -
trunk/Websites/perf.webkit.org/public/v3/components/time-series-chart.js
r212923 r212935 620 620 let previousDate = null; 621 621 let previousMonth = null; 622 while (currentTime <= max && result.length < maxLabels) {622 while (currentTime <= max) { 623 623 const time = new Date(currentTime); 624 624 const month = time.getUTCMonth() + 1; … … 714 714 next: function (date) { 715 715 date.setUTCHours(0); 716 date.setUTCMonth(date.getUTCMonth() + 1); 716 const dayOfMonth = date.getUTCDate(); 717 if (dayOfMonth > 1 && dayOfMonth < 15) 718 date.setUTCDate(15); 719 else { 720 if (dayOfMonth != 15) 721 date.setUTCDate(1); 722 date.setUTCMonth(date.getUTCMonth() + 1); 723 } 724 } 725 }, 726 { 727 diff: 60 * DAY, 728 next: function (date) { 729 date.setUTCHours(0); 730 date.setUTCDate(1); 731 date.setUTCMonth(date.getUTCMonth() + 2); 732 } 733 }, 734 { 735 diff: 90 * DAY, 736 next: function (date) { 737 date.setUTCHours(0); 738 date.setUTCDate(1); 739 date.setUTCMonth(date.getUTCMonth() + 3); 740 } 741 }, 742 { 743 diff: 120 * DAY, 744 next: function (date) { 745 date.setUTCHours(0); 746 date.setUTCDate(1); 747 date.setUTCMonth(date.getUTCMonth() + 4); 717 748 } 718 749 },
Note: See TracChangeset
for help on using the changeset viewer.