You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example shows that labels property can be defined as
<ChartVoronoiContainerlabels={({ datum })=>datum.childName.includes('line-') ? `${datum.name}: ${datum.y}` : null}constrainToVisibleArea/>
and the error is:
Type '({ datum }: any) => string | null' is not assignable to type '(point: any, index: number, points: any[]) => string'.
Type 'string | null' is not assignable to type 'string'.
Type 'null' is not assignable to type 'string'. ts(2322)
ChartVoronoiContainer.d.ts(93, 5): The expected type comes from property 'labels' which is declared here on type 'IntrinsicAttributes & ChartVoronoiContainerProps
Am I doing something wrong or is this a bug in how ChartVoronoiComponent is defined that works in JavaScript, but not in TypeScript?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using typescript, but am getting a compilation error when attempting to implement the example code for labels in the Scatter+Line chart at https://www.patternfly.org/charts/scatter-chart#line-chart
The example shows that labels property can be defined as
and the error is:
Am I doing something wrong or is this a bug in how ChartVoronoiComponent is defined that works in JavaScript, but not in TypeScript?
Beta Was this translation helpful? Give feedback.
All reactions