d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.47k stars 307 forks source link

area.topline, area.baseline? #67

Closed mbostock closed 8 years ago

mbostock commented 8 years ago

Something like this:

d3.area.prototype.topline = function() {
  return d3.line().x(this.x()).y(this.y1());
};

d3.area.prototype.baseline = function() {
  return d3.line().x(this.x()).y(this.y0());
};

Although, I feel like we’d want something symmetric for x and vertically-oriented areas.

mbostock commented 8 years ago

Maybe:

d3.area.prototype.lineY1 = function() {
  return d3.line().x(this.x()).y(this.y1());
};

d3.area.prototype.lineY0 = function() {
  return d3.line().x(this.x()).y(this.y0());
};

d3.area.prototype.lineX0 = function() {
  return d3.line().x(this.x0()).y(this.y());
};

d3.area.prototype.lineX1 = function() {
  return d3.line().x(this.x1()).y(this.y());
};

Should also copy area.curve, area.context and area.defined.