/** * @upsetjs/react * https://github.com/upsetjs/upsetjs * * Copyright (c) 2021 Samuel Gratzl */ import React, { ReactElement } from 'react'; import Axis from '../../components/Axis'; import type { Handlers } from '../../hooks/useHandler'; import { clsx } from '../../utils'; import type { KMapDataInfo } from '../derive/deriveDataDependent'; import type { KMapStyleInfo } from '../derive/deriveStyleDependent'; import KMapCell from './KMapCell'; import type { VennDiagramSizeInfo } from '../../venn/derive/deriveVennSizeDependent'; export function generateGridPath(cell: number, vCells: number, hCells: number, level: { x: number[]; y: number[] }) { const h = cell * vCells; const w = cell * hCells; return [level.x.map((x) => `M ${x * cell},0 l0,${h}`), level.y.map((y) => `M 0,${y * cell} l${w},0`)] .flat() .join(' '); } export type KMapChartProps = { style: KMapStyleInfo; data: KMapDataInfo; size: VennDiagramSizeInfo; h: Handlers; }; const KMapChart = /*!#__PURE__*/ React.memo(function KMapChart({ data, style, size, h }: KMapChartProps) { const csNameOffset = style.cs.offset === 'auto' ? data.cs.labelOffset : style.cs.offset; return ( {style.cs.name} {data.sets.l.map((l, i) => { const s = data.sets.v[i]; const name = s.name; return ( {l.text.map((p, i) => ( {name} ))} ); })} {data.sets.l.map((l, i) => { const name = data.sets.v[i].name; return ( {l.notText.map((p, i) => ( {name} ))} ); })} {data.cs.v.map((c, i) => { return ; })} {data.grid.levels.map((l, i) => ( ))} ); }); export default KMapChart as (props: KMapChartProps) => ReactElement;