packages/core/src/features/viz/lib/symlog-scale-component.ts
This is the source snapshot used to build these API details. View this revision on GitHub.
1 import { resolveSignalValue, useLayoutBox } from "@pibbl/core";
2 import type { SymlogScaleProps } from "./types.js";
3 import { resolveSymlogScale } from "./symlog-scale.js";
4 import { useScaleProvider } from "./scale-provider.js";
5 /**
6 * Provides a named symlog mapping to descendant visualization components.
7 * @param props - Identity, domain, range, and constant. See {@link SymlogScaleProps}.
8 * @returns Descendant content within the scale scope.
9 */
10 export function SymlogScale(props: SymlogScaleProps) {
11 const { width, height } = useLayoutBox();
12 useScaleProvider(props.id, "symlog", () => resolveSymlogScale(
13 resolveSignalValue(props.domain), resolveSignalValue(props.range),
14 resolveSignalValue(props.reverse ?? false), width, height, resolveSignalValue(props.constant ?? 1),
15 ), [props.domain, props.range, props.reverse, props.constant, width, height]);
16 return props.children;
17 }
18
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.