Skip to content

Type for Legend content. #3373

Answered by ckifer
rwithik asked this question in Q&A
Discussion options

You must be logged in to vote

Hi sorry I never got around to answering this

related issues:
#2909

here is what I would do for now:

type CustomPayloadType = {
  value: any;
  id?: string;
  type?: LegendType;
  color?: string;
  payload?: {
    strokeDasharray: ReactText;
  };
  // add dataKey
  dataKey?: string;
  formatter?: Formatter;
  inactive?: boolean;
  legendIcon?: ReactElement<SVGElement>;
};

interface CustomLegendContentProps extends LegendProps {
  payload?: CustomPayloadType[];
}

https://codesandbox.io/s/customized-legend-event-forked-nrh63i?file=/src/App.tsx

But this does need fixed. Thanks

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ckifer
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants