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
fix levels property cruft
  • Loading branch information
bryevdv committed Aug 23, 2024
commit 8bacbdf97b8f7c4c1d8b55ebea74949a8575e428
9 changes: 5 additions & 4 deletions bokehjs/src/lib/models/ranges/factor_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export namespace FactorRange {
export interface FactorRange extends FactorRange.Attrs {}

export class FactorRange extends Range {
levels: number
levels: 1 | 2 | 3
mids: L2Factor[] | null
tops: L1Factor[] | null

Expand Down Expand Up @@ -305,9 +305,10 @@ export class FactorRange extends Range {

protected _init(): void {

const levels = compute_levels(this.factors)
this.levels = compute_levels(this.factors)

const {mapping, tops, mids, inner_padding} = (() => {
switch (levels) {
switch (this.levels) {
case 1: {
const factors = this.factors as L1Factor[]
return map_one_level(factors, this.factor_padding)
Expand All @@ -329,7 +330,7 @@ export class FactorRange extends Range {

const [start, end] = this._compute_bounds(inner_padding)

this.setv({start, end, levels}, {silent: true})
this.setv({start, end}, {silent: true})

if (this.bounds == "auto") {
this._computed_bounds = [start, end]
Expand Down
Loading