Skip to content

Commit 1173483

Browse files
BenFradettdas
authored andcommitted
[SPARK-8399] [STREAMING] [WEB UI] Overlap between histograms and axis' name in Spark Streaming UI
Moved where the X axis' name (#batches) is written in histograms in the spark streaming web ui so the histograms and the axis' name do not overlap. Author: BenFradet <[email protected]> Closes apache#6845 from BenFradet/SPARK-8399 and squashes the following commits: b63695f [BenFradet] adjusted inner histograms eb610ee [BenFradet] readjusted #batches on the x axis dd46f98 [BenFradet] aligned all unit labels and ticks 0564b62 [BenFradet] readjusted #batches placement edd0936 [BenFradet] moved where the X axis' name (#batches) is written in histograms in the spark streaming web ui
1 parent 31f48e5 commit 1173483

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ var maxXForHistogram = 0;
3131
var histogramBinCount = 10;
3232
var yValueFormat = d3.format(",.2f");
3333

34+
var unitLabelYOffset = -10;
35+
3436
// Show a tooltip "text" for "node"
3537
function showBootstrapTooltip(node, text) {
3638
$(node).tooltip({title: text, trigger: "manual", container: "body"});
@@ -133,7 +135,7 @@ function drawTimeline(id, data, minX, maxX, minY, maxY, unitY, batchInterval) {
133135
.attr("class", "y axis")
134136
.call(yAxis)
135137
.append("text")
136-
.attr("transform", "translate(0," + (-3) + ")")
138+
.attr("transform", "translate(0," + unitLabelYOffset + ")")
137139
.text(unitY);
138140

139141

@@ -223,10 +225,10 @@ function drawHistogram(id, values, minY, maxY, unitY, batchInterval) {
223225
.style("border-left", "0px solid white");
224226

225227
var margin = {top: 20, right: 30, bottom: 30, left: 10};
226-
var width = 300 - margin.left - margin.right;
228+
var width = 350 - margin.left - margin.right;
227229
var height = 150 - margin.top - margin.bottom;
228230

229-
var x = d3.scale.linear().domain([0, maxXForHistogram]).range([0, width]);
231+
var x = d3.scale.linear().domain([0, maxXForHistogram]).range([0, width - 50]);
230232
var y = d3.scale.linear().domain([minY, maxY]).range([height, 0]);
231233

232234
var xAxis = d3.svg.axis().scale(x).orient("top").ticks(5);
@@ -248,7 +250,7 @@ function drawHistogram(id, values, minY, maxY, unitY, batchInterval) {
248250
.attr("class", "x axis")
249251
.call(xAxis)
250252
.append("text")
251-
.attr("transform", "translate(" + (margin.left + width - 40) + ", 15)")
253+
.attr("transform", "translate(" + (margin.left + width - 45) + ", " + unitLabelYOffset + ")")
252254
.text("#batches");
253255

254256
svg.append("g")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
310310
<tr>
311311
<th style="width: 160px;"></th>
312312
<th style="width: 492px;">Timelines (Last {batchTimes.length} batches, {numActiveBatches} active, {numCompletedBatches} completed)</th>
313-
<th style="width: 300px;">Histograms</th></tr>
313+
<th style="width: 350px;">Histograms</th></tr>
314314
</thead>
315315
<tbody>
316316
<tr>
@@ -456,7 +456,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
456456
<td>{receiverActive}</td>
457457
<td>{receiverLocation}</td>
458458
<td>{receiverLastErrorTime}</td>
459-
<td><div style="width: 292px;">{receiverLastError}</div></td>
459+
<td><div style="width: 342px;">{receiverLastError}</div></td>
460460
</tr>
461461
<tr>
462462
<td colspan="3" class="timeline">

0 commit comments

Comments
 (0)