Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// use Line generator ===============================================================
defaultLine([[10, 10], [20, 10], [20, 20]]);
const lineData: LineDatum[] = [
{ x: 10, y: 10, missing: false },
{ x: 20, y: 10, missing: false },
{ x: 20, y: 20, missing: false }
];
const linePathStringMaybe: string | null = line(lineData);
// lineRadial(...) create Line generator =====================================================
let defaultLineRadial: d3Shape.LineRadial<[number, number]> = d3Shape.lineRadial();
let lineRadial: d3Shape.LineRadial = d3Shape.lineRadial();
// DEPRECATED Naming conventions test (cross-testing with new naming conventions)
const defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial;
const radialLine: d3Shape.RadialLine = lineRadial;
defaultLineRadial = d3Shape.radialLine();
lineRadial = d3Shape.radialLine();
// configure LineRadial(...) generator ======================================================
// context(...) ----------------------------------------------------------------------
if (context !== null) {
defaultLineRadial = defaultLineRadial.context(context); // draw to canvas
}
function getSpiralPath(startAngle, endAngle, startR, endR) {
var numPoints = (endAngle - startAngle) / (Math.PI * 2) * 40; // 40 points per 360deg
var lineGen = d3LineRadial()
.angle(scaleLinear().range([startAngle, endAngle]))
.radius(scaleLinear().range([startR, endR]))
.curve(d3CurveNatural);
return 'M' + polar2cart(startAngle, startR).join(',')
+ lineGen(scaleLinear().ticks(numPoints));
}
getLineGenerator(): any {
return lineRadial()
.angle(d => this.getAngle(d))
.radius(d => this.getRadius(d))
.curve(this.curve);
}
PolarSeriesComponent.prototype.getLineGenerator = function () {
var _this = this;
return lineRadial()
.angle(function (d) { return _this.getAngle(d); })
.radius(function (d) { return _this.getRadius(d); })
.curve(this.curve);
};
PolarSeriesComponent.prototype.sortData = function (data) {
seriesVisible = value(seriesVisible, {seriesIndex: index, series, props});
if (!seriesVisible) {
return;
}
seriesAttributes = value(seriesAttributes, {seriesIndex: index, series, props});
seriesStyle = value(seriesStyle, {seriesIndex: index, series, props});
let linePath;
lineVisible = value(lineVisible, {seriesIndex: index, series, props});
if (lineVisible) {
const line = asAreas ?
areaRadial()
.innerRadius(point => point.y0 ? radialScale(point.y0) : _radius0)
.outerRadius(point => radialScale(point.y)) :
lineRadial()
.radius(point => radialScale(point.y));
const lineColor = series.color || color(index);
const curve = _.isString(props.interpolation) ?
curves[props.interpolation] :
props.interpolation;
line.angle(point => circularScale(point.x))
.defined(point => _.isNumber(point.y))
.curve(curve);
lineAttributes = value(lineAttributes, {seriesIndex: index, series, props});
lineStyle = value([series.style, lineStyle], {seriesIndex: index, series, props});
lineWidth = value(lineWidth, {seriesIndex: index, series, props});
const getLineFunction = (props) => {
const { polar, scale, horizontal } = props;
const interpolationFunction = typeof props.interpolation === "function" && props.interpolation;
const interpolationName =
typeof props.interpolation === "string" && toNewName(props.interpolation);
return polar
? d3Shape
.lineRadial()
.defined(defined)
.curve(interpolationFunction || d3Shape[`${interpolationName}Closed`])
.angle(getAngleAccessor(scale))
.radius(getYAccessor(scale))
: d3Shape
.line()
.defined(defined)
.curve(interpolationFunction || d3Shape[interpolationName])
.x(horizontal ? getYAccessor(scale) : getXAccessor(scale))
.y(horizontal ? getXAccessor(scale) : getYAccessor(scale));
};
)}
)
}
const radarLineGenerator = lineRadial()
.angle(i => i * angleStep)
.curve(curveLinearClosed)
const points = range(dataLength)
if (animate !== true) {
return (
({ radiusScale, angleStep, curveInterpolator }) => ({
lineGenerator: lineRadial()
.radius(d => radiusScale(d))
.angle((d, i) => i * angleStep)
.curve(curveInterpolator),
})
),