Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up factor range and add factor method #14037

Merged
merged 15 commits into from
Aug 27, 2024
Prev Previous commit
Next Next commit
docs comments
  • Loading branch information
bryevdv committed Aug 23, 2024
commit 39b581724bc886a52721b6d4b4d34b279fa13f7d
6 changes: 3 additions & 3 deletions bokehjs/src/lib/models/ranges/factor_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class FactorRange extends Range {
return this._lookup_entry(x)?.value ?? NaN
}

// convert a categorical factor into a synthetic coordinate
/** Convert a categorical factor into a synthetic coordinate. */
synthetic(x: FactorLike): number {
if (isNumber(x)) {
return x
Expand All @@ -278,12 +278,12 @@ export class FactorRange extends Range {
return this._lookup_value(x as BoxedFactor)
}

// convert an array of categorical factors into synthetic coordinates
/** Convert an array of categorical factors into synthetic coordinates. */
v_synthetic(xs: Arrayable<number | Factor | [string] | OffsetFactor>): ScreenArray {
return ScreenArray.from(xs, (x) => this.synthetic(x))
}

// convert a synthetic coordinate into a categorical factor
/** Convert a synthetic coordinate into a categorical factor. */
factor(x: number): Factor | null {
for (const f of this.factors) {
const v = this.synthetic(f)
Expand Down