径向区域
¥Radial areas
示例 · 一个径向面积生成器,类似于笛卡尔 区域生成器,只是 x 和 y 访问器被 angle 和 radius 访问器取代。径向区域相对于原点定位;使用 transform 更改原点。
¥Examples · A radial area generator is like the Cartesian area generator except the x and y accessors are replaced with angle and radius accessors. Radial areas are positioned relative to the origin; use a transform to change the origin.
areaRadial()
源代码 · 使用默认设置构造一个新的径向区域生成器。
¥Source · Constructs a new radial area generator with the default settings.
const area = d3.areaRadial();
areaRadial(data) {#_areaRadial}
svg.append("path").attr("d", area(data));
areaRadial.angle(angle) {#areaRadial_angle}
源代码 · 等同于 area.x,但它的访问器返回以弧度表示的角度,0 度位于 -y 轴(12 点钟方向)。
¥Source · Equivalent to area.x, except the accessor returns the angle in radians, with 0 at -y (12 o’clock).
const area = d3.areaRadial().angle((d) => a(d.Date));
areaRadial.startAngle(angle) {#areaRadial_startAngle}
源代码 · 等同于 area.x0,但它的访问器返回以弧度表示的角度,0 度位于 -y 轴(12 点钟方向)。注意:通常使用 angle 来代替设置单独的起始角度和结束角度。
¥Source · Equivalent to area.x0, except the accessor returns the angle in radians, with 0 at -y (12 o’clock). Note: typically angle is used instead of setting separate start and end angles.
areaRadial.endAngle(angle) {#areaRadial_endAngle}
源代码 · 等同于 area.x1,但它的访问器返回以弧度表示的角度,0 度位于 -y 轴(12 点钟方向)。注意:通常使用 angle 来代替设置单独的起始角度和结束角度。
¥Source · Equivalent to area.x1, except the accessor returns the angle in radians, with 0 at -y (12 o’clock). Note: typically angle is used instead of setting separate start and end angles.
areaRadial.radius(radius) {#areaRadial_radius}
源代码 · 等同于 area.y,但它的访问器返回的是半径:与原点的距离。
¥Source · Equivalent to area.y, except the accessor returns the radius: the distance from the origin.
const area = d3.areaRadial().radius((d) => r(d.temperature));
areaRadial.innerRadius(radius) {#areaRadial_innerRadius}
源代码 · 等同于 area.y0,但它的访问器返回的是半径:与原点的距离。
¥Source · Equivalent to area.y0, except the accessor returns the radius: the distance from the origin.
const area = d3.areaRadial().radius((d) => r(d.low));
areaRadial.outerRadius(radius) {#areaRadial_outerRadius}
源代码 · 等同于 area.y1,但它的访问器返回的是半径:与原点的距离。
¥Source · Equivalent to area.y1, except the accessor returns the radius: the distance from the origin.
const area = d3.areaRadial().radius((d) => r(d.high));
areaRadial.defined(defined) {#areaRadial_defined}
源代码 · 等同于 area.defined。
¥Source · Equivalent to area.defined.
const area = d3.areaRadial().defined((d) => !isNaN(d.temperature));
areaRadial.curve(curve) {#areaRadial_curve}
源代码 · 等同于 area.curve。请注意,不建议将 curveMonotoneX 或 curveMonotoneY 用于径向区域,因为它们假设数据在 x 或 y 方向上是单调的,而这通常不适用于径向区域。
¥Source · Equivalent to area.curve. Note that curveMonotoneX or curveMonotoneY are not recommended for radial areas because they assume that the data is monotonic in x or y, which is typically untrue of radial areas.
const area = d3.areaRadial().curve(d3.curveBasisClosed);
areaRadial.context(context) {#areaRadial_context}
源代码 · 等同于 area.context。
¥Source · Equivalent to area.context.
const context = canvas.getContext("2d");
const area = d3.areaRadial().context(context);
areaRadial.lineInnerRadius() {#areaRadial_lineInnerRadius}
areaRadial.lineStartAngle 的别名。
¥An alias for areaRadial.lineStartAngle.
areaRadial.lineStartAngle() {#areaRadial_lineStartAngle}
源代码 · 返回一个新的 径向线生成器,其中包含此径向区域生成器当前的 定义的访问器、curve 和 context。线的 角度访问器 对应该区域的 起始角度访问器,线的 半径访问器 对应该区域的 内部半径访问器。
¥Source · Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor.
areaRadial.lineEndAngle() {#areaRadial_lineEndAngle}
源代码 · 返回一个新的 径向线生成器,其中包含此径向区域生成器当前的 定义的访问器、curve 和 context。线的 角度访问器 对应该区域的 结束角度访问器,线的 半径访问器 对应该区域的 内部半径访问器。
¥Source · Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s end angle accessor, and the line’s radius accessor is this area’s inner radius accessor.
areaRadial.lineOuterRadius() {#areaRadial_lineOuterRadius}
源代码 · 返回一个新的 径向线生成器,其中包含此径向区域生成器当前的 定义的访问器、curve 和 context。线的 角度访问器 对应该区域的 起始角度访问器,线的 半径访问器 对应该区域的 外半径访问器。
¥Source · Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s outer radius accessor.