1#-----------------------------------------------------------------------------
2# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
3# All rights reserved.
4#
5# The full license is in the file LICENSE.txt, distributed with this software.
6#-----------------------------------------------------------------------------
7'''
8
9'''
10
11#-----------------------------------------------------------------------------
12# Boilerplate
13#-----------------------------------------------------------------------------
14import logging # isort:skip
15log = logging.getLogger(__name__)
16
17#-----------------------------------------------------------------------------
18# Imports
19#-----------------------------------------------------------------------------
20
21# Bokeh imports
22from ..core.has_props import abstract
23from .transforms import Transform
24
25#-----------------------------------------------------------------------------
26# Globals and constants
27#-----------------------------------------------------------------------------
28
29__all__ = (
30    'CategoricalScale',
31    'LinearScale',
32    'LogScale',
33    'Scale',
34)
35
36#-----------------------------------------------------------------------------
37# General API
38#-----------------------------------------------------------------------------
39
40@abstract
41class Scale(Transform):
42    ''' Base class for ``Scale`` models that represent an invertible
43    computation to be carried out on the client-side.
44
45    JavaScript implementations should implement the following methods:
46
47    .. code-block
48
49        compute(x: number): number {
50            # compute and return the transform of a single value
51        }
52
53        v_compute(xs: Arrayable<number>): Arrayable<number> {
54            # compute and return the transform of an array of values
55        }
56
57        invert(sx: number): number {
58            # compute and return the inverse transform of a single value
59        }
60
61        v_invert(sxs: Arrayable<number>): Arrayable<number> {
62            # compute and return the inverse transform of an array of values
63        }
64
65    '''
66    pass
67
68class ContinuousScale(Scale):
69    ''' Represent a scale transformation between continuous ranges.
70
71    '''
72    pass
73
74
75class LinearScale(ContinuousScale):
76    ''' Represent a linear scale transformation between continuous ranges.
77
78    '''
79    pass
80
81class LogScale(ContinuousScale):
82    ''' Represent a log scale transformation between continuous ranges.
83
84    '''
85    pass
86
87class CategoricalScale(Scale):
88    ''' Represent a scale transformation between a categorical source range and
89    continuous target range.
90
91    '''
92    pass
93
94#-----------------------------------------------------------------------------
95# Dev API
96#-----------------------------------------------------------------------------
97
98#-----------------------------------------------------------------------------
99# Private API
100#-----------------------------------------------------------------------------
101
102#-----------------------------------------------------------------------------
103# Code
104#-----------------------------------------------------------------------------
105