@orbcharts/plugins-basic 3.0.0-alpha.49 → 3.0.0-alpha.51
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/dist/orbcharts-plugins-basic.es.js +6325 -6272
- package/dist/orbcharts-plugins-basic.umd.js +8 -8
- package/dist/src/base/BaseGroupAxis.d.ts +1 -0
- package/dist/src/grid/index.d.ts +1 -1
- package/dist/src/grid/plugins/BarsPN.d.ts +1 -0
- package/dist/src/grid/types.d.ts +3 -2
- package/dist/src/multiGrid/defaults.d.ts +2 -1
- package/dist/src/multiGrid/index.d.ts +2 -0
- package/dist/src/multiGrid/multiGridObservables.d.ts +1 -1
- package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +1 -0
- package/dist/src/multiGrid/types.d.ts +3 -0
- package/dist/src/series/types.d.ts +2 -3
- package/package.json +42 -42
- package/src/base/BaseBarStack.ts +778 -778
- package/src/base/BaseBars.ts +764 -764
- package/src/base/BaseBarsTriangle.ts +672 -672
- package/src/base/BaseDots.ts +513 -502
- package/src/base/BaseGroupAxis.ts +562 -496
- package/src/base/BaseLegend.ts +641 -641
- package/src/base/BaseLineAreas.ts +625 -625
- package/src/base/BaseLines.ts +699 -699
- package/src/base/BaseValueAxis.ts +478 -478
- package/src/base/types.ts +2 -2
- package/src/grid/defaults.ts +125 -121
- package/src/grid/gridObservables.ts +248 -247
- package/src/grid/index.ts +15 -15
- package/src/grid/plugins/BarStack.ts +43 -50
- package/src/grid/plugins/Bars.ts +44 -51
- package/src/grid/plugins/{BarsDiverging.ts → BarsPN.ts} +41 -41
- package/src/grid/plugins/BarsTriangle.ts +42 -50
- package/src/grid/plugins/Dots.ts +37 -37
- package/src/grid/plugins/GridLegend.ts +59 -59
- package/src/grid/plugins/GroupAux.ts +645 -645
- package/src/grid/plugins/GroupAxis.ts +35 -42
- package/src/grid/plugins/LineAreas.ts +39 -39
- package/src/grid/plugins/Lines.ts +38 -38
- package/src/grid/plugins/ScalingArea.ts +173 -173
- package/src/grid/plugins/ValueAxis.ts +36 -43
- package/src/grid/plugins/ValueStackAxis.ts +38 -79
- package/src/grid/types.ts +122 -120
- package/src/index.ts +9 -9
- package/src/multiGrid/defaults.ts +152 -147
- package/src/multiGrid/index.ts +14 -12
- package/src/multiGrid/multiGridObservables.ts +44 -43
- package/src/multiGrid/plugins/MultiBarStack.ts +78 -78
- package/src/multiGrid/plugins/MultiBars.ts +77 -77
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +77 -77
- package/src/multiGrid/plugins/MultiDots.ts +65 -65
- package/src/multiGrid/plugins/MultiGridLegend.ts +89 -89
- package/src/multiGrid/plugins/MultiGroupAxis.ts +69 -69
- package/src/multiGrid/plugins/MultiLineAreas.ts +67 -67
- package/src/multiGrid/plugins/MultiLines.ts +66 -66
- package/src/multiGrid/plugins/MultiValueAxis.ts +69 -69
- package/src/multiGrid/plugins/MultiValueStackAxis.ts +69 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +166 -173
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +167 -0
- package/src/multiGrid/types.ts +71 -67
- package/src/noneData/defaults.ts +64 -64
- package/src/noneData/index.ts +3 -3
- package/src/noneData/plugins/Container.ts +10 -10
- package/src/noneData/plugins/Tooltip.ts +310 -310
- package/src/noneData/types.ts +26 -26
- package/src/series/defaults.ts +126 -126
- package/src/series/index.ts +9 -9
- package/src/series/plugins/Bubbles.ts +545 -602
- package/src/series/plugins/Pie.ts +576 -576
- package/src/series/plugins/PieEventTexts.ts +262 -262
- package/src/series/plugins/PieLabels.ts +304 -304
- package/src/series/plugins/Rose.ts +472 -472
- package/src/series/plugins/RoseLabels.ts +362 -362
- package/src/series/plugins/SeriesLegend.ts +59 -59
- package/src/series/seriesObservables.ts +145 -145
- package/src/series/seriesUtils.ts +51 -51
- package/src/series/types.ts +83 -83
- package/src/tree/defaults.ts +22 -22
- package/src/tree/index.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +59 -59
- package/src/tree/plugins/TreeMap.ts +305 -305
- package/src/tree/types.ts +23 -23
- package/src/utils/commonUtils.ts +21 -21
- package/src/utils/d3Graphics.ts +124 -124
- package/src/utils/d3Utils.ts +73 -73
- package/src/utils/observables.ts +14 -14
- package/src/utils/orbchartsUtils.ts +100 -100
- package/tsconfig.dev.json +16 -16
- package/tsconfig.json +13 -13
- package/tsconfig.prod.json +13 -13
- package/vite.config.js +49 -49
- package/dist/src/grid/plugins/BarsDiverging.d.ts +0 -1
| @@ -1,311 +1,311 @@ | |
| 1 | 
            -
            import * as d3 from 'd3'
         | 
| 2 | 
            -
            import {
         | 
| 3 | 
            -
              combineLatest,
         | 
| 4 | 
            -
              map,
         | 
| 5 | 
            -
              merge,
         | 
| 6 | 
            -
              filter,
         | 
| 7 | 
            -
              switchMap,
         | 
| 8 | 
            -
              first,
         | 
| 9 | 
            -
              iif,
         | 
| 10 | 
            -
              takeUntil,
         | 
| 11 | 
            -
              Subject, 
         | 
| 12 | 
            -
              Observable,
         | 
| 13 | 
            -
              distinctUntilChanged } from 'rxjs'
         | 
| 14 | 
            -
            import type {
         | 
| 15 | 
            -
              EventTypeMap, PluginConstructor, ChartType } from '@orbcharts/core'
         | 
| 16 | 
            -
            import { defineNoneDataPlugin } from '@orbcharts/core'
         | 
| 17 | 
            -
            import { getSvgGElementSize, appendSvg } from '../../utils/d3Utils'
         | 
| 18 | 
            -
            import { getColor, getClassName } from '../../utils/orbchartsUtils'
         | 
| 19 | 
            -
            import { TOOLTIP_PARAMS } from '../defaults'
         | 
| 20 | 
            -
            import { textSizePxObservable } from '@orbcharts/core'
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            interface TooltipStyle {
         | 
| 23 | 
            -
              backgroundColor: string
         | 
| 24 | 
            -
              backgroundOpacity: number
         | 
| 25 | 
            -
              strokeColor: string
         | 
| 26 | 
            -
              offset: [number, number]
         | 
| 27 | 
            -
              padding: number
         | 
| 28 | 
            -
              textColor: string
         | 
| 29 | 
            -
              textSize: number | string // chartParams上的設定
         | 
| 30 | 
            -
              textSizePx: number
         | 
| 31 | 
            -
            }
         | 
| 32 | 
            -
             | 
| 33 | 
            -
            const pluginName = 'Tooltip'
         | 
| 34 | 
            -
            const gClassName = getClassName(pluginName, 'g')
         | 
| 35 | 
            -
            const boxClassName = getClassName(pluginName, 'box')
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            function textToSvg (textArr: string[], textStyle: TooltipStyle) {
         | 
| 38 | 
            -
              const lineHeight = textStyle.textSizePx * 1.5
         | 
| 39 | 
            -
              return textArr
         | 
| 40 | 
            -
                .filter(d => d != '')
         | 
| 41 | 
            -
                .map((text, i) => {
         | 
| 42 | 
            -
                  const top = i * lineHeight
         | 
| 43 | 
            -
                  return `<text font-size="${textStyle.textSize}" fill="${textStyle.textColor}" x="0" y="${top}" style="dominant-baseline:text-before-edge">${text}</text>`
         | 
| 44 | 
            -
                })
         | 
| 45 | 
            -
                .join()
         | 
| 46 | 
            -
            }
         | 
| 47 | 
            -
             | 
| 48 | 
            -
            function renderTooltip ({ rootSelection, pluginName, rootWidth, rootHeight, svgString, tooltipStyle, event  }: {
         | 
| 49 | 
            -
              rootSelection: d3.Selection<any, unknown, any, unknown>
         | 
| 50 | 
            -
              pluginName: string
         | 
| 51 | 
            -
              rootWidth: number
         | 
| 52 | 
            -
              rootHeight: number
         | 
| 53 | 
            -
              svgString: string
         | 
| 54 | 
            -
              tooltipStyle: TooltipStyle
         | 
| 55 | 
            -
              event: MouseEvent
         | 
| 56 | 
            -
            }) {
         | 
| 57 | 
            -
              // if (!svgString) {
         | 
| 58 | 
            -
              //   return
         | 
| 59 | 
            -
              // }
         | 
| 60 | 
            -
              // const rootSelection = d3.select('svg.bpcharts__root')
         | 
| 61 | 
            -
              // console.log('tooltip', { selection, rootWidth, rootHeight, svgString, event  })
         | 
| 62 | 
            -
              rootSelection.interrupt('fadeout')
         | 
| 63 | 
            -
              const radius = 5
         | 
| 64 | 
            -
             | 
| 65 | 
            -
              // data(svg string無值則為空陣列)
         | 
| 66 | 
            -
              const contentData = svgString ? [svgString] : []
         | 
| 67 | 
            -
              const styleData = svgString ? [tooltipStyle] : []
         | 
| 68 | 
            -
              // tooltipG <g>
         | 
| 69 | 
            -
              const tooltipG = rootSelection
         | 
| 70 | 
            -
                .selectAll<SVGGElement, string>(`g.${gClassName}`)
         | 
| 71 | 
            -
                .data(contentData)
         | 
| 72 | 
            -
                .join(
         | 
| 73 | 
            -
                  enter => {
         | 
| 74 | 
            -
                    return enter
         | 
| 75 | 
            -
                      .append('g')
         | 
| 76 | 
            -
                      .classed(gClassName, true)
         | 
| 77 | 
            -
                      .attr('pointer-events', 'none')
         | 
| 78 | 
            -
                  },
         | 
| 79 | 
            -
                  update => {
         | 
| 80 | 
            -
                    return update
         | 
| 81 | 
            -
                  },
         | 
| 82 | 
            -
                  exit => {
         | 
| 83 | 
            -
                    return exit
         | 
| 84 | 
            -
                      // .transition('fadeout')
         | 
| 85 | 
            -
                      // .duration(0)
         | 
| 86 | 
            -
                      // .delay(500)
         | 
| 87 | 
            -
                      .style('opacity', 0)
         | 
| 88 | 
            -
                      .remove()
         | 
| 89 | 
            -
                  }
         | 
| 90 | 
            -
                )
         | 
| 91 | 
            -
                .attr('transform', () => `translate(${event.offsetX}, ${event.offsetY})`)
         | 
| 92 | 
            -
             | 
| 93 | 
            -
              // tooltipBox <g><g>
         | 
| 94 | 
            -
              const tooltipBox = tooltipG
         | 
| 95 | 
            -
                .selectAll<SVGGElement, string>(`g.${boxClassName}`)
         | 
| 96 | 
            -
                .data(styleData)
         | 
| 97 | 
            -
                .join(
         | 
| 98 | 
            -
                  enter => {
         | 
| 99 | 
            -
                    return enter
         | 
| 100 | 
            -
                      .append('g')
         | 
| 101 | 
            -
                      .classed(getClassName(pluginName, 'box'), true)
         | 
| 102 | 
            -
                  },
         | 
| 103 | 
            -
                )
         | 
| 104 | 
            -
             | 
| 105 | 
            -
              // rect <g><g><rect>
         | 
| 106 | 
            -
              const rect = tooltipBox
         | 
| 107 | 
            -
                .selectAll<SVGRectElement, string>('rect')
         | 
| 108 | 
            -
                .data(styleData)
         | 
| 109 | 
            -
                .join(
         | 
| 110 | 
            -
                  enter => {
         | 
| 111 | 
            -
                    return enter
         | 
| 112 | 
            -
                      .append('rect')
         | 
| 113 | 
            -
                      .attr('rx', radius)
         | 
| 114 | 
            -
                      .attr('ry', radius)
         | 
| 115 | 
            -
                  }
         | 
| 116 | 
            -
                )
         | 
| 117 | 
            -
                .attr('fill', d => d.backgroundColor)
         | 
| 118 | 
            -
                .attr('stroke', d => d.strokeColor)
         | 
| 119 | 
            -
                .attr('opacity', d => d.backgroundOpacity)
         | 
| 120 | 
            -
             | 
| 121 | 
            -
              // text <g><g><g>
         | 
| 122 | 
            -
              const contentG = tooltipBox
         | 
| 123 | 
            -
                .selectAll<SVGGElement, string>('g')
         | 
| 124 | 
            -
                .data(contentData)
         | 
| 125 | 
            -
                .join(
         | 
| 126 | 
            -
                  enter => {
         | 
| 127 | 
            -
                    return enter
         | 
| 128 | 
            -
                      .append('g')
         | 
| 129 | 
            -
                      .classed(getClassName(pluginName, 'content'), true)
         | 
| 130 | 
            -
                      .attr('transform', () => `translate(${tooltipStyle.padding}, ${tooltipStyle.padding})`)
         | 
| 131 | 
            -
                  }
         | 
| 132 | 
            -
                )
         | 
| 133 | 
            -
              // 使用字串加入svg
         | 
| 134 | 
            -
              if (contentData.length) {
         | 
| 135 | 
            -
                appendSvg(contentG, contentData[0])
         | 
| 136 | 
            -
              }
         | 
| 137 | 
            -
              const contentSize = (contentG?.node()) ? getSvgGElementSize(contentG!) : { width: 0, height: 0 }
         | 
| 138 | 
            -
             | 
| 139 | 
            -
              // rect size
         | 
| 140 | 
            -
              rect
         | 
| 141 | 
            -
                .attr('width', contentSize.width + tooltipStyle.padding * 2)
         | 
| 142 | 
            -
                .attr('height', contentSize.height + tooltipStyle.padding * 2)
         | 
| 143 | 
            -
             | 
| 144 | 
            -
              // -- tooltipG --
         | 
| 145 | 
            -
              // 取得tooltip <g>的尺寸
         | 
| 146 | 
            -
              const tooltipSize = (tooltipBox?.node()) ? getSvgGElementSize(tooltipBox!) : { width: 0, height: 0 }
         | 
| 147 | 
            -
              // const minX = 0
         | 
| 148 | 
            -
              const maxX = rootWidth - tooltipSize.width
         | 
| 149 | 
            -
              // const minY = 0
         | 
| 150 | 
            -
              const maxY = rootHeight - tooltipSize.height
         | 
| 151 | 
            -
             | 
| 152 | 
            -
              // -- 相對游標位置的offset --
         | 
| 153 | 
            -
              const offsetX = (event.offsetX + tooltipStyle.offset[0]) > maxX ? maxX - event.offsetX : tooltipStyle.offset[0]
         | 
| 154 | 
            -
              const offsetY = (event.offsetY + tooltipStyle.offset[1]) > maxY ? maxY - event.offsetY : tooltipStyle.offset[1]
         | 
| 155 | 
            -
              tooltipBox.attr('transform', d => `translate(${offsetX}, ${offsetY})`)
         | 
| 156 | 
            -
              tooltipBox.attr('transform', d => `translate(${offsetX}, ${offsetY})`)
         | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
              // const minX = containerSize.x
         | 
| 161 | 
            -
              // const maxX = containerSize.x + containerSize.width - tooltipSize.width
         | 
| 162 | 
            -
              // const minY = containerSize.y
         | 
| 163 | 
            -
              // const maxY = containerSize.y + containerSize.height - tooltipSize.height
         | 
| 164 | 
            -
              
         | 
| 165 | 
            -
             | 
| 166 | 
            -
                // .style('position', 'absolute')
         | 
| 167 | 
            -
                // .style('z-index', 10000)
         | 
| 168 | 
            -
                // .style('left', (d) => {
         | 
| 169 | 
            -
                //   const x = d.x + this.fullParams.offsetX! - containerSize.x
         | 
| 170 | 
            -
                //   if (x < minX) {
         | 
| 171 | 
            -
                //     return `${minX}px`
         | 
| 172 | 
            -
                //   } else if (x > maxX) {
         | 
| 173 | 
            -
                //     return `${maxX}px`
         | 
| 174 | 
            -
                //   }
         | 
| 175 | 
            -
                //   return `${x}px`
         | 
| 176 | 
            -
                // })
         | 
| 177 | 
            -
                // .style('top', (d) => {
         | 
| 178 | 
            -
                //   const y = d.y + this.fullParams.offsetY! - containerSize.y
         | 
| 179 | 
            -
                //   if (y < minY) {
         | 
| 180 | 
            -
                //     return `${minY}px`
         | 
| 181 | 
            -
                //   } else if (y > maxY) {
         | 
| 182 | 
            -
                //     return `${maxY}px`
         | 
| 183 | 
            -
                //   }
         | 
| 184 | 
            -
                //   return `${y}px`
         | 
| 185 | 
            -
                // })
         | 
| 186 | 
            -
                // .html((d) => d.contentHtml)
         | 
| 187 | 
            -
              
         | 
| 188 | 
            -
             | 
| 189 | 
            -
            }
         | 
| 190 | 
            -
             | 
| 191 | 
            -
            export const Tooltip: PluginConstructor<any, string, any> = defineNoneDataPlugin(pluginName, TOOLTIP_PARAMS)(({ selection, rootSelection, name, chartType, observer, subject }) => {
         | 
| 192 | 
            -
              const destroy$ = new Subject()
         | 
| 193 | 
            -
             | 
| 194 | 
            -
              // 事件觸發
         | 
| 195 | 
            -
              const eventMouseover$: Observable<EventTypeMap<any>> = subject.event$.pipe(
         | 
| 196 | 
            -
                takeUntil(destroy$),
         | 
| 197 | 
            -
                filter(d => d.eventName === 'mouseover' || d.eventName === 'mousemove'),
         | 
| 198 | 
            -
                // distinctUntilChanged((prev, current) => prev.eventName === current.eventName)
         | 
| 199 | 
            -
                // map(d => d as EventTypeMap<typeof chartType>)
         | 
| 200 | 
            -
              )
         | 
| 201 | 
            -
              const eventMouseout$: Observable<EventTypeMap<any>> = subject.event$.pipe(
         | 
| 202 | 
            -
                takeUntil(destroy$),
         | 
| 203 | 
            -
                filter(d => d.eventName === 'mouseout'),
         | 
| 204 | 
            -
                // distinctUntilChanged((prev, current) => prev.eventName === current.eventName)
         | 
| 205 | 
            -
                // map(d => d as EventTypeMap<typeof chartType>)
         | 
| 206 | 
            -
              )
         | 
| 207 | 
            -
             | 
| 208 | 
            -
              const textSizePx$ = textSizePxObservable(observer.fullChartParams$)
         | 
| 209 | 
            -
             | 
| 210 | 
            -
              const tooltipStyle$: Observable<TooltipStyle> = combineLatest({
         | 
| 211 | 
            -
                fullChartParams: observer.fullChartParams$,
         | 
| 212 | 
            -
                fullParams: observer.fullParams$,
         | 
| 213 | 
            -
                textSizePx: textSizePx$
         | 
| 214 | 
            -
              }).pipe(
         | 
| 215 | 
            -
                takeUntil(destroy$),
         | 
| 216 | 
            -
                switchMap(async d => d),
         | 
| 217 | 
            -
                map(data => {
         | 
| 218 | 
            -
                  return {
         | 
| 219 | 
            -
                    backgroundColor: getColor(data.fullParams.backgroundColorType, data.fullChartParams),
         | 
| 220 | 
            -
                    backgroundOpacity: data.fullParams.backgroundOpacity,
         | 
| 221 | 
            -
                    strokeColor: getColor(data.fullParams.strokeColorType, data.fullChartParams),
         | 
| 222 | 
            -
                    offset: data.fullParams.offset,
         | 
| 223 | 
            -
                    padding: data.fullParams.padding,
         | 
| 224 | 
            -
                    textSize: data.fullChartParams.styles.textSize,
         | 
| 225 | 
            -
                    textSizePx: data.textSizePx,
         | 
| 226 | 
            -
                    textColor: getColor(data.fullParams.textColorType, data.fullChartParams),
         | 
| 227 | 
            -
                  }
         | 
| 228 | 
            -
                })
         | 
| 229 | 
            -
              )
         | 
| 230 | 
            -
             | 
| 231 | 
            -
              const contentRenderFn$: Observable<((eventData: EventTypeMap<any>) => string)> = combineLatest({
         | 
| 232 | 
            -
                fullParams: observer.fullParams$,
         | 
| 233 | 
            -
                tooltipStyle: tooltipStyle$
         | 
| 234 | 
            -
              }).pipe(
         | 
| 235 | 
            -
                takeUntil(destroy$),
         | 
| 236 | 
            -
                switchMap(async d => d),
         | 
| 237 | 
            -
                map(d => {
         | 
| 238 | 
            -
                  if (d.fullParams.svgRenderFn) {
         | 
| 239 | 
            -
                    return d.fullParams.svgRenderFn
         | 
| 240 | 
            -
                  }
         | 
| 241 | 
            -
                  // 將textRenderFn回傳的資料使用<text>包裝起來
         | 
| 242 | 
            -
                  return (eventData: EventTypeMap<any>) => {
         | 
| 243 | 
            -
                    const textArr = d.fullParams.textRenderFn(eventData as any)
         | 
| 244 | 
            -
                    return textToSvg(textArr, d.tooltipStyle)
         | 
| 245 | 
            -
                  }
         | 
| 246 | 
            -
                })
         | 
| 247 | 
            -
              )
         | 
| 248 | 
            -
             | 
| 249 | 
            -
              const mouseoverTooltipSvg$ = combineLatest({
         | 
| 250 | 
            -
                event: eventMouseover$,
         | 
| 251 | 
            -
                contentRenderFn: contentRenderFn$
         | 
| 252 | 
            -
              }).pipe(
         | 
| 253 | 
            -
                takeUntil(destroy$),
         | 
| 254 | 
            -
                switchMap(async d => d),
         | 
| 255 | 
            -
                map(d => d.contentRenderFn(d.event))
         | 
| 256 | 
            -
              )
         | 
| 257 | 
            -
             | 
| 258 | 
            -
              const mouseoutTooltipSvg$ = eventMouseout$.pipe(
         | 
| 259 | 
            -
                takeUntil(destroy$),
         | 
| 260 | 
            -
                map(d => '')
         | 
| 261 | 
            -
              )
         | 
| 262 | 
            -
             | 
| 263 | 
            -
              const event$ = merge(eventMouseover$, eventMouseout$)
         | 
| 264 | 
            -
                .pipe(
         | 
| 265 | 
            -
                  takeUntil(destroy$),
         | 
| 266 | 
            -
                  // filter(d => {
         | 
| 267 | 
            -
                  //   return (d.eventName === 'mouseover' || d.eventName === 'mousemove' || d.eventName === 'mouseout')
         | 
| 268 | 
            -
                  //     && d.event != undefined
         | 
| 269 | 
            -
                  // }),
         | 
| 270 | 
            -
                  map(d => d.event!),
         | 
| 271 | 
            -
                )
         | 
| 272 | 
            -
             | 
| 273 | 
            -
              combineLatest({
         | 
| 274 | 
            -
                svgString: merge(mouseoverTooltipSvg$, mouseoutTooltipSvg$),
         | 
| 275 | 
            -
                event: event$,
         | 
| 276 | 
            -
                layout: observer.layout$,
         | 
| 277 | 
            -
                tooltipStyle: tooltipStyle$,
         | 
| 278 | 
            -
              }).pipe(
         | 
| 279 | 
            -
                takeUntil(destroy$),
         | 
| 280 | 
            -
                switchMap(async d => d),
         | 
| 281 | 
            -
              ).subscribe(data => {
         | 
| 282 | 
            -
                // console.log('svgString', data.svgString)
         | 
| 283 | 
            -
                renderTooltip({
         | 
| 284 | 
            -
                  rootSelection,
         | 
| 285 | 
            -
                  pluginName: name,
         | 
| 286 | 
            -
                  rootWidth: data.layout.rootWidth,
         | 
| 287 | 
            -
                  rootHeight: data.layout.rootHeight,
         | 
| 288 | 
            -
                  svgString: data.svgString,
         | 
| 289 | 
            -
                  tooltipStyle: data.tooltipStyle,
         | 
| 290 | 
            -
                  event: data.event
         | 
| 291 | 
            -
                })
         | 
| 292 | 
            -
              })
         | 
| 293 | 
            -
             | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 296 | 
            -
              // const chartType$ = eventMouseover$.pipe(
         | 
| 297 | 
            -
              //   takeUntil(destroy$),
         | 
| 298 | 
            -
              //   map(d => d.type),
         | 
| 299 | 
            -
              //   distinctUntilChanged()
         | 
| 300 | 
            -
              // )
         | 
| 301 | 
            -
              
         | 
| 302 | 
            -
              
         | 
| 303 | 
            -
              // eventMouseover$.subscribe(event => {
         | 
| 304 | 
            -
                
         | 
| 305 | 
            -
              // })
         | 
| 306 | 
            -
              
         | 
| 307 | 
            -
             | 
| 308 | 
            -
              return function unsubscribe () {
         | 
| 309 | 
            -
                destroy$.next(undefined)
         | 
| 310 | 
            -
              }
         | 
| 1 | 
            +
            import * as d3 from 'd3'
         | 
| 2 | 
            +
            import {
         | 
| 3 | 
            +
              combineLatest,
         | 
| 4 | 
            +
              map,
         | 
| 5 | 
            +
              merge,
         | 
| 6 | 
            +
              filter,
         | 
| 7 | 
            +
              switchMap,
         | 
| 8 | 
            +
              first,
         | 
| 9 | 
            +
              iif,
         | 
| 10 | 
            +
              takeUntil,
         | 
| 11 | 
            +
              Subject, 
         | 
| 12 | 
            +
              Observable,
         | 
| 13 | 
            +
              distinctUntilChanged } from 'rxjs'
         | 
| 14 | 
            +
            import type {
         | 
| 15 | 
            +
              EventTypeMap, PluginConstructor, ChartType } from '@orbcharts/core'
         | 
| 16 | 
            +
            import { defineNoneDataPlugin } from '@orbcharts/core'
         | 
| 17 | 
            +
            import { getSvgGElementSize, appendSvg } from '../../utils/d3Utils'
         | 
| 18 | 
            +
            import { getColor, getClassName } from '../../utils/orbchartsUtils'
         | 
| 19 | 
            +
            import { TOOLTIP_PARAMS } from '../defaults'
         | 
| 20 | 
            +
            import { textSizePxObservable } from '@orbcharts/core'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            interface TooltipStyle {
         | 
| 23 | 
            +
              backgroundColor: string
         | 
| 24 | 
            +
              backgroundOpacity: number
         | 
| 25 | 
            +
              strokeColor: string
         | 
| 26 | 
            +
              offset: [number, number]
         | 
| 27 | 
            +
              padding: number
         | 
| 28 | 
            +
              textColor: string
         | 
| 29 | 
            +
              textSize: number | string // chartParams上的設定
         | 
| 30 | 
            +
              textSizePx: number
         | 
| 31 | 
            +
            }
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            const pluginName = 'Tooltip'
         | 
| 34 | 
            +
            const gClassName = getClassName(pluginName, 'g')
         | 
| 35 | 
            +
            const boxClassName = getClassName(pluginName, 'box')
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            function textToSvg (textArr: string[], textStyle: TooltipStyle) {
         | 
| 38 | 
            +
              const lineHeight = textStyle.textSizePx * 1.5
         | 
| 39 | 
            +
              return textArr
         | 
| 40 | 
            +
                .filter(d => d != '')
         | 
| 41 | 
            +
                .map((text, i) => {
         | 
| 42 | 
            +
                  const top = i * lineHeight
         | 
| 43 | 
            +
                  return `<text font-size="${textStyle.textSize}" fill="${textStyle.textColor}" x="0" y="${top}" style="dominant-baseline:text-before-edge">${text}</text>`
         | 
| 44 | 
            +
                })
         | 
| 45 | 
            +
                .join()
         | 
| 46 | 
            +
            }
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            function renderTooltip ({ rootSelection, pluginName, rootWidth, rootHeight, svgString, tooltipStyle, event  }: {
         | 
| 49 | 
            +
              rootSelection: d3.Selection<any, unknown, any, unknown>
         | 
| 50 | 
            +
              pluginName: string
         | 
| 51 | 
            +
              rootWidth: number
         | 
| 52 | 
            +
              rootHeight: number
         | 
| 53 | 
            +
              svgString: string
         | 
| 54 | 
            +
              tooltipStyle: TooltipStyle
         | 
| 55 | 
            +
              event: MouseEvent
         | 
| 56 | 
            +
            }) {
         | 
| 57 | 
            +
              // if (!svgString) {
         | 
| 58 | 
            +
              //   return
         | 
| 59 | 
            +
              // }
         | 
| 60 | 
            +
              // const rootSelection = d3.select('svg.bpcharts__root')
         | 
| 61 | 
            +
              // console.log('tooltip', { selection, rootWidth, rootHeight, svgString, event  })
         | 
| 62 | 
            +
              rootSelection.interrupt('fadeout')
         | 
| 63 | 
            +
              const radius = 5
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              // data(svg string無值則為空陣列)
         | 
| 66 | 
            +
              const contentData = svgString ? [svgString] : []
         | 
| 67 | 
            +
              const styleData = svgString ? [tooltipStyle] : []
         | 
| 68 | 
            +
              // tooltipG <g>
         | 
| 69 | 
            +
              const tooltipG = rootSelection
         | 
| 70 | 
            +
                .selectAll<SVGGElement, string>(`g.${gClassName}`)
         | 
| 71 | 
            +
                .data(contentData)
         | 
| 72 | 
            +
                .join(
         | 
| 73 | 
            +
                  enter => {
         | 
| 74 | 
            +
                    return enter
         | 
| 75 | 
            +
                      .append('g')
         | 
| 76 | 
            +
                      .classed(gClassName, true)
         | 
| 77 | 
            +
                      .attr('pointer-events', 'none')
         | 
| 78 | 
            +
                  },
         | 
| 79 | 
            +
                  update => {
         | 
| 80 | 
            +
                    return update
         | 
| 81 | 
            +
                  },
         | 
| 82 | 
            +
                  exit => {
         | 
| 83 | 
            +
                    return exit
         | 
| 84 | 
            +
                      // .transition('fadeout')
         | 
| 85 | 
            +
                      // .duration(0)
         | 
| 86 | 
            +
                      // .delay(500)
         | 
| 87 | 
            +
                      .style('opacity', 0)
         | 
| 88 | 
            +
                      .remove()
         | 
| 89 | 
            +
                  }
         | 
| 90 | 
            +
                )
         | 
| 91 | 
            +
                .attr('transform', () => `translate(${event.offsetX}, ${event.offsetY})`)
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              // tooltipBox <g><g>
         | 
| 94 | 
            +
              const tooltipBox = tooltipG
         | 
| 95 | 
            +
                .selectAll<SVGGElement, string>(`g.${boxClassName}`)
         | 
| 96 | 
            +
                .data(styleData)
         | 
| 97 | 
            +
                .join(
         | 
| 98 | 
            +
                  enter => {
         | 
| 99 | 
            +
                    return enter
         | 
| 100 | 
            +
                      .append('g')
         | 
| 101 | 
            +
                      .classed(getClassName(pluginName, 'box'), true)
         | 
| 102 | 
            +
                  },
         | 
| 103 | 
            +
                )
         | 
| 104 | 
            +
             | 
| 105 | 
            +
              // rect <g><g><rect>
         | 
| 106 | 
            +
              const rect = tooltipBox
         | 
| 107 | 
            +
                .selectAll<SVGRectElement, string>('rect')
         | 
| 108 | 
            +
                .data(styleData)
         | 
| 109 | 
            +
                .join(
         | 
| 110 | 
            +
                  enter => {
         | 
| 111 | 
            +
                    return enter
         | 
| 112 | 
            +
                      .append('rect')
         | 
| 113 | 
            +
                      .attr('rx', radius)
         | 
| 114 | 
            +
                      .attr('ry', radius)
         | 
| 115 | 
            +
                  }
         | 
| 116 | 
            +
                )
         | 
| 117 | 
            +
                .attr('fill', d => d.backgroundColor)
         | 
| 118 | 
            +
                .attr('stroke', d => d.strokeColor)
         | 
| 119 | 
            +
                .attr('opacity', d => d.backgroundOpacity)
         | 
| 120 | 
            +
             | 
| 121 | 
            +
              // text <g><g><g>
         | 
| 122 | 
            +
              const contentG = tooltipBox
         | 
| 123 | 
            +
                .selectAll<SVGGElement, string>('g')
         | 
| 124 | 
            +
                .data(contentData)
         | 
| 125 | 
            +
                .join(
         | 
| 126 | 
            +
                  enter => {
         | 
| 127 | 
            +
                    return enter
         | 
| 128 | 
            +
                      .append('g')
         | 
| 129 | 
            +
                      .classed(getClassName(pluginName, 'content'), true)
         | 
| 130 | 
            +
                      .attr('transform', () => `translate(${tooltipStyle.padding}, ${tooltipStyle.padding})`)
         | 
| 131 | 
            +
                  }
         | 
| 132 | 
            +
                )
         | 
| 133 | 
            +
              // 使用字串加入svg
         | 
| 134 | 
            +
              if (contentData.length) {
         | 
| 135 | 
            +
                appendSvg(contentG, contentData[0])
         | 
| 136 | 
            +
              }
         | 
| 137 | 
            +
              const contentSize = (contentG?.node()) ? getSvgGElementSize(contentG!) : { width: 0, height: 0 }
         | 
| 138 | 
            +
             | 
| 139 | 
            +
              // rect size
         | 
| 140 | 
            +
              rect
         | 
| 141 | 
            +
                .attr('width', contentSize.width + tooltipStyle.padding * 2)
         | 
| 142 | 
            +
                .attr('height', contentSize.height + tooltipStyle.padding * 2)
         | 
| 143 | 
            +
             | 
| 144 | 
            +
              // -- tooltipG --
         | 
| 145 | 
            +
              // 取得tooltip <g>的尺寸
         | 
| 146 | 
            +
              const tooltipSize = (tooltipBox?.node()) ? getSvgGElementSize(tooltipBox!) : { width: 0, height: 0 }
         | 
| 147 | 
            +
              // const minX = 0
         | 
| 148 | 
            +
              const maxX = rootWidth - tooltipSize.width
         | 
| 149 | 
            +
              // const minY = 0
         | 
| 150 | 
            +
              const maxY = rootHeight - tooltipSize.height
         | 
| 151 | 
            +
             | 
| 152 | 
            +
              // -- 相對游標位置的offset --
         | 
| 153 | 
            +
              const offsetX = (event.offsetX + tooltipStyle.offset[0]) > maxX ? maxX - event.offsetX : tooltipStyle.offset[0]
         | 
| 154 | 
            +
              const offsetY = (event.offsetY + tooltipStyle.offset[1]) > maxY ? maxY - event.offsetY : tooltipStyle.offset[1]
         | 
| 155 | 
            +
              tooltipBox.attr('transform', d => `translate(${offsetX}, ${offsetY})`)
         | 
| 156 | 
            +
              tooltipBox.attr('transform', d => `translate(${offsetX}, ${offsetY})`)
         | 
| 157 | 
            +
             | 
| 158 | 
            +
             | 
| 159 | 
            +
             | 
| 160 | 
            +
              // const minX = containerSize.x
         | 
| 161 | 
            +
              // const maxX = containerSize.x + containerSize.width - tooltipSize.width
         | 
| 162 | 
            +
              // const minY = containerSize.y
         | 
| 163 | 
            +
              // const maxY = containerSize.y + containerSize.height - tooltipSize.height
         | 
| 164 | 
            +
              
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                // .style('position', 'absolute')
         | 
| 167 | 
            +
                // .style('z-index', 10000)
         | 
| 168 | 
            +
                // .style('left', (d) => {
         | 
| 169 | 
            +
                //   const x = d.x + this.fullParams.offsetX! - containerSize.x
         | 
| 170 | 
            +
                //   if (x < minX) {
         | 
| 171 | 
            +
                //     return `${minX}px`
         | 
| 172 | 
            +
                //   } else if (x > maxX) {
         | 
| 173 | 
            +
                //     return `${maxX}px`
         | 
| 174 | 
            +
                //   }
         | 
| 175 | 
            +
                //   return `${x}px`
         | 
| 176 | 
            +
                // })
         | 
| 177 | 
            +
                // .style('top', (d) => {
         | 
| 178 | 
            +
                //   const y = d.y + this.fullParams.offsetY! - containerSize.y
         | 
| 179 | 
            +
                //   if (y < minY) {
         | 
| 180 | 
            +
                //     return `${minY}px`
         | 
| 181 | 
            +
                //   } else if (y > maxY) {
         | 
| 182 | 
            +
                //     return `${maxY}px`
         | 
| 183 | 
            +
                //   }
         | 
| 184 | 
            +
                //   return `${y}px`
         | 
| 185 | 
            +
                // })
         | 
| 186 | 
            +
                // .html((d) => d.contentHtml)
         | 
| 187 | 
            +
              
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            }
         | 
| 190 | 
            +
             | 
| 191 | 
            +
            export const Tooltip: PluginConstructor<any, string, any> = defineNoneDataPlugin(pluginName, TOOLTIP_PARAMS)(({ selection, rootSelection, name, chartType, observer, subject }) => {
         | 
| 192 | 
            +
              const destroy$ = new Subject()
         | 
| 193 | 
            +
             | 
| 194 | 
            +
              // 事件觸發
         | 
| 195 | 
            +
              const eventMouseover$: Observable<EventTypeMap<any>> = subject.event$.pipe(
         | 
| 196 | 
            +
                takeUntil(destroy$),
         | 
| 197 | 
            +
                filter(d => d.eventName === 'mouseover' || d.eventName === 'mousemove'),
         | 
| 198 | 
            +
                // distinctUntilChanged((prev, current) => prev.eventName === current.eventName)
         | 
| 199 | 
            +
                // map(d => d as EventTypeMap<typeof chartType>)
         | 
| 200 | 
            +
              )
         | 
| 201 | 
            +
              const eventMouseout$: Observable<EventTypeMap<any>> = subject.event$.pipe(
         | 
| 202 | 
            +
                takeUntil(destroy$),
         | 
| 203 | 
            +
                filter(d => d.eventName === 'mouseout'),
         | 
| 204 | 
            +
                // distinctUntilChanged((prev, current) => prev.eventName === current.eventName)
         | 
| 205 | 
            +
                // map(d => d as EventTypeMap<typeof chartType>)
         | 
| 206 | 
            +
              )
         | 
| 207 | 
            +
             | 
| 208 | 
            +
              const textSizePx$ = textSizePxObservable(observer.fullChartParams$)
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              const tooltipStyle$: Observable<TooltipStyle> = combineLatest({
         | 
| 211 | 
            +
                fullChartParams: observer.fullChartParams$,
         | 
| 212 | 
            +
                fullParams: observer.fullParams$,
         | 
| 213 | 
            +
                textSizePx: textSizePx$
         | 
| 214 | 
            +
              }).pipe(
         | 
| 215 | 
            +
                takeUntil(destroy$),
         | 
| 216 | 
            +
                switchMap(async d => d),
         | 
| 217 | 
            +
                map(data => {
         | 
| 218 | 
            +
                  return {
         | 
| 219 | 
            +
                    backgroundColor: getColor(data.fullParams.backgroundColorType, data.fullChartParams),
         | 
| 220 | 
            +
                    backgroundOpacity: data.fullParams.backgroundOpacity,
         | 
| 221 | 
            +
                    strokeColor: getColor(data.fullParams.strokeColorType, data.fullChartParams),
         | 
| 222 | 
            +
                    offset: data.fullParams.offset,
         | 
| 223 | 
            +
                    padding: data.fullParams.padding,
         | 
| 224 | 
            +
                    textSize: data.fullChartParams.styles.textSize,
         | 
| 225 | 
            +
                    textSizePx: data.textSizePx,
         | 
| 226 | 
            +
                    textColor: getColor(data.fullParams.textColorType, data.fullChartParams),
         | 
| 227 | 
            +
                  }
         | 
| 228 | 
            +
                })
         | 
| 229 | 
            +
              )
         | 
| 230 | 
            +
             | 
| 231 | 
            +
              const contentRenderFn$: Observable<((eventData: EventTypeMap<any>) => string)> = combineLatest({
         | 
| 232 | 
            +
                fullParams: observer.fullParams$,
         | 
| 233 | 
            +
                tooltipStyle: tooltipStyle$
         | 
| 234 | 
            +
              }).pipe(
         | 
| 235 | 
            +
                takeUntil(destroy$),
         | 
| 236 | 
            +
                switchMap(async d => d),
         | 
| 237 | 
            +
                map(d => {
         | 
| 238 | 
            +
                  if (d.fullParams.svgRenderFn) {
         | 
| 239 | 
            +
                    return d.fullParams.svgRenderFn
         | 
| 240 | 
            +
                  }
         | 
| 241 | 
            +
                  // 將textRenderFn回傳的資料使用<text>包裝起來
         | 
| 242 | 
            +
                  return (eventData: EventTypeMap<any>) => {
         | 
| 243 | 
            +
                    const textArr = d.fullParams.textRenderFn(eventData as any)
         | 
| 244 | 
            +
                    return textToSvg(textArr, d.tooltipStyle)
         | 
| 245 | 
            +
                  }
         | 
| 246 | 
            +
                })
         | 
| 247 | 
            +
              )
         | 
| 248 | 
            +
             | 
| 249 | 
            +
              const mouseoverTooltipSvg$ = combineLatest({
         | 
| 250 | 
            +
                event: eventMouseover$,
         | 
| 251 | 
            +
                contentRenderFn: contentRenderFn$
         | 
| 252 | 
            +
              }).pipe(
         | 
| 253 | 
            +
                takeUntil(destroy$),
         | 
| 254 | 
            +
                switchMap(async d => d),
         | 
| 255 | 
            +
                map(d => d.contentRenderFn(d.event))
         | 
| 256 | 
            +
              )
         | 
| 257 | 
            +
             | 
| 258 | 
            +
              const mouseoutTooltipSvg$ = eventMouseout$.pipe(
         | 
| 259 | 
            +
                takeUntil(destroy$),
         | 
| 260 | 
            +
                map(d => '')
         | 
| 261 | 
            +
              )
         | 
| 262 | 
            +
             | 
| 263 | 
            +
              const event$ = merge(eventMouseover$, eventMouseout$)
         | 
| 264 | 
            +
                .pipe(
         | 
| 265 | 
            +
                  takeUntil(destroy$),
         | 
| 266 | 
            +
                  // filter(d => {
         | 
| 267 | 
            +
                  //   return (d.eventName === 'mouseover' || d.eventName === 'mousemove' || d.eventName === 'mouseout')
         | 
| 268 | 
            +
                  //     && d.event != undefined
         | 
| 269 | 
            +
                  // }),
         | 
| 270 | 
            +
                  map(d => d.event!),
         | 
| 271 | 
            +
                )
         | 
| 272 | 
            +
             | 
| 273 | 
            +
              combineLatest({
         | 
| 274 | 
            +
                svgString: merge(mouseoverTooltipSvg$, mouseoutTooltipSvg$),
         | 
| 275 | 
            +
                event: event$,
         | 
| 276 | 
            +
                layout: observer.layout$,
         | 
| 277 | 
            +
                tooltipStyle: tooltipStyle$,
         | 
| 278 | 
            +
              }).pipe(
         | 
| 279 | 
            +
                takeUntil(destroy$),
         | 
| 280 | 
            +
                switchMap(async d => d),
         | 
| 281 | 
            +
              ).subscribe(data => {
         | 
| 282 | 
            +
                // console.log('svgString', data.svgString)
         | 
| 283 | 
            +
                renderTooltip({
         | 
| 284 | 
            +
                  rootSelection,
         | 
| 285 | 
            +
                  pluginName: name,
         | 
| 286 | 
            +
                  rootWidth: data.layout.rootWidth,
         | 
| 287 | 
            +
                  rootHeight: data.layout.rootHeight,
         | 
| 288 | 
            +
                  svgString: data.svgString,
         | 
| 289 | 
            +
                  tooltipStyle: data.tooltipStyle,
         | 
| 290 | 
            +
                  event: data.event
         | 
| 291 | 
            +
                })
         | 
| 292 | 
            +
              })
         | 
| 293 | 
            +
             | 
| 294 | 
            +
             | 
| 295 | 
            +
             | 
| 296 | 
            +
              // const chartType$ = eventMouseover$.pipe(
         | 
| 297 | 
            +
              //   takeUntil(destroy$),
         | 
| 298 | 
            +
              //   map(d => d.type),
         | 
| 299 | 
            +
              //   distinctUntilChanged()
         | 
| 300 | 
            +
              // )
         | 
| 301 | 
            +
              
         | 
| 302 | 
            +
              
         | 
| 303 | 
            +
              // eventMouseover$.subscribe(event => {
         | 
| 304 | 
            +
                
         | 
| 305 | 
            +
              // })
         | 
| 306 | 
            +
              
         | 
| 307 | 
            +
             | 
| 308 | 
            +
              return function unsubscribe () {
         | 
| 309 | 
            +
                destroy$.next(undefined)
         | 
| 310 | 
            +
              }
         | 
| 311 311 | 
             
            })
         | 
    
        package/src/noneData/types.ts
    CHANGED
    
    | @@ -1,26 +1,26 @@ | |
| 1 | 
            -
            import type { ColorType, ChartType, EventTypeMap, EventBase } from '@orbcharts/core'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            export interface ContainerPluginParams {
         | 
| 4 | 
            -
              header: {
         | 
| 5 | 
            -
                height: number
         | 
| 6 | 
            -
                text: string[]
         | 
| 7 | 
            -
                textStyle: string[]
         | 
| 8 | 
            -
              }
         | 
| 9 | 
            -
              footer: {
         | 
| 10 | 
            -
                height: number
         | 
| 11 | 
            -
                text: string[]
         | 
| 12 | 
            -
                textStyle: string[]
         | 
| 13 | 
            -
              }
         | 
| 14 | 
            -
            }
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            export type TooltipParams = {
         | 
| 17 | 
            -
              backgroundColorType: ColorType
         | 
| 18 | 
            -
              backgroundOpacity: number
         | 
| 19 | 
            -
              strokeColorType: ColorType
         | 
| 20 | 
            -
              textColorType: ColorType
         | 
| 21 | 
            -
              offset: [number, number]
         | 
| 22 | 
            -
              padding: number
         | 
| 23 | 
            -
              textRenderFn: <T extends ChartType> (eventData: EventTypeMap<T>) => string[]
         | 
| 24 | 
            -
              svgRenderFn: (<T extends ChartType> (eventData: EventTypeMap<T>) => string) | null
         | 
| 25 | 
            -
            }
         | 
| 26 | 
            -
             | 
| 1 | 
            +
            import type { ColorType, ChartType, EventTypeMap, EventBase } from '@orbcharts/core'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            export interface ContainerPluginParams {
         | 
| 4 | 
            +
              header: {
         | 
| 5 | 
            +
                height: number
         | 
| 6 | 
            +
                text: string[]
         | 
| 7 | 
            +
                textStyle: string[]
         | 
| 8 | 
            +
              }
         | 
| 9 | 
            +
              footer: {
         | 
| 10 | 
            +
                height: number
         | 
| 11 | 
            +
                text: string[]
         | 
| 12 | 
            +
                textStyle: string[]
         | 
| 13 | 
            +
              }
         | 
| 14 | 
            +
            }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            export type TooltipParams = {
         | 
| 17 | 
            +
              backgroundColorType: ColorType
         | 
| 18 | 
            +
              backgroundOpacity: number
         | 
| 19 | 
            +
              strokeColorType: ColorType
         | 
| 20 | 
            +
              textColorType: ColorType
         | 
| 21 | 
            +
              offset: [number, number]
         | 
| 22 | 
            +
              padding: number
         | 
| 23 | 
            +
              textRenderFn: <T extends ChartType> (eventData: EventTypeMap<T>) => string[]
         | 
| 24 | 
            +
              svgRenderFn: (<T extends ChartType> (eventData: EventTypeMap<T>) => string) | null
         | 
| 25 | 
            +
            }
         | 
| 26 | 
            +
             |