@orbcharts/plugins-basic 3.0.0-beta.3 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +200 -200
 - package/lib/core-types.ts +7 -7
 - package/lib/core.ts +6 -6
 - package/lib/plugins-basic-types.ts +6 -6
 - package/package.json +44 -44
 - package/src/base/BaseBarStack.ts +780 -780
 - package/src/base/BaseBars.ts +765 -765
 - package/src/base/BaseBarsTriangle.ts +674 -674
 - package/src/base/BaseDots.ts +515 -515
 - package/src/base/BaseGroupAxis.ts +679 -679
 - package/src/base/BaseLegend.ts +680 -680
 - package/src/base/BaseLineAreas.ts +629 -629
 - package/src/base/BaseLines.ts +706 -706
 - package/src/base/BaseTooltip.ts +385 -385
 - package/src/base/BaseValueAxis.ts +580 -580
 - package/src/base/types.ts +2 -2
 - package/src/const.ts +30 -30
 - package/src/grid/defaults.ts +244 -244
 - package/src/grid/gridObservables.ts +545 -545
 - package/src/grid/index.ts +16 -16
 - package/src/grid/plugins/BarStack.ts +64 -64
 - package/src/grid/plugins/Bars.ts +69 -69
 - package/src/grid/plugins/BarsPN.ts +66 -66
 - package/src/grid/plugins/BarsTriangle.ts +73 -73
 - package/src/grid/plugins/Dots.ts +68 -68
 - package/src/grid/plugins/GridLegend.ts +107 -107
 - package/src/grid/plugins/GridTooltip.ts +66 -66
 - package/src/grid/plugins/GridZoom.ts +218 -218
 - package/src/grid/plugins/GroupAux.ts +1098 -1098
 - package/src/grid/plugins/GroupAxis.ts +97 -97
 - package/src/grid/plugins/LineAreas.ts +65 -65
 - package/src/grid/plugins/Lines.ts +59 -59
 - package/src/grid/plugins/ValueAxis.ts +93 -93
 - package/src/grid/plugins/ValueStackAxis.ts +95 -95
 - package/src/index.ts +9 -9
 - package/src/multiGrid/defaults.ts +224 -224
 - package/src/multiGrid/index.ts +14 -14
 - package/src/multiGrid/multiGridObservables.ts +49 -49
 - package/src/multiGrid/plugins/MultiBarStack.ts +106 -106
 - package/src/multiGrid/plugins/MultiBars.ts +108 -108
 - package/src/multiGrid/plugins/MultiBarsTriangle.ts +114 -114
 - package/src/multiGrid/plugins/MultiDots.ts +102 -102
 - package/src/multiGrid/plugins/MultiGridLegend.ts +159 -159
 - package/src/multiGrid/plugins/MultiGridTooltip.ts +66 -66
 - package/src/multiGrid/plugins/MultiGroupAxis.ts +137 -137
 - package/src/multiGrid/plugins/MultiLineAreas.ts +107 -107
 - package/src/multiGrid/plugins/MultiLines.ts +101 -101
 - package/src/multiGrid/plugins/MultiValueAxis.ts +133 -133
 - package/src/multiGrid/plugins/MultiValueStackAxis.ts +133 -133
 - package/src/multiGrid/plugins/OverlappingValueAxes.ts +299 -299
 - package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +298 -298
 - package/src/noneData/defaults.ts +102 -102
 - package/src/noneData/index.ts +3 -3
 - package/src/noneData/plugins/Container.ts +27 -27
 - package/src/noneData/plugins/Tooltip.ts +373 -373
 - package/src/series/defaults.ts +206 -206
 - package/src/series/index.ts +9 -9
 - package/src/series/plugins/Bubbles.ts +603 -603
 - package/src/series/plugins/Pie.ts +623 -623
 - package/src/series/plugins/PieEventTexts.ts +283 -283
 - package/src/series/plugins/PieLabels.ts +640 -640
 - package/src/series/plugins/Rose.ts +516 -516
 - package/src/series/plugins/RoseLabels.ts +600 -600
 - package/src/series/plugins/SeriesLegend.ts +107 -107
 - package/src/series/plugins/SeriesTooltip.ts +66 -66
 - package/src/series/seriesObservables.ts +145 -145
 - package/src/series/seriesUtils.ts +51 -51
 - package/src/tree/defaults.ts +78 -78
 - package/src/tree/index.ts +4 -4
 - package/src/tree/plugins/TreeLegend.ts +107 -107
 - package/src/tree/plugins/TreeMap.ts +333 -333
 - package/src/tree/plugins/TreeTooltip.ts +66 -66
 - package/src/utils/commonUtils.ts +21 -21
 - package/src/utils/d3Graphics.ts +174 -174
 - package/src/utils/d3Utils.ts +73 -73
 - package/src/utils/observables.ts +14 -14
 - package/src/utils/orbchartsUtils.ts +100 -100
 - package/tsconfig.base.json +13 -13
 - package/tsconfig.json +2 -2
 - package/vite.config.js +22 -22
 
    
        package/src/utils/observables.ts
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import * as d3 from 'd3'
         
     | 
| 
       2 
     | 
    
         
            -
            import { Observable, merge, distinctUntilChanged, fromEvent } from 'rxjs'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            export function d3EventObservable(selection: d3.Selection<any, any, any, any>, event: any) {
         
     | 
| 
       5 
     | 
    
         
            -
              // Start with an observable that will never emit
         
     | 
| 
       6 
     | 
    
         
            -
              let obs = new Observable(() => {});
         
     | 
| 
       7 
     | 
    
         
            -
              selection.each(function () {
         
     | 
| 
       8 
     | 
    
         
            -
                  // Create observables from each of the elements
         
     | 
| 
       9 
     | 
    
         
            -
                  const events = fromEvent(this as any, event);
         
     | 
| 
       10 
     | 
    
         
            -
                  // Merge the observables into one
         
     | 
| 
       11 
     | 
    
         
            -
                  obs = merge(obs, events);
         
     | 
| 
       12 
     | 
    
         
            -
              });
         
     | 
| 
       13 
     | 
    
         
            -
              return obs;
         
     | 
| 
       14 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            import * as d3 from 'd3'
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { Observable, merge, distinctUntilChanged, fromEvent } from 'rxjs'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export function d3EventObservable(selection: d3.Selection<any, any, any, any>, event: any) {
         
     | 
| 
      
 5 
     | 
    
         
            +
              // Start with an observable that will never emit
         
     | 
| 
      
 6 
     | 
    
         
            +
              let obs = new Observable(() => {});
         
     | 
| 
      
 7 
     | 
    
         
            +
              selection.each(function () {
         
     | 
| 
      
 8 
     | 
    
         
            +
                  // Create observables from each of the elements
         
     | 
| 
      
 9 
     | 
    
         
            +
                  const events = fromEvent(this as any, event);
         
     | 
| 
      
 10 
     | 
    
         
            +
                  // Merge the observables into one
         
     | 
| 
      
 11 
     | 
    
         
            +
                  obs = merge(obs, events);
         
     | 
| 
      
 12 
     | 
    
         
            +
              });
         
     | 
| 
      
 13 
     | 
    
         
            +
              return obs;
         
     | 
| 
      
 14 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -1,100 +1,100 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import type {
         
     | 
| 
       2 
     | 
    
         
            -
              AxisPosition,
         
     | 
| 
       3 
     | 
    
         
            -
              ColorType,
         
     | 
| 
       4 
     | 
    
         
            -
              ChartParams,
         
     | 
| 
       5 
     | 
    
         
            -
              ComputedDatumBase,
         
     | 
| 
       6 
     | 
    
         
            -
              ComputedDatumSeriesValue,
         
     | 
| 
       7 
     | 
    
         
            -
              ComputedDatumCategoryValue } from '../../lib/core-types'
         
     | 
| 
       8 
     | 
    
         
            -
            import { getMinAndMax } from './commonUtils'
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            // 取得最小及最大值 - datum格式陣列資料
         
     | 
| 
       11 
     | 
    
         
            -
            export function getMinAndMaxValue (data: ComputedDatumBase[]): [number, number] {
         
     | 
| 
       12 
     | 
    
         
            -
              const arr = data
         
     | 
| 
       13 
     | 
    
         
            -
                .filter(d => d.value != null && d.visible != false)
         
     | 
| 
       14 
     | 
    
         
            -
                .map(d => d.value as number)
         
     | 
| 
       15 
     | 
    
         
            -
              return getMinAndMax(arr)
         
     | 
| 
       16 
     | 
    
         
            -
            }
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            // 取得colorType顏色
         
     | 
| 
       19 
     | 
    
         
            -
            export function getColor (colorType: ColorType, fullChartParams: ChartParams) {
         
     | 
| 
       20 
     | 
    
         
            -
              const colors = fullChartParams.colors[fullChartParams.colorScheme]
         
     | 
| 
       21 
     | 
    
         
            -
              // 對應series資料中第1個顏色
         
     | 
| 
       22 
     | 
    
         
            -
              if (colorType === 'series') {
         
     | 
| 
       23 
     | 
    
         
            -
                return colors.series[0]
         
     | 
| 
       24 
     | 
    
         
            -
              }
         
     | 
| 
       25 
     | 
    
         
            -
              // 對應colorType設定的顏色
         
     | 
| 
       26 
     | 
    
         
            -
              // return colors[colorType] != null
         
     | 
| 
       27 
     | 
    
         
            -
              //   ? colors[colorType]
         
     | 
| 
       28 
     | 
    
         
            -
              //   : colors.primary
         
     | 
| 
       29 
     | 
    
         
            -
              return colorType == 'none'
         
     | 
| 
       30 
     | 
    
         
            -
                ? 'none'
         
     | 
| 
       31 
     | 
    
         
            -
                : colors[colorType] != undefined
         
     | 
| 
       32 
     | 
    
         
            -
                  ? colors[colorType]
         
     | 
| 
       33 
     | 
    
         
            -
                  : colors.primary // 如果比對不到
         
     | 
| 
       34 
     | 
    
         
            -
            }
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            export function getSeriesValueColor () {
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            }
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            export function getCategoryValueColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumCategoryValue, colorType: ColorType, fullChartParams: ChartParams }) {
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
            }
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
            // // 取得Series顏色 @Q@ 待重構完後刪除
         
     | 
| 
       45 
     | 
    
         
            -
            // export function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
         
     | 
| 
       46 
     | 
    
         
            -
            //   const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].series.length
         
     | 
| 
       47 
     | 
    
         
            -
            //     ? seriesIndex
         
     | 
| 
       48 
     | 
    
         
            -
            //     : seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].series.length
         
     | 
| 
       49 
     | 
    
         
            -
            //   return fullChartParams.colors[fullChartParams.colorScheme].series[colorIndex]
         
     | 
| 
       50 
     | 
    
         
            -
            // }
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
            // 取得Datum顏色 @Q@ 待重構完後刪除
         
     | 
| 
       53 
     | 
    
         
            -
            export function getDatumColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumBase, colorType: ColorType, fullChartParams: ChartParams }) {
         
     | 
| 
       54 
     | 
    
         
            -
              // 對應series資料中的顏色
         
     | 
| 
       55 
     | 
    
         
            -
              if (colorType === 'series') {
         
     | 
| 
       56 
     | 
    
         
            -
                if ((datum as unknown as ComputedDatumSeriesValue).color) {
         
     | 
| 
       57 
     | 
    
         
            -
                  return (datum as unknown as ComputedDatumSeriesValue).color
         
     | 
| 
       58 
     | 
    
         
            -
                } else {
         
     | 
| 
       59 
     | 
    
         
            -
                  // 非series類型的資料則回傳陣列中第1個顏色
         
     | 
| 
       60 
     | 
    
         
            -
                  return fullChartParams.colors[fullChartParams.colorScheme].series[0]
         
     | 
| 
       61 
     | 
    
         
            -
                }
         
     | 
| 
       62 
     | 
    
         
            -
              }
         
     | 
| 
       63 
     | 
    
         
            -
              // 對應colorType設定的顏色
         
     | 
| 
       64 
     | 
    
         
            -
              return colorType == 'none'
         
     | 
| 
       65 
     | 
    
         
            -
                ? 'none' 
         
     | 
| 
       66 
     | 
    
         
            -
                : fullChartParams.colors[fullChartParams.colorScheme][colorType] != undefined
         
     | 
| 
       67 
     | 
    
         
            -
                  ? fullChartParams.colors[fullChartParams.colorScheme][colorType]
         
     | 
| 
       68 
     | 
    
         
            -
                  : fullChartParams.colors[fullChartParams.colorScheme].primary
         
     | 
| 
       69 
     | 
    
         
            -
            }
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
            export function getClassName (pluginName: string, elementName: string, modifier?: string) {
         
     | 
| 
       72 
     | 
    
         
            -
              const modifierText = modifier ? `--${modifier}` : ''
         
     | 
| 
       73 
     | 
    
         
            -
              return `orbcharts-${pluginName}__${elementName}${modifierText}`
         
     | 
| 
       74 
     | 
    
         
            -
            }
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
            export function getUniID (pluginName: string, elementName: string) {
         
     | 
| 
       77 
     | 
    
         
            -
              const textLength = 5
         
     | 
| 
       78 
     | 
    
         
            -
              // 英文+數字
         
     | 
| 
       79 
     | 
    
         
            -
              const randomText: string = Math.random().toString(36).substr(2, textLength)
         
     | 
| 
       80 
     | 
    
         
            -
              
         
     | 
| 
       81 
     | 
    
         
            -
              return getClassName(pluginName, elementName, randomText)
         
     | 
| 
       82 
     | 
    
         
            -
            }
         
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            export function calcAxesSize ({ xAxisPosition, yAxisPosition, width, height }: {
         
     | 
| 
       86 
     | 
    
         
            -
              xAxisPosition: AxisPosition
         
     | 
| 
       87 
     | 
    
         
            -
              yAxisPosition: AxisPosition
         
     | 
| 
       88 
     | 
    
         
            -
              width: number
         
     | 
| 
       89 
     | 
    
         
            -
              height: number
         
     | 
| 
       90 
     | 
    
         
            -
            }) {
         
     | 
| 
       91 
     | 
    
         
            -
              if ((xAxisPosition === 'bottom' || xAxisPosition === 'top') && (yAxisPosition === 'left' || yAxisPosition === 'right')) {
         
     | 
| 
       92 
     | 
    
         
            -
                return { width, height }
         
     | 
| 
       93 
     | 
    
         
            -
              } else if ((xAxisPosition === 'left' || xAxisPosition === 'right') && (yAxisPosition === 'bottom' || yAxisPosition === 'top')) {
         
     | 
| 
       94 
     | 
    
         
            -
                return {
         
     | 
| 
       95 
     | 
    
         
            -
                  width: height,
         
     | 
| 
       96 
     | 
    
         
            -
                  height: width
         
     | 
| 
       97 
     | 
    
         
            -
                }
         
     | 
| 
       98 
     | 
    
         
            -
              }
         
     | 
| 
       99 
     | 
    
         
            -
            }
         
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            import type {
         
     | 
| 
      
 2 
     | 
    
         
            +
              AxisPosition,
         
     | 
| 
      
 3 
     | 
    
         
            +
              ColorType,
         
     | 
| 
      
 4 
     | 
    
         
            +
              ChartParams,
         
     | 
| 
      
 5 
     | 
    
         
            +
              ComputedDatumBase,
         
     | 
| 
      
 6 
     | 
    
         
            +
              ComputedDatumSeriesValue,
         
     | 
| 
      
 7 
     | 
    
         
            +
              ComputedDatumCategoryValue } from '../../lib/core-types'
         
     | 
| 
      
 8 
     | 
    
         
            +
            import { getMinAndMax } from './commonUtils'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            // 取得最小及最大值 - datum格式陣列資料
         
     | 
| 
      
 11 
     | 
    
         
            +
            export function getMinAndMaxValue (data: ComputedDatumBase[]): [number, number] {
         
     | 
| 
      
 12 
     | 
    
         
            +
              const arr = data
         
     | 
| 
      
 13 
     | 
    
         
            +
                .filter(d => d.value != null && d.visible != false)
         
     | 
| 
      
 14 
     | 
    
         
            +
                .map(d => d.value as number)
         
     | 
| 
      
 15 
     | 
    
         
            +
              return getMinAndMax(arr)
         
     | 
| 
      
 16 
     | 
    
         
            +
            }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            // 取得colorType顏色
         
     | 
| 
      
 19 
     | 
    
         
            +
            export function getColor (colorType: ColorType, fullChartParams: ChartParams) {
         
     | 
| 
      
 20 
     | 
    
         
            +
              const colors = fullChartParams.colors[fullChartParams.colorScheme]
         
     | 
| 
      
 21 
     | 
    
         
            +
              // 對應series資料中第1個顏色
         
     | 
| 
      
 22 
     | 
    
         
            +
              if (colorType === 'series') {
         
     | 
| 
      
 23 
     | 
    
         
            +
                return colors.series[0]
         
     | 
| 
      
 24 
     | 
    
         
            +
              }
         
     | 
| 
      
 25 
     | 
    
         
            +
              // 對應colorType設定的顏色
         
     | 
| 
      
 26 
     | 
    
         
            +
              // return colors[colorType] != null
         
     | 
| 
      
 27 
     | 
    
         
            +
              //   ? colors[colorType]
         
     | 
| 
      
 28 
     | 
    
         
            +
              //   : colors.primary
         
     | 
| 
      
 29 
     | 
    
         
            +
              return colorType == 'none'
         
     | 
| 
      
 30 
     | 
    
         
            +
                ? 'none'
         
     | 
| 
      
 31 
     | 
    
         
            +
                : colors[colorType] != undefined
         
     | 
| 
      
 32 
     | 
    
         
            +
                  ? colors[colorType]
         
     | 
| 
      
 33 
     | 
    
         
            +
                  : colors.primary // 如果比對不到
         
     | 
| 
      
 34 
     | 
    
         
            +
            }
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            export function getSeriesValueColor () {
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            }
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            export function getCategoryValueColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumCategoryValue, colorType: ColorType, fullChartParams: ChartParams }) {
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            }
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            // // 取得Series顏色 @Q@ 待重構完後刪除
         
     | 
| 
      
 45 
     | 
    
         
            +
            // export function getSeriesColor (seriesIndex: number, fullChartParams: ChartParams) {
         
     | 
| 
      
 46 
     | 
    
         
            +
            //   const colorIndex = seriesIndex < fullChartParams.colors[fullChartParams.colorScheme].series.length
         
     | 
| 
      
 47 
     | 
    
         
            +
            //     ? seriesIndex
         
     | 
| 
      
 48 
     | 
    
         
            +
            //     : seriesIndex % fullChartParams.colors[fullChartParams.colorScheme].series.length
         
     | 
| 
      
 49 
     | 
    
         
            +
            //   return fullChartParams.colors[fullChartParams.colorScheme].series[colorIndex]
         
     | 
| 
      
 50 
     | 
    
         
            +
            // }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            // 取得Datum顏色 @Q@ 待重構完後刪除
         
     | 
| 
      
 53 
     | 
    
         
            +
            export function getDatumColor ({ datum, colorType, fullChartParams }: { datum: ComputedDatumBase, colorType: ColorType, fullChartParams: ChartParams }) {
         
     | 
| 
      
 54 
     | 
    
         
            +
              // 對應series資料中的顏色
         
     | 
| 
      
 55 
     | 
    
         
            +
              if (colorType === 'series') {
         
     | 
| 
      
 56 
     | 
    
         
            +
                if ((datum as unknown as ComputedDatumSeriesValue).color) {
         
     | 
| 
      
 57 
     | 
    
         
            +
                  return (datum as unknown as ComputedDatumSeriesValue).color
         
     | 
| 
      
 58 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 59 
     | 
    
         
            +
                  // 非series類型的資料則回傳陣列中第1個顏色
         
     | 
| 
      
 60 
     | 
    
         
            +
                  return fullChartParams.colors[fullChartParams.colorScheme].series[0]
         
     | 
| 
      
 61 
     | 
    
         
            +
                }
         
     | 
| 
      
 62 
     | 
    
         
            +
              }
         
     | 
| 
      
 63 
     | 
    
         
            +
              // 對應colorType設定的顏色
         
     | 
| 
      
 64 
     | 
    
         
            +
              return colorType == 'none'
         
     | 
| 
      
 65 
     | 
    
         
            +
                ? 'none' 
         
     | 
| 
      
 66 
     | 
    
         
            +
                : fullChartParams.colors[fullChartParams.colorScheme][colorType] != undefined
         
     | 
| 
      
 67 
     | 
    
         
            +
                  ? fullChartParams.colors[fullChartParams.colorScheme][colorType]
         
     | 
| 
      
 68 
     | 
    
         
            +
                  : fullChartParams.colors[fullChartParams.colorScheme].primary
         
     | 
| 
      
 69 
     | 
    
         
            +
            }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            export function getClassName (pluginName: string, elementName: string, modifier?: string) {
         
     | 
| 
      
 72 
     | 
    
         
            +
              const modifierText = modifier ? `--${modifier}` : ''
         
     | 
| 
      
 73 
     | 
    
         
            +
              return `orbcharts-${pluginName}__${elementName}${modifierText}`
         
     | 
| 
      
 74 
     | 
    
         
            +
            }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            export function getUniID (pluginName: string, elementName: string) {
         
     | 
| 
      
 77 
     | 
    
         
            +
              const textLength = 5
         
     | 
| 
      
 78 
     | 
    
         
            +
              // 英文+數字
         
     | 
| 
      
 79 
     | 
    
         
            +
              const randomText: string = Math.random().toString(36).substr(2, textLength)
         
     | 
| 
      
 80 
     | 
    
         
            +
              
         
     | 
| 
      
 81 
     | 
    
         
            +
              return getClassName(pluginName, elementName, randomText)
         
     | 
| 
      
 82 
     | 
    
         
            +
            }
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            export function calcAxesSize ({ xAxisPosition, yAxisPosition, width, height }: {
         
     | 
| 
      
 86 
     | 
    
         
            +
              xAxisPosition: AxisPosition
         
     | 
| 
      
 87 
     | 
    
         
            +
              yAxisPosition: AxisPosition
         
     | 
| 
      
 88 
     | 
    
         
            +
              width: number
         
     | 
| 
      
 89 
     | 
    
         
            +
              height: number
         
     | 
| 
      
 90 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 91 
     | 
    
         
            +
              if ((xAxisPosition === 'bottom' || xAxisPosition === 'top') && (yAxisPosition === 'left' || yAxisPosition === 'right')) {
         
     | 
| 
      
 92 
     | 
    
         
            +
                return { width, height }
         
     | 
| 
      
 93 
     | 
    
         
            +
              } else if ((xAxisPosition === 'left' || xAxisPosition === 'right') && (yAxisPosition === 'bottom' || yAxisPosition === 'top')) {
         
     | 
| 
      
 94 
     | 
    
         
            +
                return {
         
     | 
| 
      
 95 
     | 
    
         
            +
                  width: height,
         
     | 
| 
      
 96 
     | 
    
         
            +
                  height: width
         
     | 
| 
      
 97 
     | 
    
         
            +
                }
         
     | 
| 
      
 98 
     | 
    
         
            +
              }
         
     | 
| 
      
 99 
     | 
    
         
            +
            }
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
    
        package/tsconfig.base.json
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {
         
     | 
| 
       2 
     | 
    
         
            -
              "compilerOptions": {
         
     | 
| 
       3 
     | 
    
         
            -
                "outDir": "./dist/",
         
     | 
| 
       4 
     | 
    
         
            -
                "sourceMap": true,
         
     | 
| 
       5 
     | 
    
         
            -
                "noImplicitAny": true,
         
     | 
| 
       6 
     | 
    
         
            -
                "module": "esnext",
         
     | 
| 
       7 
     | 
    
         
            -
                "target": "es5",
         
     | 
| 
       8 
     | 
    
         
            -
                "jsx": "react",
         
     | 
| 
       9 
     | 
    
         
            -
                "allowJs": true,
         
     | 
| 
       10 
     | 
    
         
            -
                "moduleResolution": "node",
         
     | 
| 
       11 
     | 
    
         
            -
                "allowSyntheticDefaultImports" : true,
         
     | 
| 
       12 
     | 
    
         
            -
                "esModuleInterop" : true
         
     | 
| 
       13 
     | 
    
         
            -
              }
         
     | 
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "compilerOptions": {
         
     | 
| 
      
 3 
     | 
    
         
            +
                "outDir": "./dist/",
         
     | 
| 
      
 4 
     | 
    
         
            +
                "sourceMap": true,
         
     | 
| 
      
 5 
     | 
    
         
            +
                "noImplicitAny": true,
         
     | 
| 
      
 6 
     | 
    
         
            +
                "module": "esnext",
         
     | 
| 
      
 7 
     | 
    
         
            +
                "target": "es5",
         
     | 
| 
      
 8 
     | 
    
         
            +
                "jsx": "react",
         
     | 
| 
      
 9 
     | 
    
         
            +
                "allowJs": true,
         
     | 
| 
      
 10 
     | 
    
         
            +
                "moduleResolution": "node",
         
     | 
| 
      
 11 
     | 
    
         
            +
                "allowSyntheticDefaultImports" : true,
         
     | 
| 
      
 12 
     | 
    
         
            +
                "esModuleInterop" : true
         
     | 
| 
      
 13 
     | 
    
         
            +
              }
         
     | 
| 
       14 
14 
     | 
    
         
             
            }
         
     | 
    
        package/tsconfig.json
    CHANGED
    
    | 
         @@ -1,3 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {
         
     | 
| 
       2 
     | 
    
         
            -
              "extends": "./tsconfig.base.json"
         
     | 
| 
      
 1 
     | 
    
         
            +
            {
         
     | 
| 
      
 2 
     | 
    
         
            +
              "extends": "./tsconfig.base.json"
         
     | 
| 
       3 
3 
     | 
    
         
             
            }
         
     | 
    
        package/vite.config.js
    CHANGED
    
    | 
         @@ -1,23 +1,23 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { defineConfig } from 'vite'
         
     | 
| 
       2 
     | 
    
         
            -
            import dts from 'vite-plugin-dts'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            export default defineConfig(({ command, mode }) => {
         
     | 
| 
       5 
     | 
    
         
            -
              return {
         
     | 
| 
       6 
     | 
    
         
            -
                plugins: [
         
     | 
| 
       7 
     | 
    
         
            -
                  dts({
         
     | 
| 
       8 
     | 
    
         
            -
                    insertTypesEntry: true
         
     | 
| 
       9 
     | 
    
         
            -
                  })
         
     | 
| 
       10 
     | 
    
         
            -
                ],
         
     | 
| 
       11 
     | 
    
         
            -
                compilerOptions: {
         
     | 
| 
       12 
     | 
    
         
            -
                  composite: true
         
     | 
| 
       13 
     | 
    
         
            -
                },
         
     | 
| 
       14 
     | 
    
         
            -
                build: {
         
     | 
| 
       15 
     | 
    
         
            -
                  lib: {
         
     | 
| 
       16 
     | 
    
         
            -
                    entry: "src/index.ts",
         
     | 
| 
       17 
     | 
    
         
            -
                    name: 'orbcharts-plugins-basic',
         
     | 
| 
       18 
     | 
    
         
            -
                    formats: ["es", "umd"],
         
     | 
| 
       19 
     | 
    
         
            -
                    fileName: format => `orbcharts-plugins-basic.${format}.js`
         
     | 
| 
       20 
     | 
    
         
            -
                  },
         
     | 
| 
       21 
     | 
    
         
            -
                }
         
     | 
| 
       22 
     | 
    
         
            -
              }
         
     | 
| 
      
 1 
     | 
    
         
            +
            import { defineConfig } from 'vite'
         
     | 
| 
      
 2 
     | 
    
         
            +
            import dts from 'vite-plugin-dts'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            export default defineConfig(({ command, mode }) => {
         
     | 
| 
      
 5 
     | 
    
         
            +
              return {
         
     | 
| 
      
 6 
     | 
    
         
            +
                plugins: [
         
     | 
| 
      
 7 
     | 
    
         
            +
                  dts({
         
     | 
| 
      
 8 
     | 
    
         
            +
                    insertTypesEntry: true
         
     | 
| 
      
 9 
     | 
    
         
            +
                  })
         
     | 
| 
      
 10 
     | 
    
         
            +
                ],
         
     | 
| 
      
 11 
     | 
    
         
            +
                compilerOptions: {
         
     | 
| 
      
 12 
     | 
    
         
            +
                  composite: true
         
     | 
| 
      
 13 
     | 
    
         
            +
                },
         
     | 
| 
      
 14 
     | 
    
         
            +
                build: {
         
     | 
| 
      
 15 
     | 
    
         
            +
                  lib: {
         
     | 
| 
      
 16 
     | 
    
         
            +
                    entry: "src/index.ts",
         
     | 
| 
      
 17 
     | 
    
         
            +
                    name: 'orbcharts-plugins-basic',
         
     | 
| 
      
 18 
     | 
    
         
            +
                    formats: ["es", "umd"],
         
     | 
| 
      
 19 
     | 
    
         
            +
                    fileName: format => `orbcharts-plugins-basic.${format}.js`
         
     | 
| 
      
 20 
     | 
    
         
            +
                  },
         
     | 
| 
      
 21 
     | 
    
         
            +
                }
         
     | 
| 
      
 22 
     | 
    
         
            +
              }
         
     | 
| 
       23 
23 
     | 
    
         
             
            })
         
     |