Skip to content

Commit c23ce10

Browse files
committed
Make two graphs close
1 parent d78672a commit c23ce10

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

core/src/main/resources/org/apache/spark/ui/static/streaming-page.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@
4444
.bar rect:hover {
4545
fill: orange;
4646
}
47+
48+
.timeline {
49+
width: 500px;
50+
}
51+
52+
.distribution {
53+
width: 300px;
54+
}

core/src/main/resources/org/apache/spark/ui/static/streaming-page.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,16 @@ function hideGraphTooltip() {
5050
* @param unitY the unit of Y axis
5151
*/
5252
function drawTimeline(id, data, minX, maxX, minY, maxY, unitY) {
53-
var margin = {top: 20, right: 30, bottom: 30, left: 50};
53+
d3.select(d3.select(id).node().parentNode).style("padding", "8px 0 8px 8px").style("border-right", "0px solid white");
54+
var margin = {top: 20, right: 27, bottom: 30, left: 50};
5455
var width = 500 - margin.left - margin.right;
5556
var height = 150 - margin.top - margin.bottom;
5657

5758
var x = d3.time.scale().domain([minX, maxX]).range([0, width]);
5859
var y = d3.scale.linear().domain([minY, maxY]).range([height, 0]);
5960

6061
var timeFormat = d3.time.format("%H:%M:%S")
61-
var xAxis = d3.svg.axis().scale(x).orient("bottom").ticks(10)
62-
.tickFormat(function(d) {
63-
if (d.getTime() == minX || d.getTime() == maxX) {
64-
return timeFormat(d);
65-
} else {
66-
return "x";
67-
}
68-
});
62+
var xAxis = d3.svg.axis().scale(x).orient("bottom").tickFormat(timeFormat);
6963
var yAxis = d3.svg.axis().scale(y).orient("left").ticks(5);
7064

7165
var line = d3.svg.line()
@@ -136,7 +130,8 @@ function drawTimeline(id, data, minX, maxX, minY, maxY, unitY) {
136130
* @param unitY the unit of Y axis
137131
*/
138132
function drawDistribution(id, values, minY, maxY, unitY) {
139-
var margin = {top: 20, right: 30, bottom: 30, left: 50};
133+
d3.select(d3.select(id).node().parentNode).style("padding", "8px 8px 8px 0").style("border-left", "0px solid white");
134+
var margin = {top: 20, right: 30, bottom: 30, left: 10};
140135
var width = 300 - margin.left - margin.right;
141136
var height = 150 - margin.top - margin.bottom;
142137

@@ -152,7 +147,7 @@ function drawDistribution(id, values, minY, maxY, unitY) {
152147
.range([0, width]);
153148

154149
var xAxis = d3.svg.axis().scale(x).orient("bottom").ticks(5);
155-
var yAxis = d3.svg.axis().scale(y).orient("left").ticks(5);
150+
var yAxis = d3.svg.axis().scale(y).orient("left").ticks(0).tickFormat(function(d) { return ""; });
156151

157152
var svg = d3.select(id).append("svg")
158153
.attr("width", width + margin.left + margin.right)

streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ private[ui] class StreamingPage(parent: StreamingTab)
260260
</div>
261261
<div>Avg: {eventRateForAllReceivers.avg.map(_.formatted("%.2f")).getOrElse(emptyCell)} events/sec</div>
262262
</td>
263-
<td>{timelineDataForEventRateOfAllReceivers}</td>
264-
<td>{distributionDataForEventRateOfAllReceivers}</td>
263+
<td class="timeline">{timelineDataForEventRateOfAllReceivers}</td>
264+
<td class="distribution">{distributionDataForEventRateOfAllReceivers}</td>
265265
</tr>
266266
<tr id="inputs-table" style="display: none;" >
267267
<td colspan="3">
@@ -273,24 +273,24 @@ private[ui] class StreamingPage(parent: StreamingTab)
273273
<div><strong>Scheduling Delay</strong></div>
274274
<div>Avg: {formatDurationOption(schedulingDelay.avg)}</div>
275275
</td>
276-
<td>{timelineDataForSchedulingDelay}</td>
277-
<td>{distributionDataForSchedulingDelay}</td>
276+
<td class="timeline">{timelineDataForSchedulingDelay}</td>
277+
<td class="distribution">{distributionDataForSchedulingDelay}</td>
278278
</tr>
279279
<tr>
280280
<td style="vertical-align: middle;">
281281
<div><strong>Processing Time</strong></div>
282282
<div>Avg: {formatDurationOption(processingTime.avg)}</div>
283283
</td>
284-
<td>{timelineDataForProcessingTime}</td>
285-
<td>{distributionDataForProcessingTime}</td>
284+
<td class="timeline">{timelineDataForProcessingTime}</td>
285+
<td class="distribution">{distributionDataForProcessingTime}</td>
286286
</tr>
287287
<tr>
288288
<td style="vertical-align: middle;">
289289
<div><strong>Total Delay</strong></div>
290290
<div>Avg: {formatDurationOption(totalDelay.avg)}</div>
291291
</td>
292-
<td>{timelineDataForTotalDelay}</td>
293-
<td>{distributionDataForTotalDelay}</td>
292+
<td class="timeline">{timelineDataForTotalDelay}</td>
293+
<td class="distribution">{distributionDataForTotalDelay}</td>
294294
</tr>
295295
</tbody>
296296
</table>
@@ -313,9 +313,9 @@ private[ui] class StreamingPage(parent: StreamingTab)
313313
<thead>
314314
<tr>
315315
<th></th>
316-
<th>Status</th>
317-
<th>Location</th>
318-
<th>Last Error Time</th>
316+
<th style="width: 166.7px; padding: 8px 0 8px 0"><div style="margin: 0 8px 0 8px">Status</div></th>
317+
<th style="width: 166.7px; padding: 8px 0 8px 0"><div style="margin: 0 8px 0 8px">Location</div></th>
318+
<th style="width: 166.7px; padding: 8px 0 8px 0"><div style="margin: 0 8px 0 8px">Last Error Time</div></th>
319319
<th>Last Error Message</th>
320320
</tr>
321321
</thead>
@@ -380,10 +380,10 @@ private[ui] class StreamingPage(parent: StreamingTab)
380380
<td>{receiverLastError}</td>
381381
</tr>
382382
<tr>
383-
<td colspan="3">
383+
<td colspan="3" class="timeline">
384384
{timelineForEventRate}
385385
</td>
386-
<td>{distributionForEventsRate}</td>
386+
<td class="distribution">{distributionForEventsRate}</td>
387387
</tr>
388388
// scalastyle:on
389389
}

0 commit comments

Comments
 (0)