packages/core/src/features/viz/lib/use-log-scale.ts
This is the source snapshot used to build these API details. View this revision on GitHub.
1 import type { Signal } from "@pibbl/core";
2 import type { ResolvedLogScale, ResolvedScale, ScaleId } from "./types.js";
3 import { scaleView } from "./scale-view.js";
4 const views = new WeakMap<Signal<ResolvedScale>, Signal<ResolvedLogScale>>();
5 /**
6 * Reads an ancestor logarithmic scale as a stable shared readonly signal.
7 * @param id - Ancestor scale identity. See {@link ScaleId}.
8 * @returns The reactive logarithmic mapping. See {@link ResolvedLogScale}.
9 */
10 export function useLogScale(id: ScaleId): Signal<ResolvedLogScale> {
11 return scaleView(views, id, "useLogScale", kind => kind === "log");
12 }
13
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.