Skip to content

Commit

Permalink
fix scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ddboline committed Jan 24, 2025
1 parent 576b814 commit 139de77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions templates/line_plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function line_plot(data, title, xaxis, yaxis) {

// Define the line
let valueline = d3.line()
.x(function(d) { return x(d[0]); })
.y(function(d) { return y(d[1]); });
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });

// Adds the svg canvas
let svg = d3.select("body")
Expand Down
16 changes: 8 additions & 8 deletions templates/time_series.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ function time_series(data, title, xaxis, yaxis, units) {
.text(yaxis);

data.forEach(function(d) {
d[0] = parseDateTime(d[0]);
d.x = parseDateTime(d.x);
});

let xmax = d3.max(data, function(d) {return d[0]});
let xmin = d3.min(data, function(d) {return d[0]});
let ymax = d3.max(data, function(d) {return d[1]});
let ymin = d3.min(data, function(d) {return d[1]});
let xmax = d3.max(data, function(d) {return d.x});
let xmin = d3.min(data, function(d) {return d.x});
let ymax = d3.max(data, function(d) {return d.y});
let ymin = d3.min(data, function(d) {return d.y});

ymax = ymax + 0.1 * Math.abs(ymax);
ymin = ymin - 0.1 * Math.abs(ymin);

x.domain(d3.extent(data, function(d) {return d[0]; }));
x.domain(d3.extent(data, function(d) {return d.x; }));
y.domain([ymin, ymax]);

// Define the line
var valueline = d3.line()
.x(function(d) { return x(d[0]); })
.y(function(d) { return y(d[1]); });
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });

svg.append("path").attr("class", "line").attr("d", valueline(data));

Expand Down

0 comments on commit 139de77

Please sign in to comment.