0.2.7 • Published 7 months ago

@ferdydh/d3-org-chart v0.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Customizable organization chart, based on d3 v7

This repo is a fork from d3-org-chart by David B(twitter and LinkedIn). Our ultimate goal is to integrate typescript and react natively into the library, fix reported issues, improve customization, and provide better documentation.

Installing

npm i @ferdydh/d3-org-chart
import { OrgChart } from '@ferdydh/d3-org-chart';

type Props = {
     data: DataType[]
}

type DataType = {
     id: string | number // required property
     parentId: string | number // required property
}

export const OrgChartComponent = ({ data }: Props) => {
  const container = useRef(null);

  useEffect(() => {
    if (fields && container.current) {
      const chart = new OrgChart<DataType>()
        .container(container.current)
        .data(fields)
        .render();
    }
  }, [fields, container.current]);

  return (
    <div>
      <div ref={container} />
    </div>
  );
};

Featured:

Custom components & algorithms used

Author

Ferdy DH

0.2.7

7 months ago

0.2.6

7 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

3.1.1-fix

7 months ago