MCPcopy
hub / github.com/apache/echarts / getSectorCornerRadius

Function getSectorCornerRadius

src/chart/helper/sectorHelper.ts:25–41  ·  view source on GitHub ↗
(
    model: Model<{ borderRadius?: string | number | (string | number)[] }>,
    shape: Pick<Sector['shape'], 'r0' | 'r'>,
    zeroIfNull?: boolean
)

Source from the content-addressed store, hash-verified

23import { parsePercent } from 'zrender/src/contain/text';
24
25export function getSectorCornerRadius(
26 model: Model<{ borderRadius?: string | number | (string | number)[] }>,
27 shape: Pick<Sector['shape'], 'r0' | 'r'>,
28 zeroIfNull?: boolean
29) {
30 let cornerRadius = model.get('borderRadius');
31 if (cornerRadius == null) {
32 return zeroIfNull ? { cornerRadius: 0 } : null;
33 }
34 if (!isArray(cornerRadius)) {
35 cornerRadius = [cornerRadius, cornerRadius, cornerRadius, cornerRadius];
36 }
37 const dr = Math.abs(shape.r || 0 - shape.r0 || 0);
38 return {
39 cornerRadius: map(cornerRadius, cr => parsePercent(cr, dr))
40 };
41}

Callers 5

updateDataMethod · 0.90
updateDataMethod · 0.90
updateDataMethod · 0.90
updateStyleFunction · 0.90
updateDataMethod · 0.90

Calls 2

isArrayFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…