| | |
| | | removeTags: string[] |
| | | showTags: boolean |
| | | focusOnHover?: boolean |
| | | enableRadial?: boolean |
| | | } |
| | | |
| | | interface GraphOptions { |
| | |
| | | showTags: true, |
| | | removeTags: [], |
| | | focusOnHover: false, |
| | | enableRadial: false, |
| | | }, |
| | | globalGraph: { |
| | | drag: true, |
| | |
| | | depth: -1, |
| | | scale: 0.9, |
| | | repelForce: 0.5, |
| | | centerForce: 0.3, |
| | | centerForce: 0.2, |
| | | linkDistance: 30, |
| | | fontSize: 0.6, |
| | | opacityScale: 1, |
| | | showTags: true, |
| | | removeTags: [], |
| | | focusOnHover: true, |
| | | enableRadial: true, |
| | | }, |
| | | } |
| | | |
| | | export default ((opts?: GraphOptions) => { |
| | | export default ((opts?: Partial<GraphOptions>) => { |
| | | const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { |
| | | const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph } |
| | | const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph } |
| | |
| | | <div class={classNames(displayClass, "graph")}> |
| | | <h3>{i18n(cfg.locale).components.graph.title}</h3> |
| | | <div class="graph-outer"> |
| | | <div id="graph-container" data-cfg={JSON.stringify(localGraph)}></div> |
| | | <button id="global-graph-icon" aria-label="Global Graph"> |
| | | <div class="graph-container" data-cfg={JSON.stringify(localGraph)}></div> |
| | | <button class="global-graph-icon" aria-label="Global Graph"> |
| | | <svg |
| | | version="1.1" |
| | | xmlns="http://www.w3.org/2000/svg" |
| | |
| | | </svg> |
| | | </button> |
| | | </div> |
| | | <div id="global-graph-outer"> |
| | | <div id="global-graph-container" data-cfg={JSON.stringify(globalGraph)}></div> |
| | | <div class="global-graph-outer"> |
| | | <div class="global-graph-container" data-cfg={JSON.stringify(globalGraph)}></div> |
| | | </div> |
| | | </div> |
| | | ) |