Skip to content

Commit 65176c7

Browse files
committed
mirrors: port to d3.js 4.13.0
1 parent d5d7a84 commit 65176c7

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

mirrors/static/mirror_status.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function draw_graphs(location_url, log_url, container_id) {
1111
log_data = data[1].value;
1212

1313
/* use the same color selection for a given URL in every graph */
14-
const color = d3.scale.category10();
14+
const color = d3.scaleOrdinal(d3.schemeCategory10);
1515

1616
for (const [_key, value] of Object.entries(loc_data.locations)) {
1717
mirror_status(container_id, value, log_data, color);
@@ -28,10 +28,10 @@ function mirror_status(container_id, check_loc, log_data, color) {
2828
const width = rects.width - margin.left - margin.right;
2929
const height = rects.height - margin.top - margin.bottom;
3030

31-
const x = d3.time.scale.utc().range([0, width]);
32-
const y = d3.scale.linear().range([height, 0]);
33-
const x_axis = d3.svg.axis().scale(x).orient("bottom");
34-
const y_axis = d3.svg.axis().scale(y).orient("left");
31+
const x = d3.scaleUtc().range([0, width]);
32+
const y = d3.scaleLinear().range([height, 0]);
33+
const x_axis = d3.axisBottom(x);
34+
const y_axis = d3.axisLeft(y);
3535

3636
/* remove any existing graph first if we are redrawing after resize */
3737
d3.select(chart_id).select("svg").remove();
@@ -44,7 +44,7 @@ function mirror_status(container_id, check_loc, log_data, color) {
4444
x.domain([
4545
d3.min(data, function(c) { return d3.min(c.logs, function(v) { return v.check_time; }); }),
4646
d3.max(data, function(c) { return d3.max(c.logs, function(v) { return v.check_time; }); })
47-
]).nice(d3.time.hour);
47+
]).nice(d3.timeHour);
4848
y.domain([
4949
0,
5050
d3.max(data, function(c) { return d3.max(c.logs, function(v) { return v.duration; }); })
@@ -73,8 +73,8 @@ function mirror_status(container_id, check_loc, log_data, color) {
7373
.style("text-anchor", "end")
7474
.text("Duration (seconds)");
7575

76-
const line = d3.svg.line()
77-
.interpolate("basis")
76+
const line = d3.line()
77+
.curve(d3.curveBasis)
7878
.x(function(d) { return x(d.check_time); })
7979
.y(function(d) { return y(d.duration); });
8080

0 commit comments

Comments
 (0)