Skip to content

Commit 8d7bd34

Browse files
committed
lint and format fix
1 parent 2b32e1b commit 8d7bd34

File tree

4 files changed

+32
-33
lines changed

4 files changed

+32
-33
lines changed

packages/victory-pie/src/curved-label.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const renderLabel = (calculatedProps, tspanValues) => {
147147
textPathComponent,
148148
href,
149149
startOffset,
150-
dy
150+
dy,
151151
} = calculatedProps;
152152
const userProps = UserProps.getSafeUserProps(calculatedProps);
153153

packages/victory-pie/src/helper-methods.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -268,21 +268,21 @@ const getCurvedLabelProps = (text, dataProps, calculatedValues) => {
268268
labelRadius,
269269
evaluatedStyle,
270270
);
271-
const labelArc = getLabelArc(calculatedLabelRadius)
272-
.startAngle(slice.startAngle)
273-
.endAngle(slice.endAngle);
274-
const path = labelArc(slice);
275-
const pathId = uniqueId('label-path-');
271+
const labelArc = getLabelArc(calculatedLabelRadius)
272+
.startAngle(slice.startAngle)
273+
.endAngle(slice.endAngle);
274+
const path = labelArc(slice);
275+
const pathId = uniqueId("label-path-");
276276

277-
const curvedLabelProps = {
277+
const curvedLabelProps = {
278278
index,
279279
datum,
280280
data,
281281
slice,
282282
text,
283283
style: labelStyle,
284-
href:`#${pathId}`,
285-
id:pathId,
284+
href: `#${pathId}`,
285+
id: pathId,
286286
path,
287287
startOffset,
288288
transform: defaultTransform,

packages/victory-pie/src/victory-pie.tsx

+22-23
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class VictoryPieBase extends React.Component<VictoryPieProps> {
145145
standalone: true,
146146
dataComponent: <Slice />,
147147
labelComponent: <VictoryLabel />,
148-
curvedLabelComponent: <CurvedLabel/>,
148+
curvedLabelComponent: <CurvedLabel />,
149149
containerComponent: <VictoryContainer />,
150150
groupComponent: <g />,
151151
sortOrder: "ascending",
@@ -176,7 +176,7 @@ class VictoryPieBase extends React.Component<VictoryPieProps> {
176176
labelIndicator,
177177
labelPosition,
178178
labelPlacement,
179-
curvedLabelComponent
179+
curvedLabelComponent,
180180
} = props;
181181

182182
if (!groupComponent) {
@@ -212,28 +212,28 @@ class VictoryPieBase extends React.Component<VictoryPieProps> {
212212
children.push(...dataComponents);
213213
}
214214

215-
// For curved labels, we need to create a path component with id and path value of
216-
// label arc. We need to pass this id to the href of textPath component which will
215+
// For curved labels, we need to create a path component with id and path value of
216+
// label arc. We need to pass this id to the href of textPath component which will
217217
// have label value(tspan) as child component.
218218
if (labelPlacement === "curved") {
219-
const labelPathComponents= this.dataKeys.map((_dataKey, index) => {
220-
const curvedLabelProps = this.getComponentProps(
221-
curvedLabelComponent,
222-
"curvedLabels",
223-
index,
224-
);
219+
const labelPathComponents = this.dataKeys.map((_dataKey, index) => {
220+
const curvedLabelProps = this.getComponentProps(
221+
curvedLabelComponent,
222+
"curvedLabels",
223+
index,
224+
);
225+
226+
// create labelPath
227+
const pathComponent: React.ReactElement = <Path />;
228+
return React.cloneElement(pathComponent, {
229+
d: curvedLabelProps.path,
230+
id: curvedLabelProps.id,
231+
key: index,
232+
textAnchor: "middle",
233+
});
234+
});
235+
children.push(...labelPathComponents);
225236

226-
//create labelPath
227-
const pathComponent:React.ReactElement = <Path/>
228-
return React.cloneElement(pathComponent, {
229-
d: curvedLabelProps.path,
230-
id: curvedLabelProps.id,
231-
key: index,
232-
textAnchor:"middle"
233-
});
234-
})
235-
children.push( ...labelPathComponents);
236-
237237
const curvedLabelComponents = this.dataKeys
238238
.map((_dataKey, index) => {
239239
const curvedLabelProps = this.getComponentProps(
@@ -254,8 +254,7 @@ class VictoryPieBase extends React.Component<VictoryPieProps> {
254254
(comp: React.ReactElement | undefined): comp is React.ReactElement =>
255255
comp !== undefined,
256256
);
257-
children.push( ...curvedLabelComponents);
258-
257+
children.push(...curvedLabelComponents);
259258
} else if (labelComponent) {
260259
const labelComponents = this.dataKeys
261260
.map((_dataKey, index) => {

stories/victory-pie.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ export const LabelPlacement = () => {
605605
labels={({ datum }) => `${datum.l}`}
606606
labelRadius={85}
607607
startOffset={30}
608-
curvedLabelComponent={<CurvedLabel style={{ fill: "red" }}/>}
608+
curvedLabelComponent={<CurvedLabel style={{ fill: "red" }} />}
609609
data={[
610610
{ x: 1, y: 1, l: 0 },
611611
{ x: 2, y: 1, l: 45 },

0 commit comments

Comments
 (0)