|
| 1 | +/* global Highcharts */ |
| 2 | + |
1 | 3 | import { Colors } from './colors';
|
2 | 4 | import debounce from './debounce';
|
3 | 5 | import { Metric } from './metric';
|
@@ -38,13 +40,13 @@ function drawClientSummary(data, options, client) {
|
38 | 40 | }
|
39 | 41 |
|
40 | 42 | function getSummary(data, options) {
|
41 |
| - const summary = getPrimaryMetric(data, options); |
| 43 | + const summary = getPrimaryMetric(data); |
42 | 44 | const metric = new Metric(options, summary);
|
43 | 45 |
|
44 | 46 | return metric.toString();
|
45 | 47 | }
|
46 | 48 |
|
47 |
| -function getPrimaryMetric(data, options) { |
| 49 | +function getPrimaryMetric(data) { |
48 | 50 | data = data.filter(o => +o.cdf > 0.5);
|
49 | 51 | if (!data.length) {
|
50 | 52 | return '?';
|
@@ -110,12 +112,13 @@ class Bin {
|
110 | 112 | format(property) {
|
111 | 113 | switch(property) {
|
112 | 114 | case 'pdf':
|
113 |
| - case 'cdf': |
| 115 | + case 'cdf': { |
114 | 116 | let value = (Math.floor(this[property] * 10000) / 100).toFixed(2);
|
115 | 117 | if (value < 10) {
|
116 | 118 | value = '0' + value;
|
117 | 119 | }
|
118 | 120 | return value + '%';
|
| 121 | + } |
119 | 122 | case 'volume':
|
120 | 123 | return this[property].toLocaleString();
|
121 | 124 | default:
|
@@ -265,8 +268,8 @@ function drawHistogram(data, containerId, options) {
|
265 | 268 | const chart = document.getElementById(`${options.metric}-chart`);
|
266 | 269 | callOnceWhenVisible(chart, () => {
|
267 | 270 | drawChart(series, containerId, options);
|
268 |
| - }); |
269 |
| -}; |
| 271 | + }) |
| 272 | +} |
270 | 273 |
|
271 | 274 | function drawChart(series, containerId, options) {
|
272 | 275 | const chart = Highcharts.chart(containerId, {
|
@@ -326,7 +329,7 @@ function drawChart(series, containerId, options) {
|
326 | 329 | borderColor: 'rgba(247,247,247,0.85)',
|
327 | 330 | formatter: function() {
|
328 | 331 | const metric = new Metric(options, Math.round(this.points[0].x * 100) / 100);
|
329 |
| - const tooltips = this.points.filter(p => !p.series.name.includes('CDF')).map((point, points) => { |
| 332 | + const tooltips = this.points.filter(p => !p.series.name.includes('CDF')).map((point) => { |
330 | 333 | const cdf = this.points.find(p => p.series.name == `${point.series.name} CDF`);
|
331 | 334 | return `<td>
|
332 | 335 | <p style="text-transform: uppercase; font-size: 10px;">
|
|
0 commit comments