(
config?:
| ScaleConfig<Output, DiscreteInput, ThresholdInput>
| PickScaleConfigWithoutType<'linear', Output>,
)
| 127 | // Actual implementation |
| 128 | |
| 129 | function createScale< |
| 130 | Output, |
| 131 | DiscreteInput extends StringLike, |
| 132 | ThresholdInput extends DefaultThresholdInput, |
| 133 | >( |
| 134 | config?: |
| 135 | | ScaleConfig<Output, DiscreteInput, ThresholdInput> |
| 136 | | PickScaleConfigWithoutType<'linear', Output>, |
| 137 | ) { |
| 138 | if (typeof config !== 'undefined' && 'type' in config) { |
| 139 | switch (config.type) { |
| 140 | case 'linear': |
| 141 | return createLinearScale(config); |
| 142 | case 'log': |
| 143 | return createLogScale(config); |
| 144 | case 'pow': |
| 145 | return createPowScale(config); |
| 146 | case 'sqrt': |
| 147 | return createSqrtScale(config); |
| 148 | case 'symlog': |
| 149 | return createSymlogScale(config); |
| 150 | case 'time': |
| 151 | return createTimeScale(config); |
| 152 | case 'utc': |
| 153 | return createUtcScale(config); |
| 154 | case 'quantile': |
| 155 | return createQuantileScale(config); |
| 156 | case 'quantize': |
| 157 | return createQuantizeScale(config); |
| 158 | case 'threshold': |
| 159 | return createThresholdScale(config); |
| 160 | case 'ordinal': |
| 161 | return createOrdinalScale(config); |
| 162 | case 'point': |
| 163 | return createPointScale(config); |
| 164 | case 'band': |
| 165 | return createBandScale(config); |
| 166 | case 'radial': |
| 167 | return createRadialScale(config); |
| 168 | default: |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | // If type is not specified, fallback to linear scale |
| 173 | return createLinearScale(config); |
| 174 | } |
| 175 | |
| 176 | export default createScale; |
no test coverage detected