import { ScaleType } from '@h5web/shared' ; import { scaleLinear , scaleLog , scaleSymlog , scaleSqrt } from '@visx/scale' ; import type { PickScaleConfigWithoutType } from '@visx/scale' ; import type { IconType } from 'react-icons/lib' ; import { MdSort , MdFilterList , MdFlare } from 'react-icons/md' ; import MdGraphicEqRotated from '../toolbar/controls/ScaleSelector/MdGraphicEqRotated' ; import SqrtIcon from '../toolbar/controls/ScaleSelector/SqrtIcon' ; import type { AxisScale } from './models' ; import { scaleGamma } from './scaleGamma' ; interface H5WebScale { createScale : ( config : any ) => AxisScale ; Icon : IconType ; label : string ; validMin : number ; } export const H5WEB_SCALES = { [ ScaleType . Linear ] : { createScale : ( config ) => scaleLinear < number > ( config ) , Icon : MdSort , label : 'Linear' , validMin : - Infinity , } , [ ScaleType . Log ] : { createScale : ( config ) => scaleLog < number > ( config ) , Icon : MdFilterList , label : 'Log' , validMin : Number . MIN_VALUE , } , [ ScaleType . SymLog ] : { createScale : ( config ) => scaleSymlog < number > ( config ) , Icon : MdGraphicEqRotated , label : 'SymLog' , validMin : - Infinity , } , [ ScaleType . Sqrt ] : { createScale : ( config ) => scaleSqrt < number > ( config ) , Icon : SqrtIcon , label : 'Square root' , validMin : 0 , } , [ ScaleType . Gamma ] : { createScale : scaleGamma , Icon : MdFlare , label : 'Gamma' , validMin : - Infinity , } , } ;