@orbcharts/core 3.0.0-beta.10 → 3.0.0-beta.12
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/dist/orbcharts-core.es.js +2585 -2227
 - package/dist/orbcharts-core.umd.js +4 -4
 - package/dist/src/defaults.d.ts +2 -2
 - package/dist/src/utils/gridObservables.d.ts +8 -4
 - package/dist/src/utils/index.d.ts +0 -3
 - package/dist/src/utils/multiGridObservables.d.ts +3 -2
 - package/dist/src/utils/multiValueObservables.d.ts +76 -29
 - package/dist/src/utils/observables.d.ts +8 -1
 - package/dist/src/utils/orbchartsUtils.d.ts +9 -9
 - package/dist/src/utils/seriesObservables.d.ts +1 -1
 - package/package.json +2 -2
 - package/src/base/createBaseChart.ts +4 -3
 - package/src/base/createBasePlugin.ts +5 -4
 - package/src/defaults.ts +46 -12
 - package/src/grid/contextObserverCallback.ts +31 -9
 - package/src/grid/dataFormatterValidator.ts +42 -23
 - package/src/multiGrid/contextObserverCallback.ts +38 -7
 - package/src/multiValue/computedDataFn.ts +4 -1
 - package/src/multiValue/contextObserverCallback.ts +159 -43
 - package/src/multiValue/dataFormatterValidator.ts +85 -5
 - package/src/multiValue/dataValidator.ts +9 -6
 - package/src/relationship/dataFormatterValidator.ts +10 -6
 - package/src/relationship/dataValidator.ts +10 -6
 - package/src/series/contextObserverCallback.ts +18 -11
 - package/src/tree/dataValidator.ts +1 -1
 - package/src/utils/gridObservables.ts +32 -10
 - package/src/utils/index.ts +3 -3
 - package/src/utils/multiGridObservables.ts +34 -25
 - package/src/utils/multiValueObservables.ts +479 -97
 - package/src/utils/observables.ts +47 -3
 - package/src/utils/orbchartsUtils.ts +9 -9
 - package/src/utils/seriesObservables.ts +4 -4
 
    
        package/src/utils/observables.ts
    CHANGED
    
    | 
         @@ -15,6 +15,7 @@ import type { 
     | 
|
| 
       15 
15 
     | 
    
         
             
              ComputedDatumBase,
         
     | 
| 
       16 
16 
     | 
    
         
             
              ComputedDataTypeMap,
         
     | 
| 
       17 
17 
     | 
    
         
             
              ComputedDatumTypeMap,
         
     | 
| 
      
 18 
     | 
    
         
            +
              ContainerPositionScaled,
         
     | 
| 
       18 
19 
     | 
    
         
             
              DataFormatterTypeMap,
         
     | 
| 
       19 
20 
     | 
    
         
             
              EventTypeMap,
         
     | 
| 
       20 
21 
     | 
    
         
             
              HighlightTarget,
         
     | 
| 
         @@ -73,7 +74,7 @@ export const highlightObservable = <T extends ChartType, D>({ datumList$, fullCh 
     | 
|
| 
       73 
74 
     | 
    
         
             
                    groupLabel: null,
         
     | 
| 
       74 
75 
     | 
    
         
             
                    categoryLabel: null,
         
     | 
| 
       75 
76 
     | 
    
         
             
                    highlightDefault: d.highlightDefault
         
     | 
| 
       76 
     | 
    
         
            -
                  }
         
     | 
| 
      
 77 
     | 
    
         
            +
                  } as HighlightTargetValue
         
     | 
| 
       77 
78 
     | 
    
         
             
                }),
         
     | 
| 
       78 
79 
     | 
    
         
             
                distinctUntilChanged()
         
     | 
| 
       79 
80 
     | 
    
         
             
              )
         
     | 
| 
         @@ -94,7 +95,7 @@ export const highlightObservable = <T extends ChartType, D>({ datumList$, fullCh 
     | 
|
| 
       94 
95 
     | 
    
         
             
                      groupLabel: d.datum.groupLabel,
         
     | 
| 
       95 
96 
     | 
    
         
             
                      categoryLabel: d.datum.categoryLabel,
         
     | 
| 
       96 
97 
     | 
    
         
             
                      highlightDefault: null
         
     | 
| 
       97 
     | 
    
         
            -
                    }
         
     | 
| 
      
 98 
     | 
    
         
            +
                    } as HighlightTargetValue
         
     | 
| 
       98 
99 
     | 
    
         
             
                    : {
         
     | 
| 
       99 
100 
     | 
    
         
             
                      id: null,
         
     | 
| 
       100 
101 
     | 
    
         
             
                      label: null,
         
     | 
| 
         @@ -102,7 +103,7 @@ export const highlightObservable = <T extends ChartType, D>({ datumList$, fullCh 
     | 
|
| 
       102 
103 
     | 
    
         
             
                      groupLabel: null,
         
     | 
| 
       103 
104 
     | 
    
         
             
                      categoryLabel: null,
         
     | 
| 
       104 
105 
     | 
    
         
             
                      highlightDefault: null
         
     | 
| 
       105 
     | 
    
         
            -
                    }
         
     | 
| 
      
 106 
     | 
    
         
            +
                    } as HighlightTargetValue
         
     | 
| 
       106 
107 
     | 
    
         
             
                })
         
     | 
| 
       107 
108 
     | 
    
         
             
              )
         
     | 
| 
       108 
109 
     | 
    
         
             
              const highlightMouseout$ = event$.pipe(
         
     | 
| 
         @@ -235,4 +236,47 @@ export const textSizePxObservable = (chartParams$: Observable<ChartParams>) => { 
     | 
|
| 
       235 
236 
     | 
    
         
             
                  return value ? value : 14 // default
         
     | 
| 
       236 
237 
     | 
    
         
             
                })
         
     | 
| 
       237 
238 
     | 
    
         
             
              )
         
     | 
| 
      
 239 
     | 
    
         
            +
            }
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
            export const containerSizeObservable = ({ layout$, containerPosition$ }: {
         
     | 
| 
      
 242 
     | 
    
         
            +
              layout$: Observable<Layout>
         
     | 
| 
      
 243 
     | 
    
         
            +
              containerPosition$: Observable<ContainerPositionScaled[]>
         
     | 
| 
      
 244 
     | 
    
         
            +
            }) => {
         
     | 
| 
      
 245 
     | 
    
         
            +
              const rowAmount$ = containerPosition$.pipe(
         
     | 
| 
      
 246 
     | 
    
         
            +
                map(containerPosition => {
         
     | 
| 
      
 247 
     | 
    
         
            +
                  const maxRowIndex = containerPosition.reduce((acc, current) => {
         
     | 
| 
      
 248 
     | 
    
         
            +
                    return current.rowIndex > acc ? current.rowIndex : acc
         
     | 
| 
      
 249 
     | 
    
         
            +
                  }, 0)
         
     | 
| 
      
 250 
     | 
    
         
            +
                  return maxRowIndex + 1
         
     | 
| 
      
 251 
     | 
    
         
            +
                }),
         
     | 
| 
      
 252 
     | 
    
         
            +
                distinctUntilChanged(),
         
     | 
| 
      
 253 
     | 
    
         
            +
              )
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
              const columnAmount$ = containerPosition$.pipe(
         
     | 
| 
      
 256 
     | 
    
         
            +
                map(containerPosition => {
         
     | 
| 
      
 257 
     | 
    
         
            +
                  const maxColumnIndex = containerPosition.reduce((acc, current) => {
         
     | 
| 
      
 258 
     | 
    
         
            +
                    return current.columnIndex > acc ? current.columnIndex : acc
         
     | 
| 
      
 259 
     | 
    
         
            +
                  }, 0)
         
     | 
| 
      
 260 
     | 
    
         
            +
                  return maxColumnIndex + 1
         
     | 
| 
      
 261 
     | 
    
         
            +
                }),
         
     | 
| 
      
 262 
     | 
    
         
            +
                distinctUntilChanged()
         
     | 
| 
      
 263 
     | 
    
         
            +
              )
         
     | 
| 
      
 264 
     | 
    
         
            +
             
     | 
| 
      
 265 
     | 
    
         
            +
              return combineLatest({
         
     | 
| 
      
 266 
     | 
    
         
            +
                layout: layout$,
         
     | 
| 
      
 267 
     | 
    
         
            +
                rowAmount: rowAmount$,
         
     | 
| 
      
 268 
     | 
    
         
            +
                columnAmount: columnAmount$
         
     | 
| 
      
 269 
     | 
    
         
            +
              }).pipe(
         
     | 
| 
      
 270 
     | 
    
         
            +
                switchMap(async (d) => d),
         
     | 
| 
      
 271 
     | 
    
         
            +
                map(data => {
         
     | 
| 
      
 272 
     | 
    
         
            +
                  const width = (data.layout.rootWidth / data.columnAmount) - (data.layout.left + data.layout.right)
         
     | 
| 
      
 273 
     | 
    
         
            +
                  const height = (data.layout.rootHeight / data.rowAmount) - (data.layout.top + data.layout.bottom)
         
     | 
| 
      
 274 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 275 
     | 
    
         
            +
                    width,
         
     | 
| 
      
 276 
     | 
    
         
            +
                    height
         
     | 
| 
      
 277 
     | 
    
         
            +
                  }
         
     | 
| 
      
 278 
     | 
    
         
            +
                }),
         
     | 
| 
      
 279 
     | 
    
         
            +
                distinctUntilChanged((a, b) => a.width === b.width && a.height === b.height),
         
     | 
| 
      
 280 
     | 
    
         
            +
                // shareReplay(1)
         
     | 
| 
      
 281 
     | 
    
         
            +
              )
         
     | 
| 
       238 
282 
     | 
    
         
             
            }
         
     | 
| 
         @@ -13,7 +13,7 @@ import type { 
     | 
|
| 
       13 
13 
     | 
    
         
             
              DataMultiValue,
         
     | 
| 
       14 
14 
     | 
    
         
             
              DataMultiValueDatum,
         
     | 
| 
       15 
15 
     | 
    
         
             
              DataMultiValueValue,
         
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
      
 16 
     | 
    
         
            +
              ComputedXYDatumMultiValue,
         
     | 
| 
       17 
17 
     | 
    
         
             
              DataFormatterContainer,
         
     | 
| 
       18 
18 
     | 
    
         
             
              SeriesDirection,
         
     | 
| 
       19 
19 
     | 
    
         
             
              DataFormatterGridGrid,
         
     | 
| 
         @@ -192,17 +192,17 @@ export function getMinMaxMultiValue (data: DataMultiValue, valueIndex: number): 
     | 
|
| 
       192 
192 
     | 
    
         
             
            }
         
     | 
| 
       193 
193 
     | 
    
         | 
| 
       194 
194 
     | 
    
         
             
            export function getMinMaxMultiValueXY ({ data, minX, maxX, minY, maxY }: {
         
     | 
| 
       195 
     | 
    
         
            -
              data:  
     | 
| 
      
 195 
     | 
    
         
            +
              data: ComputedXYDatumMultiValue[][]
         
     | 
| 
       196 
196 
     | 
    
         
             
              minX: number
         
     | 
| 
       197 
197 
     | 
    
         
             
              maxX: number
         
     | 
| 
       198 
198 
     | 
    
         
             
              minY: number
         
     | 
| 
       199 
199 
     | 
    
         
             
              maxY: number
         
     | 
| 
       200 
200 
     | 
    
         
             
            }) {
         
     | 
| 
       201 
     | 
    
         
            -
              let filteredData:  
     | 
| 
       202 
     | 
    
         
            -
              let minXDatum:  
     | 
| 
       203 
     | 
    
         
            -
              let maxXDatum:  
     | 
| 
       204 
     | 
    
         
            -
              let minYDatum:  
     | 
| 
       205 
     | 
    
         
            -
              let maxYDatum:  
     | 
| 
      
 201 
     | 
    
         
            +
              let filteredData: ComputedXYDatumMultiValue[][] = []
         
     | 
| 
      
 202 
     | 
    
         
            +
              let minXDatum: ComputedXYDatumMultiValue | null = null
         
     | 
| 
      
 203 
     | 
    
         
            +
              let maxXDatum: ComputedXYDatumMultiValue | null = null
         
     | 
| 
      
 204 
     | 
    
         
            +
              let minYDatum: ComputedXYDatumMultiValue | null = null
         
     | 
| 
      
 205 
     | 
    
         
            +
              let maxYDatum: ComputedXYDatumMultiValue | null = null
         
     | 
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
              for (let categoryData of data) {
         
     | 
| 
       208 
208 
     | 
    
         
             
                for (let datum of categoryData) {
         
     | 
| 
         @@ -291,7 +291,7 @@ function calcGridDimensions (amount: number): { rowAmount: number; columnAmount: 
     | 
|
| 
       291 
291 
     | 
    
         
             
              return { rowAmount, columnAmount }
         
     | 
| 
       292 
292 
     | 
    
         
             
            }
         
     | 
| 
       293 
293 
     | 
    
         | 
| 
       294 
     | 
    
         
            -
            export function  
     | 
| 
      
 294 
     | 
    
         
            +
            export function calcContainerPosition (layout: Layout, container: DataFormatterContainer, amount: number): ContainerPosition[] {
         
     | 
| 
       295 
295 
     | 
    
         
             
              const { gap } = container
         
     | 
| 
       296 
296 
     | 
    
         
             
              const { rowAmount, columnAmount } = (container.rowAmount * container.columnAmount) >= amount
         
     | 
| 
       297 
297 
     | 
    
         
             
                // 如果container設定的rowAmount和columnAmount的乘積大於或等於amount,則使用目前設定
         
     | 
| 
         @@ -324,7 +324,7 @@ export function calcSeriesContainerLayout (layout: Layout, container: DataFormat 
     | 
|
| 
       324 
324 
     | 
    
         
             
              })
         
     | 
| 
       325 
325 
     | 
    
         
             
            }
         
     | 
| 
       326 
326 
     | 
    
         | 
| 
       327 
     | 
    
         
            -
            export function  
     | 
| 
      
 327 
     | 
    
         
            +
            export function calcContainerPositionScaled (layout: Layout, container: DataFormatterContainer, amount: number): ContainerPositionScaled[] {
         
     | 
| 
       328 
328 
     | 
    
         
             
              const { gap } = container
         
     | 
| 
       329 
329 
     | 
    
         
             
              const { rowAmount, columnAmount } = (container.rowAmount * container.columnAmount) >= amount
         
     | 
| 
       330 
330 
     | 
    
         
             
                // 如果container設定的rowAmount和columnAmount的乘積大於或等於amount,則使用目前設定
         
     | 
| 
         @@ -16,7 +16,7 @@ import type { 
     | 
|
| 
       16 
16 
     | 
    
         
             
              DataFormatterTypeMap,
         
     | 
| 
       17 
17 
     | 
    
         
             
              ContainerPosition,
         
     | 
| 
       18 
18 
     | 
    
         
             
              Layout } from '../../lib/core-types'
         
     | 
| 
       19 
     | 
    
         
            -
            import {  
     | 
| 
      
 19 
     | 
    
         
            +
            import { calcContainerPosition } from './orbchartsUtils'
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
            export const separateSeriesObservable = ({ fullDataFormatter$ }: { fullDataFormatter$: Observable<DataFormatterTypeMap<'series'>> }) => {
         
     | 
| 
       22 
22 
     | 
    
         
             
              return fullDataFormatter$.pipe(
         
     | 
| 
         @@ -50,7 +50,7 @@ export const seriesVisibleComputedDataObservable = ({ computedData$ }: { compute 
     | 
|
| 
       50 
50 
     | 
    
         
             
              )
         
     | 
| 
       51 
51 
     | 
    
         
             
            }
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
            export const  
     | 
| 
      
 53 
     | 
    
         
            +
            export const seriesComputedSortedDataObservable = ({ computedData$, fullDataFormatter$ }: {
         
     | 
| 
       54 
54 
     | 
    
         
             
              computedData$: Observable<ComputedDataTypeMap<'series'>>,
         
     | 
| 
       55 
55 
     | 
    
         
             
              fullDataFormatter$: Observable<DataFormatterTypeMap<'series'>>
         
     | 
| 
       56 
56 
     | 
    
         
             
            }) => {
         
     | 
| 
         @@ -109,7 +109,7 @@ export const seriesContainerPositionObservable = ({ computedData$, fullDataForma 
     | 
|
| 
       109 
109 
     | 
    
         | 
| 
       110 
110 
     | 
    
         
             
                  if (data.fullDataFormatter.separateSeries) {
         
     | 
| 
       111 
111 
     | 
    
         
             
                    // -- 依slotIndexes計算 --
         
     | 
| 
       112 
     | 
    
         
            -
                    return  
     | 
| 
      
 112 
     | 
    
         
            +
                    return calcContainerPosition(data.layout, data.fullDataFormatter.container, data.computedData.length)
         
     | 
| 
       113 
113 
     | 
    
         
             
                    // return data.computedData.map((seriesData, seriesIndex) => {
         
     | 
| 
       114 
114 
     | 
    
         
             
                    //   const columnIndex = seriesIndex % data.fullDataFormatter.container.columnAmount
         
     | 
| 
       115 
115 
     | 
    
         
             
                    //   const rowIndex = Math.floor(seriesIndex / data.fullDataFormatter.container.columnAmount)
         
     | 
| 
         @@ -128,7 +128,7 @@ export const seriesContainerPositionObservable = ({ computedData$, fullDataForma 
     | 
|
| 
       128 
128 
     | 
    
         
             
                    // })
         
     | 
| 
       129 
129 
     | 
    
         
             
                  } else {
         
     | 
| 
       130 
130 
     | 
    
         
             
                    // -- 無拆分 --
         
     | 
| 
       131 
     | 
    
         
            -
                    return  
     | 
| 
      
 131 
     | 
    
         
            +
                    return calcContainerPosition(data.layout, data.fullDataFormatter.container, 1)
         
     | 
| 
       132 
132 
     | 
    
         
             
                    // const columnIndex = 0
         
     | 
| 
       133 
133 
     | 
    
         
             
                    // const rowIndex = 0
         
     | 
| 
       134 
134 
     | 
    
         
             
                    // return data.computedData.map((seriesData, seriesIndex) => {
         
     |