@visactor/vseed 0.1.51 → 0.2.0
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/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +334 -0
- package/dist/esm/pipeline/advanced/chart/pipeline/donut.js +3 -3
- package/dist/esm/pipeline/advanced/chart/pipeline/donut.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/histogram.js +1 -2
- package/dist/esm/pipeline/advanced/chart/pipeline/histogram.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipeline/pie.js +3 -3
- package/dist/esm/pipeline/advanced/chart/pipeline/pie.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/pie.js +8 -6
- package/dist/esm/pipeline/advanced/chart/pipes/encoding/pie.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/markStyle/markStyle.js +3 -1
- package/dist/esm/pipeline/advanced/chart/pipes/markStyle/markStyle.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/measures/buildMeasures.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/measures/buildMeasures.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithBoxplotEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithEncoding.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithHistogramEncoding.js +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/reshape/pivotReshapeWithHistogramEncoding.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js +6 -5
- package/dist/esm/pipeline/spec/chart/pipeline/boxplot.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js +15 -13
- package/dist/esm/pipeline/spec/chart/pipeline/dualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/color/colorBoxPlotStyleFill.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/color/colorBoxPlotStyleFill.js +17 -0
- package/dist/esm/pipeline/spec/chart/pipes/color/colorBoxPlotStyleFill.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/color/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/color/index.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/horizontalCrosshairRect.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/crosshair/verticalCrosshairRect.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/index.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/init/pivot.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/boxPlotStyle.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/boxPlotStyle.js +52 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/boxPlotStyle.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/index.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/index.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/outlierStyle.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/outlierStyle.js +67 -0
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/outlierStyle.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/areaStyleFilter.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/areaStyleFilter.js +7 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/areaStyleFilter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/barStyleFilter.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/barStyleFilter.js +7 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/barStyleFilter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/index.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/index.js +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/lineStyleFilter.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/lineStyleFilter.js +7 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/lineStyleFilter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/pointStyleFilter.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/pointStyleFilter.js +7 -0
- package/dist/esm/pipeline/spec/chart/pipes/pipeFilter/pointStyleFilter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js +18 -20
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/dimensionLinkage.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotAxisStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotGridStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/pivotChart/pivotIndicators.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js +5 -3
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/columnRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.js +2 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/common.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/ecdfRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js +6 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js +8 -3
- package/dist/esm/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js +2 -3
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/index.d.ts +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/index.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js +16 -2
- package/dist/esm/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js.map +1 -1
- package/dist/esm/pipeline/utils/measures/find.d.ts +1 -0
- package/dist/esm/pipeline/utils/measures/find.js +13 -1
- package/dist/esm/pipeline/utils/measures/find.js.map +1 -1
- package/dist/esm/theme/common/axes.js +4 -4
- package/dist/esm/theme/common/axes.js.map +1 -1
- package/dist/esm/theme/common/boxPlot.d.ts +5 -0
- package/dist/esm/theme/common/boxPlot.js +15 -0
- package/dist/esm/theme/common/boxPlot.js.map +1 -0
- package/dist/esm/theme/common/crosshair.js +4 -4
- package/dist/esm/theme/common/crosshair.js.map +1 -1
- package/dist/esm/theme/common/table.js +2 -0
- package/dist/esm/theme/common/table.js.map +1 -1
- package/dist/esm/theme/dark/dark.js +4 -1
- package/dist/esm/theme/dark/dark.js.map +1 -1
- package/dist/esm/theme/light/light.js +4 -1
- package/dist/esm/theme/light/light.js.map +1 -1
- package/dist/esm/types/advancedVSeed.d.ts +358 -0
- package/dist/esm/types/chartType/boxplot/boxplot.d.ts +9 -1
- package/dist/esm/types/chartType/boxplot/zBoxplot.d.ts +316 -0
- package/dist/esm/types/chartType/boxplot/zBoxplot.js +3 -1
- package/dist/esm/types/chartType/boxplot/zBoxplot.js.map +1 -1
- package/dist/esm/types/properties/config/boxplot.d.ts +21 -0
- package/dist/esm/types/properties/config/boxplot.js +8 -1
- package/dist/esm/types/properties/config/boxplot.js.map +1 -1
- package/dist/esm/types/properties/config/config.d.ts +21 -0
- package/dist/esm/types/properties/markStyle/boxPlotStyle.d.ts +148 -0
- package/dist/esm/types/properties/markStyle/boxPlotStyle.js +14 -0
- package/dist/esm/types/properties/markStyle/boxPlotStyle.js.map +1 -0
- package/dist/esm/types/properties/markStyle/index.d.ts +2 -0
- package/dist/esm/types/properties/markStyle/index.js +2 -0
- package/dist/esm/types/properties/markStyle/markStyle.d.ts +316 -0
- package/dist/esm/types/properties/markStyle/markStyle.js +5 -1
- package/dist/esm/types/properties/markStyle/markStyle.js.map +1 -1
- package/dist/esm/types/properties/markStyle/outlierStyle.d.ts +161 -0
- package/dist/esm/types/properties/markStyle/outlierStyle.js +22 -0
- package/dist/esm/types/properties/markStyle/outlierStyle.js.map +1 -0
- package/dist/esm/types/properties/theme/customTheme.d.ts +42 -0
- package/dist/esm/types/zVseed.d.ts +316 -0
- package/dist/umd/index.js +330 -99
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, IHistogramChartSpec, IVChart } from '@visactor/vchart'\nimport type { KDEOptions } from '@visactor/vutils'\nimport { isNullish, uniqueBy } from 'remeda'\nimport { kde, array } from '@visactor/vutils'\nimport { BinEndMeasureId, BinStartMeasureId } from 'src/dataReshape'\nimport type { Datum, Dimension, VChartSpecPipe, Encoding, RegressionLineConfig, KdeRegressionLine } from 'src/types'\nimport { defaultRegressionLineColor, defaultRegressionLineLabelX, defaultRegressionLineLabelY } from './common'\n\nexport const kdeRegressionLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as IHistogramChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType, encoding = {} as Encoding, dimensions, regressionLine } = advancedVSeed\n const { dataset } = vseed\n const lineTheme = advancedVSeed.config[chartType as 'histogram']?.regressionLine as RegressionLineConfig\n\n if (!regressionLine || !regressionLine.kdeRegressionLine) {\n return result\n }\n\n const rowColumnFields = uniqueBy(\n dimensions.filter((dim: Dimension) => dim.encoding === 'row' || dim.encoding === 'column'),\n (item: Dimension) => item.id,\n )\n\n const lineList = array(regressionLine.kdeRegressionLine).filter((kdeLine) => kdeLine.enable !== false)\n\n if (!result.extensionMark) {\n result.extensionMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n if (line.enable === false) {\n return\n }\n const theme = (lineTheme.kdeRegressionLine ?? {}) as KdeRegressionLine\n const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight } = line as KdeRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.extensionMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `kdeRegressionLine-${lineIndex}`,\n dataId: (spec.data as any)?.id,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const series = chart.getAllSeries().filter((s: any) => s.type === 'bar')\n\n // 直方图使用的是bar系列\n if (series && series.length) {\n const s = series[0] as ICartesianSeries\n\n const fieldX = s.fieldX?.[0]\n const scaleY = s.getYAxisHelper().getScale?.(0)\n const viewData = s.getViewData()?.latestData\n\n if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) {\n return null\n }\n const simpleData = dataset\n .filter((entry: Datum) => {\n return rowColumnFields.length\n ? rowColumnFields.every((dim: Dimension) => {\n return entry[dim.id] === viewData[0][dim.id]\n })\n : true\n })\n .map((d: Datum) => +(d as any)[encoding.value?.[0] as string])\n const res = kde(simpleData, {\n bandwidth: Math.abs(viewData[0][BinEndMeasureId] - viewData[0][BinStartMeasureId]),\n } as KDEOptions)\n const N = Math.max(3, Math.floor(simpleData.length / 4))\n const lineData = res.evaluateGrid(N)\n const scaleR = (k: number) => {\n return scaleY.scale(k * simpleData.length * res.bandwidth)\n }\n\n const linePoints = lineData.map((ld: Datum) => {\n const d = { [fieldX]: ld.x }\n return {\n x: s.dataToPositionX(d)!,\n y: scaleR(ld.y as number),\n }\n })\n\n return {\n linePoints,\n color: color ?? s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0]),\n }\n }\n return null\n },\n },\n children: childrenMarks,\n })\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.linePoints\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: defaultRegressionLineLabelX,\n y: defaultRegressionLineLabelY,\n },\n })\n }\n })\n\n return result\n}\n"],"names":["kdeRegressionLine","spec","context","result","advancedVSeed","vseed","chartType","encoding","dimensions","regressionLine","dataset","lineTheme","rowColumnFields","uniqueBy","dim","item","lineList","array","kdeLine","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","childrenMarks","datum","ctx","vchart","chart","series","s","fieldX","scaleY","viewData","simpleData","entry","d","res","kde","Math","BinEndMeasureId","BinStartMeasureId","N","lineData","scaleR","k","linePoints","ld","defaultRegressionLineColor","opt","parentNode","isNullish","defaultRegressionLineLabelX","defaultRegressionLineLabelY"],"mappings":";;;;AAQO,MAAMA,oBAAoC,CAACC,MAAMC;IACtD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAEC,WAAW,CAAC,CAAa,EAAEC,UAAU,EAAEC,cAAc,EAAE,GAAGL;IAC7E,MAAM,EAAEM,OAAO,EAAE,GAAGL;IACpB,MAAMM,YAAYP,cAAc,MAAM,CAACE,UAAyB,EAAE;
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/kdeRegressionLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, IHistogramChartSpec, IVChart } from '@visactor/vchart'\nimport type { KDEOptions } from '@visactor/vutils'\nimport { isNullish, uniqueBy } from 'remeda'\nimport { kde, array } from '@visactor/vutils'\nimport { BinEndMeasureId, BinStartMeasureId } from 'src/dataReshape'\nimport type { Datum, Dimension, VChartSpecPipe, Encoding, RegressionLineConfig, KdeRegressionLine } from 'src/types'\nimport { defaultRegressionLineColor, defaultRegressionLineLabelX, defaultRegressionLineLabelY } from './common'\n\nexport const kdeRegressionLine: VChartSpecPipe = (spec, context) => {\n const result = { ...spec } as IHistogramChartSpec\n const { advancedVSeed, vseed } = context\n const { chartType, encoding = {} as Encoding, dimensions, regressionLine } = advancedVSeed\n const { dataset } = vseed\n const lineTheme = advancedVSeed.config[chartType as 'histogram']?.regressionLine as RegressionLineConfig\n const binValueType = advancedVSeed.config[chartType as 'histogram']?.binValueType\n\n if (!regressionLine || !regressionLine.kdeRegressionLine) {\n return result\n }\n\n const rowColumnFields = uniqueBy(\n dimensions.filter((dim: Dimension) => dim.encoding === 'row' || dim.encoding === 'column'),\n (item: Dimension) => item.id,\n )\n\n const lineList = array(regressionLine.kdeRegressionLine).filter((kdeLine) => kdeLine.enable !== false)\n\n if (!result.extensionMark) {\n result.extensionMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n if (line.enable === false) {\n return\n }\n const theme = (lineTheme.kdeRegressionLine ?? {}) as KdeRegressionLine\n const { color, lineWidth, lineDash, text, textColor, textFontSize, textFontWeight } = line as KdeRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.extensionMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `kdeRegressionLine-${lineIndex}`,\n dataId: (spec.data as any)?.id,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const series = chart.getAllSeries().filter((s: any) => s.type === 'bar')\n\n // 直方图使用的是bar系列\n if (series && series.length) {\n const s = series[0] as ICartesianSeries\n\n const fieldX = s.fieldX?.[0]\n const scaleY = s.getYAxisHelper().getScale?.(0)\n const viewData = s.getViewData()?.latestData\n\n if (!dataset || !dataset.length || !viewData || !viewData.length || !scaleY) {\n return null\n }\n const simpleData = dataset\n .filter((entry: Datum) => {\n return rowColumnFields.length\n ? rowColumnFields.every((dim: Dimension) => {\n return entry[dim.id] === viewData[0][dim.id]\n })\n : true\n })\n .map((d: Datum) => +(d as any)[encoding.value?.[0] as string])\n const res = kde(simpleData, {\n bandwidth: Math.abs(viewData[0][BinEndMeasureId] - viewData[0][BinStartMeasureId]),\n } as KDEOptions)\n const N = Math.max(3, Math.floor(simpleData.length / 4))\n const lineData = res.evaluateGrid(N)\n\n // 根据 binValueType 决定如何转换 KDE 密度值\n // - 频次模式 (count): 频次 = 密度 × 样本数 × 带宽\n // - 百分比模式 (percentage): 百分比 = 密度 × 带宽\n const scaleR = (k: number) => {\n if (binValueType === 'percentage') {\n // 百分比模式:y轴是0-1的百分比,KDE密度值乘以带宽即可\n return scaleY.scale(k * res.bandwidth)\n } else {\n // 频次模式:y轴是实际计数,需要乘以样本数量\n return scaleY.scale(k * simpleData.length * res.bandwidth)\n }\n }\n\n const linePoints = lineData.map((ld: Datum) => {\n const d = { [fieldX]: ld.x }\n return {\n x: s.dataToPositionX(d)!,\n y: scaleR(ld.y as number),\n }\n })\n\n return {\n linePoints,\n color: color ?? s.getOption().globalScale.getScale('color')?.scale(s.getSeriesKeys()[0]),\n }\n }\n return null\n },\n },\n children: childrenMarks,\n })\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: color ?? defaultRegressionLineColor,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return parentNode.attribute.data.linePoints\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n dataKey: () => {\n return `kdeRegressionLine-label-${lineIndex}`\n },\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: defaultRegressionLineLabelX,\n y: defaultRegressionLineLabelY,\n },\n })\n }\n })\n\n return result\n}\n"],"names":["kdeRegressionLine","spec","context","result","advancedVSeed","vseed","chartType","encoding","dimensions","regressionLine","dataset","lineTheme","binValueType","rowColumnFields","uniqueBy","dim","item","lineList","array","kdeLine","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","childrenMarks","datum","ctx","vchart","chart","series","s","fieldX","scaleY","viewData","simpleData","entry","d","res","kde","Math","BinEndMeasureId","BinStartMeasureId","N","lineData","scaleR","k","linePoints","ld","defaultRegressionLineColor","opt","parentNode","isNullish","defaultRegressionLineLabelX","defaultRegressionLineLabelY"],"mappings":";;;;AAQO,MAAMA,oBAAoC,CAACC,MAAMC;IACtD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,SAAS,EAAEC,WAAW,CAAC,CAAa,EAAEC,UAAU,EAAEC,cAAc,EAAE,GAAGL;IAC7E,MAAM,EAAEM,OAAO,EAAE,GAAGL;IACpB,MAAMM,YAAYP,cAAc,MAAM,CAACE,UAAyB,EAAE;IAClE,MAAMM,eAAeR,cAAc,MAAM,CAACE,UAAyB,EAAE;IAErE,IAAI,CAACG,kBAAkB,CAACA,eAAe,iBAAiB,EACtD,OAAON;IAGT,MAAMU,kBAAkBC,SACtBN,WAAW,MAAM,CAAC,CAACO,MAAmBA,AAAiB,UAAjBA,IAAI,QAAQ,IAAcA,AAAiB,aAAjBA,IAAI,QAAQ,GAC5E,CAACC,OAAoBA,KAAK,EAAE;IAG9B,MAAMC,WAAWC,MAAMT,eAAe,iBAAiB,EAAE,MAAM,CAAC,CAACU,UAAYA,AAAmB,UAAnBA,QAAQ,MAAM;IAE3F,IAAI,CAAChB,OAAO,aAAa,EACvBA,OAAO,aAAa,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C,UAAU;oBAG7C,OAAO,EAAE;gBACX;YACF;QACF;QAEA,IAAI,CAACC,UAAU/B,OACbI,cAAc,IAAI,CAAC;YACjB,MAAM;YACN,aAAa;YACb,QAAQ;YACR,QAAS7B,KAAK,IAAI,EAAU;YAC5B,SAAS,IACA,CAAC,wBAAwB,EAAEoB,WAAW;YAE/C,OAAO;gBACL,WAAW;gBACX,MAAMM,aAAaL,MAAM,SAAS;gBAClC,UAAUM,gBAAgBN,MAAM,YAAY;gBAC5C,YAAYO,kBAAkBP,MAAM,cAAc;gBAClD,MAAMI;gBACN,GAAGgC;gBACH,GAAGC;YACL;QACF;IAEJ;IAEA,OAAOxD;AACT"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isNullish } from "remeda";
|
|
2
2
|
import { array, clamper, regressionLinear, regressionLogistic, regressionLowess, regressionPolynomial } from "@visactor/vutils";
|
|
3
|
+
import { getAlphaByConfidenceLevel } from "./common.js";
|
|
3
4
|
const generateRegressionLinePipe = (type, regressionFunction, getOptions = getDefaultRegressionOptions)=>(spec, context)=>{
|
|
4
5
|
const result = {
|
|
5
6
|
...spec
|
|
@@ -155,6 +156,7 @@ const generateRegressionLinePipe = (type, regressionFunction, getOptions = getDe
|
|
|
155
156
|
zIndex: 500,
|
|
156
157
|
animation: false,
|
|
157
158
|
dataId: spec.data?.id,
|
|
159
|
+
dataKey: ()=>`regressionLine-label-${lineIndex}`,
|
|
158
160
|
style: {
|
|
159
161
|
textAlign: 'end',
|
|
160
162
|
fill: textColor ?? theme.textColor,
|
|
@@ -180,9 +182,12 @@ const generateRegressionLinePipe = (type, regressionFunction, getOptions = getDe
|
|
|
180
182
|
});
|
|
181
183
|
return result;
|
|
182
184
|
};
|
|
183
|
-
const getDefaultRegressionOptions = (lineConfig)=>
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
const getDefaultRegressionOptions = (lineConfig)=>{
|
|
186
|
+
const alpha = getAlphaByConfidenceLevel(lineConfig?.confidenceLevel);
|
|
187
|
+
return {
|
|
188
|
+
alpha
|
|
189
|
+
};
|
|
190
|
+
};
|
|
186
191
|
const linearRegressionLine = generateRegressionLinePipe('linearRegressionLine', regressionLinear);
|
|
187
192
|
const lowessRegressionLine = generateRegressionLinePipe('lowessRegressionLine', regressionLowess);
|
|
188
193
|
const polynomialRegressionLine = generateRegressionLinePipe('polynomialRegressionLine', regressionPolynomial, (lineConfig)=>({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, IScatterChartSpec, IVChart } from '@visactor/vchart'\nimport { isNullish } from 'remeda'\nimport {\n array,\n clamper,\n regressionLinear,\n regressionLowess,\n regressionPolynomial,\n regressionLogistic,\n} from '@visactor/vutils'\nimport type {\n Datum,\n VChartSpecPipe,\n RegressionLineConfig,\n LinearRegressionLine,\n PolynomialRegressionLine,\n SpecPipelineContext,\n LogisticRegressionLine,\n LowessRegressionLine,\n} from 'src/types'\n\nexport const generateRegressionLinePipe = (\n type: 'linearRegressionLine' | 'lowessRegressionLine' | 'polynomialRegressionLine' | 'logisticRegressionLine',\n regressionFunction: (\n arr: Datum[],\n xAccessor: (d: Datum) => number,\n yAccessor: (d: Datum) => number,\n options?: any,\n ) => {\n confidenceInterval: (N: number) => { lower: number; upper: number; x: number }[]\n evaluateGrid: (N: number) => { x: number; y: number }[]\n },\n getOptions: (lineConfig: any) => any = getDefaultRegressionOptions,\n): VChartSpecPipe => {\n return ((spec: Partial<IScatterChartSpec>, context: SpecPipelineContext): Partial<IScatterChartSpec> => {\n const result = { ...spec }\n const { advancedVSeed } = context\n const { chartType, regressionLine } = advancedVSeed\n const lineTheme = advancedVSeed.config[chartType as 'scatter']?.regressionLine as RegressionLineConfig\n\n if (!regressionLine || !regressionLine[type]) {\n return result\n }\n\n const lineList = array(regressionLine[type])\n\n if (!result.extensionMark) {\n result.extensionMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n if (line.enable === false) {\n return\n }\n\n const theme = (lineTheme.linearRegressionLine ?? {}) as LinearRegressionLine\n const {\n color,\n lineWidth,\n lineDash,\n text,\n textColor,\n textFontSize,\n textFontWeight,\n confidenceIntervalOpacity,\n confidenceIntervalVisible = theme.confidenceIntervalVisible,\n } = line as LinearRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.extensionMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `${type}-${lineIndex}`,\n layoutType: 'region-relative',\n dataId: (spec.data as any)?.id,\n animation: false,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const s = chart.getAllSeries()[0] as ICartesianSeries\n\n if (s) {\n const rect = s.getRegion().getLayoutRect()\n const segments: {\n areaPoints?: { x: number; y: number; y1: number }[]\n linePoints: { x: number; y: number }[]\n color: string\n }[] = []\n\n if (rect.width === 0 || rect.height === 0) {\n return segments\n }\n\n const yClamper = clamper(0, rect.height)\n const colorAttrOptions = s.getColorAttribute()\n const groups: (string | undefined)[] = s.getSeriesKeys()\n const data = s.getViewData()?.latestData as Datum[]\n const fieldX = s.fieldX?.[0]\n const fieldY = s.fieldY?.[0]\n\n if (!groups.length) {\n groups.push(undefined)\n }\n\n groups.forEach((group) => {\n const groupData = data.filter((d: Datum) => d[colorAttrOptions?.field] === group)\n\n if (groupData.length <= 2) {\n return\n }\n const { confidenceInterval, evaluateGrid } = regressionFunction(\n groupData,\n (datum: Datum) => datum?.[fieldX],\n (datum: Datum) => datum?.[fieldY],\n getOptions?.(line),\n )\n const N = Math.max(3, Math.floor(groupData.length / 4))\n const mainColor = color ?? colorAttrOptions?.scale?.scale(group)\n\n const lineData = evaluateGrid(N)\n const linePoints: { x: number; y: number }[] = []\n\n lineData.forEach((ld: Datum, index: number) => {\n const d = { [fieldX]: ld.x, [fieldY]: ld.y }\n const x = s.dataToPositionX(d)!\n const y = yClamper(s.dataToPositionY(d)!)\n\n if (segments.length && index === 0) {\n segments[segments.length - 1].linePoints.push({ x, y: NaN }) // 断开线段用的\n }\n\n linePoints.push({\n x,\n y,\n })\n })\n\n const segment: {\n color: string\n linePoints: { x: number; y: number }[]\n areaPoints?: { x: number; y: number; y1: number }[]\n } = {\n color: mainColor,\n linePoints,\n }\n\n if (confidenceIntervalVisible) {\n const intervalData = confidenceInterval(N)\n const areaPoints: { x: number; y: number; y1: number }[] = []\n\n intervalData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: datum.x, [fieldY]: datum.lower }\n const x = s.dataToPositionX(d)!\n const y = yClamper(s.dataToPositionY(d)!)\n const y1 = yClamper(s.dataToPositionY({ [fieldY]: datum.upper })!)\n\n if (segments.length && index === 0) {\n segments[segments.length - 1].areaPoints!.push({ x, y: NaN, y1: NaN }) // 断开线段用的\n }\n\n areaPoints.push({ x, y, y1 })\n })\n\n segment.areaPoints = areaPoints\n }\n\n segments.push(segment)\n })\n\n return segments\n }\n return []\n },\n },\n children: childrenMarks,\n })\n\n if (confidenceIntervalVisible) {\n childrenMarks.push({\n type: 'area',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n stroke: false,\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,\n fill: 'red', // vrender bug,必须要设置一个全局的fill,才会绘制\n segments: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode) {\n const data = parentNode.finalAttribute?.data ?? parentNode.attribute?.data\n\n if (data?.length) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return data.map((d: any) => {\n return {\n points: d.areaPoints ?? [],\n fill: d.color,\n }\n })\n }\n }\n\n return []\n },\n },\n })\n }\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n animation: false,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: 'red', // vrender bug,必须要设置一个全局的stroke,才会绘制\n segments: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode) {\n const data = parentNode.finalAttribute?.data ?? parentNode.attribute?.data\n if (data?.length) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return data.map((d: any) => {\n return {\n points: d.linePoints,\n stroke: d.color,\n }\n })\n }\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n animation: false,\n dataId: (spec.data as any)?.id,\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.length) {\n const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints\n return point[point.length - 1]?.x\n }\n\n return undefined\n },\n y: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.length) {\n const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints\n return point[point.length - 1]?.y\n }\n\n return undefined\n },\n },\n })\n }\n })\n\n return result\n }) as VChartSpecPipe\n}\n\nconst getDefaultRegressionOptions = (\n lineConfig: PolynomialRegressionLine | LinearRegressionLine | LogisticRegressionLine | LowessRegressionLine,\n) => {\n return { alpha: lineConfig?.confidenceLevel ?? 0.95 }\n}\n\nexport const linearRegressionLine: VChartSpecPipe = generateRegressionLinePipe('linearRegressionLine', regressionLinear)\nexport const lowessRegressionLine: VChartSpecPipe = generateRegressionLinePipe('lowessRegressionLine', regressionLowess)\nexport const polynomialRegressionLine: VChartSpecPipe = generateRegressionLinePipe(\n 'polynomialRegressionLine',\n regressionPolynomial,\n (lineConfig: PolynomialRegressionLine) => {\n return { ...getDefaultRegressionOptions(lineConfig), degree: lineConfig.degree ?? 2 }\n },\n)\nexport const logisticRegressionLine: VChartSpecPipe = generateRegressionLinePipe(\n 'logisticRegressionLine',\n regressionLogistic,\n)\n"],"names":["generateRegressionLinePipe","type","regressionFunction","getOptions","getDefaultRegressionOptions","spec","context","result","advancedVSeed","chartType","regressionLine","lineTheme","lineList","array","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","confidenceIntervalOpacity","confidenceIntervalVisible","childrenMarks","datum","ctx","vchart","chart","s","rect","segments","yClamper","clamper","colorAttrOptions","groups","data","fieldX","fieldY","undefined","group","groupData","d","confidenceInterval","evaluateGrid","N","Math","mainColor","lineData","linePoints","ld","index","x","y","NaN","segment","intervalData","areaPoints","y1","opt","parentNode","isNullish","point","lineConfig","linearRegressionLine","regressionLinear","lowessRegressionLine","regressionLowess","polynomialRegressionLine","regressionPolynomial","logisticRegressionLine","regressionLogistic"],"mappings":";;AAqBO,MAAMA,6BAA6B,CACxCC,MACAC,oBASAC,aAAuCC,2BAA2B,GAE1D,CAACC,MAAkCC;QACzC,MAAMC,SAAS;YAAE,GAAGF,IAAI;QAAC;QACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;QAC1B,MAAM,EAAEG,SAAS,EAAEC,cAAc,EAAE,GAAGF;QACtC,MAAMG,YAAYH,cAAc,MAAM,CAACC,UAAuB,EAAE;QAEhE,IAAI,CAACC,kBAAkB,CAACA,cAAc,CAACT,KAAK,EAC1C,OAAOM;QAGT,MAAMK,WAAWC,MAAMH,cAAc,CAACT,KAAK;QAE3C,IAAI,CAACM,OAAO,aAAa,EACvBA,OAAO,aAAa,GAAG,EAAE;QAG3BK,SAAS,OAAO,CAAC,CAACE,MAAMC;YACtB,IAAID,AAAgB,UAAhBA,KAAK,MA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;QAEJ;QAEA,OAAOzD;IACT;AAGF,MAAMH,8BAA8B,CAClC6D,aAEO;QAAE,OAAOA,YAAY,mBAAmB;IAAK;AAG/C,MAAMC,uBAAuClE,2BAA2B,wBAAwBmE;AAChG,MAAMC,uBAAuCpE,2BAA2B,wBAAwBqE;AAChG,MAAMC,2BAA2CtE,2BACtD,4BACAuE,sBACA,CAACN,aACQ;QAAE,GAAG7D,4BAA4B6D,WAAW;QAAE,QAAQA,WAAW,MAAM,IAAI;IAAE;AAGjF,MAAMO,yBAAyCxE,2BACpD,0BACAyE"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/regressionLine/linearRegressionLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, IScatterChartSpec, IVChart } from '@visactor/vchart'\nimport { isNullish } from 'remeda'\nimport {\n array,\n clamper,\n regressionLinear,\n regressionLowess,\n regressionPolynomial,\n regressionLogistic,\n} from '@visactor/vutils'\nimport type {\n Datum,\n VChartSpecPipe,\n RegressionLineConfig,\n LinearRegressionLine,\n PolynomialRegressionLine,\n SpecPipelineContext,\n LogisticRegressionLine,\n LowessRegressionLine,\n} from 'src/types'\nimport { getAlphaByConfidenceLevel } from './common'\n\nexport const generateRegressionLinePipe = (\n type: 'linearRegressionLine' | 'lowessRegressionLine' | 'polynomialRegressionLine' | 'logisticRegressionLine',\n regressionFunction: (\n arr: Datum[],\n xAccessor: (d: Datum) => number,\n yAccessor: (d: Datum) => number,\n options?: any,\n ) => {\n confidenceInterval: (N: number) => { lower: number; upper: number; x: number }[]\n evaluateGrid: (N: number) => { x: number; y: number }[]\n },\n getOptions: (lineConfig: any) => any = getDefaultRegressionOptions,\n): VChartSpecPipe => {\n return ((spec: Partial<IScatterChartSpec>, context: SpecPipelineContext): Partial<IScatterChartSpec> => {\n const result = { ...spec }\n const { advancedVSeed } = context\n const { chartType, regressionLine } = advancedVSeed\n const lineTheme = advancedVSeed.config[chartType as 'scatter']?.regressionLine as RegressionLineConfig\n\n if (!regressionLine || !regressionLine[type]) {\n return result\n }\n\n const lineList = array(regressionLine[type])\n\n if (!result.extensionMark) {\n result.extensionMark = []\n }\n\n lineList.forEach((line, lineIndex) => {\n if (line.enable === false) {\n return\n }\n\n const theme = (lineTheme.linearRegressionLine ?? {}) as LinearRegressionLine\n const {\n color,\n lineWidth,\n lineDash,\n text,\n textColor,\n textFontSize,\n textFontWeight,\n confidenceIntervalOpacity,\n confidenceIntervalVisible = theme.confidenceIntervalVisible,\n } = line as LinearRegressionLine\n\n const childrenMarks: any[] = []\n\n ;(result.extensionMark as any[]).push({\n type: 'group',\n interactive: false,\n zIndex: 500,\n name: `${type}-${lineIndex}`,\n layoutType: 'region-relative',\n dataId: (spec.data as any)?.id,\n animation: false,\n style: {\n data: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const s = chart.getAllSeries()[0] as ICartesianSeries\n\n if (s) {\n const rect = s.getRegion().getLayoutRect()\n const segments: {\n areaPoints?: { x: number; y: number; y1: number }[]\n linePoints: { x: number; y: number }[]\n color: string\n }[] = []\n\n if (rect.width === 0 || rect.height === 0) {\n return segments\n }\n\n const yClamper = clamper(0, rect.height)\n const colorAttrOptions = s.getColorAttribute()\n const groups: (string | undefined)[] = s.getSeriesKeys()\n const data = s.getViewData()?.latestData as Datum[]\n const fieldX = s.fieldX?.[0]\n const fieldY = s.fieldY?.[0]\n\n if (!groups.length) {\n groups.push(undefined)\n }\n\n groups.forEach((group) => {\n const groupData = data.filter((d: Datum) => d[colorAttrOptions?.field] === group)\n\n if (groupData.length <= 2) {\n return\n }\n const { confidenceInterval, evaluateGrid } = regressionFunction(\n groupData,\n (datum: Datum) => datum?.[fieldX],\n (datum: Datum) => datum?.[fieldY],\n getOptions?.(line),\n )\n const N = Math.max(3, Math.floor(groupData.length / 4))\n const mainColor = color ?? colorAttrOptions?.scale?.scale(group)\n\n const lineData = evaluateGrid(N)\n const linePoints: { x: number; y: number }[] = []\n\n lineData.forEach((ld: Datum, index: number) => {\n const d = { [fieldX]: ld.x, [fieldY]: ld.y }\n const x = s.dataToPositionX(d)!\n const y = yClamper(s.dataToPositionY(d)!)\n\n if (segments.length && index === 0) {\n segments[segments.length - 1].linePoints.push({ x, y: NaN }) // 断开线段用的\n }\n\n linePoints.push({\n x,\n y,\n })\n })\n\n const segment: {\n color: string\n linePoints: { x: number; y: number }[]\n areaPoints?: { x: number; y: number; y1: number }[]\n } = {\n color: mainColor,\n linePoints,\n }\n\n if (confidenceIntervalVisible) {\n const intervalData = confidenceInterval(N)\n const areaPoints: { x: number; y: number; y1: number }[] = []\n\n intervalData.map((datum: Datum, index: number) => {\n const d = { [fieldX]: datum.x, [fieldY]: datum.lower }\n const x = s.dataToPositionX(d)!\n const y = yClamper(s.dataToPositionY(d)!)\n const y1 = yClamper(s.dataToPositionY({ [fieldY]: datum.upper })!)\n\n if (segments.length && index === 0) {\n segments[segments.length - 1].areaPoints!.push({ x, y: NaN, y1: NaN }) // 断开线段用的\n }\n\n areaPoints.push({ x, y, y1 })\n })\n\n segment.areaPoints = areaPoints\n }\n\n segments.push(segment)\n })\n\n return segments\n }\n return []\n },\n },\n children: childrenMarks,\n })\n\n if (confidenceIntervalVisible) {\n childrenMarks.push({\n type: 'area',\n interactive: false,\n zIndex: 500,\n dataId: (spec.data as any)?.id,\n style: {\n stroke: false,\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n fillOpacity: confidenceIntervalOpacity ?? theme.confidenceIntervalOpacity,\n fill: 'red', // vrender bug,必须要设置一个全局的fill,才会绘制\n segments: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode) {\n const data = parentNode.finalAttribute?.data ?? parentNode.attribute?.data\n\n if (data?.length) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return data.map((d: any) => {\n return {\n points: d.areaPoints ?? [],\n fill: d.color,\n }\n })\n }\n }\n\n return []\n },\n },\n })\n }\n\n childrenMarks.push({\n type: 'line',\n interactive: false,\n zIndex: 500,\n animation: false,\n dataId: (spec.data as any)?.id,\n style: {\n lineWidth: lineWidth ?? theme.lineWidth,\n lineDash: lineDash ?? theme.lineDash,\n stroke: 'red', // vrender bug,必须要设置一个全局的stroke,才会绘制\n segments: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode) {\n const data = parentNode.finalAttribute?.data ?? parentNode.attribute?.data\n if (data?.length) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return data.map((d: any) => {\n return {\n points: d.linePoints,\n stroke: d.color,\n }\n })\n }\n }\n\n return []\n },\n },\n })\n\n if (!isNullish(text)) {\n childrenMarks.push({\n type: 'text',\n interactive: false,\n zIndex: 500,\n animation: false,\n dataId: (spec.data as any)?.id,\n dataKey: () => {\n return `regressionLine-label-${lineIndex}`\n },\n style: {\n textAlign: 'end',\n fill: textColor ?? theme.textColor,\n fontSize: textFontSize ?? theme.textFontSize,\n fontWeight: textFontWeight ?? theme.textFontWeight,\n text: text,\n x: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.length) {\n const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints\n return point[point.length - 1]?.x\n }\n\n return undefined\n },\n y: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.data?.length) {\n const point = parentNode.attribute.data[parentNode.attribute.data.length - 1].linePoints\n return point[point.length - 1]?.y\n }\n\n return undefined\n },\n },\n })\n }\n })\n\n return result\n }) as VChartSpecPipe\n}\n\nconst getDefaultRegressionOptions = (\n lineConfig: PolynomialRegressionLine | LinearRegressionLine | LogisticRegressionLine | LowessRegressionLine,\n) => {\n const alpha = getAlphaByConfidenceLevel(lineConfig?.confidenceLevel)\n return { alpha }\n}\n\nexport const linearRegressionLine: VChartSpecPipe = generateRegressionLinePipe('linearRegressionLine', regressionLinear)\nexport const lowessRegressionLine: VChartSpecPipe = generateRegressionLinePipe('lowessRegressionLine', regressionLowess)\nexport const polynomialRegressionLine: VChartSpecPipe = generateRegressionLinePipe(\n 'polynomialRegressionLine',\n regressionPolynomial,\n (lineConfig: PolynomialRegressionLine) => {\n return { ...getDefaultRegressionOptions(lineConfig), degree: lineConfig.degree ?? 2 }\n },\n)\nexport const logisticRegressionLine: VChartSpecPipe = generateRegressionLinePipe(\n 'logisticRegressionLine',\n regressionLogistic,\n)\n"],"names":["generateRegressionLinePipe","type","regressionFunction","getOptions","getDefaultRegressionOptions","spec","context","result","advancedVSeed","chartType","regressionLine","lineTheme","lineList","array","line","lineIndex","theme","color","lineWidth","lineDash","text","textColor","textFontSize","textFontWeight","confidenceIntervalOpacity","confidenceIntervalVisible","childrenMarks","datum","ctx","vchart","chart","s","rect","segments","yClamper","clamper","colorAttrOptions","groups","data","fieldX","fieldY","undefined","group","groupData","d","confidenceInterval","evaluateGrid","N","Math","mainColor","lineData","linePoints","ld","index","x","y","NaN","segment","intervalData","areaPoints","y1","opt","parentNode","isNullish","point","lineConfig","alpha","getAlphaByConfidenceLevel","linearRegressionLine","regressionLinear","lowessRegressionLine","regressionLowess","polynomialRegressionLine","regressionPolynomial","logisticRegressionLine","regressionLogistic"],"mappings":";;;AAsBO,MAAMA,6BAA6B,CACxCC,MACAC,oBASAC,aAAuCC,2BAA2B,GAE1D,CAACC,MAAkCC;QACzC,MAAMC,SAAS;YAAE,GAAGF,IAAI;QAAC;QACzB,MAAM,EAAEG,aAAa,EAAE,GAAGF;QAC1B,MAAM,EAAEG,SAAS,EAAEC,cAAc,EAAE,GAAGF;QACtC,MAAMG,YAAYH,cAAc,MAAM,CAACC,UAAuB,EAAE;QAEhE,IAAI,CAACC,kBAAkB,CAACA,cAAc,CAACT,KAAK,EAC1C,OAAOM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BAEvC,IAAIC,YAAY,WAAW,MAAM,QAAQ;4BACvC,MAAME,QAAQF,WAAW,SAAS,CAAC,IAAI,CAACA,WAAW,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,UAAU;4BACxF,OAAOE,KAAK,CAACA,MAAM,MAAM,GAAG,EAAE,EAAE;wBAClC;oBAGF;gBACF;YACF;QAEJ;QAEA,OAAOzD;IACT;AAGF,MAAMH,8BAA8B,CAClC6D;IAEA,MAAMC,QAAQC,0BAA0BF,YAAY;IACpD,OAAO;QAAEC;IAAM;AACjB;AAEO,MAAME,uBAAuCpE,2BAA2B,wBAAwBqE;AAChG,MAAMC,uBAAuCtE,2BAA2B,wBAAwBuE;AAChG,MAAMC,2BAA2CxE,2BACtD,4BACAyE,sBACA,CAACR,aACQ;QAAE,GAAG7D,4BAA4B6D,WAAW;QAAE,QAAQA,WAAW,MAAM,IAAI;IAAE;AAGjF,MAAMS,yBAAyC1E,2BACpD,0BACA2E"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { FoldMeasureId } from "../../../../../dataReshape/constant.js";
|
|
1
2
|
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
2
3
|
const { advancedVSeed, vseed } = context;
|
|
3
4
|
const { chartType } = vseed;
|
|
4
5
|
const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
|
|
5
|
-
const { datasetReshapeInfo } = advancedVSeed;
|
|
6
|
-
const { foldInfo } = datasetReshapeInfo[0];
|
|
7
6
|
if ('dualAxis' === chartType && 'bar' !== spec.type) return spec;
|
|
8
7
|
return {
|
|
9
8
|
...spec,
|
|
10
9
|
stackCornerRadius: (_, datum)=>{
|
|
11
|
-
if (datum[
|
|
10
|
+
if (datum && datum[datum[FoldMeasureId]] > 0) return stackCornerRadius;
|
|
12
11
|
return 0;
|
|
13
12
|
}
|
|
14
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport type { Datum, VChartSpecPipe, StackCornerRadius } from 'src/types'\n\nexport const stackCornerRadius: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { FoldMeasureId } from 'src/dataReshape/constant'\nimport type { Datum, VChartSpecPipe, StackCornerRadius } from 'src/types'\n\nexport const stackCornerRadius: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius\n\n if (chartType === 'dualAxis' && (spec as any).type !== 'bar') {\n return spec\n }\n\n return {\n ...spec,\n stackCornerRadius: (_: unknown, datum: Datum) => {\n if (datum && datum[datum[FoldMeasureId]] > 0) {\n return stackCornerRadius\n }\n\n return 0\n },\n } as IBarChartSpec\n}\n"],"names":["stackCornerRadius","spec","context","advancedVSeed","vseed","chartType","_","datum","FoldMeasureId"],"mappings":";AAIO,MAAMA,sCAAoC,CAACC,MAAMC;IACtD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAMJ,oBAAoBG,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAEzE,IAAIA,AAAc,eAAdA,aAA6BJ,AAAsB,UAAtBA,KAAa,IAAI,EAChD,OAAOA;IAGT,OAAO;QACL,GAAGA,IAAI;QACP,mBAAmB,CAACK,GAAYC;YAC9B,IAAIA,SAASA,KAAK,CAACA,KAAK,CAACC,cAAc,CAAC,GAAG,GACzC,OAAOR;YAGT,OAAO;QACT;IACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { tooltip } from './tooltip';
|
|
2
|
-
export { tooltipPrimary, tooltipSecondary } from './tooltipDualAxis';
|
|
2
|
+
export { tooltipPrimary, tooltipSecondary, tooltipDualAxis } from './tooltipDualAxis';
|
|
3
3
|
export { tooltipScatter } from './tooltipScatter';
|
|
4
4
|
export { tooltipHeatmap } from './tooltipHeatmap';
|
|
5
5
|
export { tooltipBoxplot } from './tooltipBoxplot';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tooltip } from "./tooltip.js";
|
|
2
|
-
import { tooltipPrimary, tooltipSecondary } from "./tooltipDualAxis.js";
|
|
2
|
+
import { tooltipDualAxis, tooltipPrimary, tooltipSecondary } from "./tooltipDualAxis.js";
|
|
3
3
|
import { tooltipScatter } from "./tooltipScatter.js";
|
|
4
4
|
import { tooltipHeatmap } from "./tooltipHeatmap.js";
|
|
5
5
|
import { tooltipBoxplot } from "./tooltipBoxplot.js";
|
|
6
6
|
import { tooltipHistogram } from "./tooltipHistogram.js";
|
|
7
|
-
export { tooltip, tooltipBoxplot, tooltipHeatmap, tooltipHistogram, tooltipPrimary, tooltipScatter, tooltipSecondary };
|
|
7
|
+
export { tooltip, tooltipBoxplot, tooltipDualAxis, tooltipHeatmap, tooltipHistogram, tooltipPrimary, tooltipScatter, tooltipSecondary };
|
|
@@ -16,7 +16,6 @@ const tooltipPrimary = (spec, context)=>{
|
|
|
16
16
|
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
|
17
17
|
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
|
18
18
|
result.tooltip = {
|
|
19
|
-
style: getTooltipStyle(tooltip),
|
|
20
19
|
visible: enable,
|
|
21
20
|
mark: {
|
|
22
21
|
title: {
|
|
@@ -64,6 +63,21 @@ const tooltipSecondary = (spec, context)=>{
|
|
|
64
63
|
};
|
|
65
64
|
return result;
|
|
66
65
|
};
|
|
67
|
-
|
|
66
|
+
const tooltipDualAxis = (spec, context)=>{
|
|
67
|
+
const result = {
|
|
68
|
+
...spec
|
|
69
|
+
};
|
|
70
|
+
const { advancedVSeed } = context;
|
|
71
|
+
const { chartType } = advancedVSeed;
|
|
72
|
+
const baseConfig = advancedVSeed.config[chartType];
|
|
73
|
+
const { tooltip = {
|
|
74
|
+
enable: true
|
|
75
|
+
} } = baseConfig;
|
|
76
|
+
result.tooltip = {
|
|
77
|
+
style: getTooltipStyle(tooltip)
|
|
78
|
+
};
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
export { tooltipDualAxis, tooltipPrimary, tooltipSecondary };
|
|
68
82
|
|
|
69
83
|
//# sourceMappingURL=tooltipDualAxis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.ts"],"sourcesContent":["import { isNullish } from 'remeda'\nimport { createDimensionContent, createMarkContent } from './tooltip'\nimport type { FoldInfo, VChartSpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport { getTooltipStyle } from './tooltipStyle'\n\nexport const tooltipPrimary: VChartSpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n\n const foldInfoList = datasetReshapeInfo[0].foldInfoList as FoldInfo[]\n const unfoldInfo = datasetReshapeInfo[0].unfoldInfo\n\n result.tooltip = {\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.ts"],"sourcesContent":["import { isNullish } from 'remeda'\nimport { createDimensionContent, createMarkContent } from './tooltip'\nimport type { FoldInfo, VChartSpecPipe, Tooltip, UnfoldInfo } from 'src/types'\nimport { findAllMeasures } from 'src/pipeline/utils'\nimport { getTooltipStyle } from './tooltipStyle'\n\nexport const tooltipPrimary: VChartSpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n\n const foldInfoList = datasetReshapeInfo[0].foldInfoList as FoldInfo[]\n const unfoldInfo = datasetReshapeInfo[0].unfoldInfo\n\n result.tooltip = {\n visible: enable,\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n foldInfoList[0],\n unfoldInfo,\n ),\n },\n dimension: {\n title: {\n visible: true,\n },\n content: createDimensionContent(dimensions, measures, foldInfoList[0], unfoldInfo),\n },\n }\n return result\n}\n\nexport const tooltipSecondary: VChartSpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed, vseed } = context\n const { measures, datasetReshapeInfo, chartType, dimensions, encoding } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n const { enable } = tooltip\n\n if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) {\n return result\n }\n\n const foldInfoList = datasetReshapeInfo[0].foldInfoList as FoldInfo[]\n const unfoldInfo = datasetReshapeInfo[0].unfoldInfo as UnfoldInfo\n result.tooltip = {\n visible: enable,\n mark: {\n title: {\n visible: false,\n },\n content: createMarkContent(\n encoding.tooltip || [],\n dimensions,\n findAllMeasures(vseed.measures),\n foldInfoList[1],\n unfoldInfo,\n ),\n },\n dimension: {\n title: {\n visible: true,\n },\n content: createDimensionContent(dimensions, measures, foldInfoList[1], unfoldInfo),\n },\n }\n return result\n}\n\nexport const tooltipDualAxis: VChartSpecPipe = (spec, context) => {\n const result = { ...spec }\n const { advancedVSeed } = context\n const { chartType } = advancedVSeed\n const baseConfig = advancedVSeed.config[chartType] as { tooltip: Tooltip }\n const { tooltip = { enable: true } } = baseConfig\n\n result.tooltip = {\n style: getTooltipStyle(tooltip),\n }\n return result\n}\n"],"names":["tooltipPrimary","spec","context","result","advancedVSeed","vseed","measures","datasetReshapeInfo","chartType","dimensions","encoding","baseConfig","tooltip","enable","foldInfoList","unfoldInfo","createMarkContent","findAllMeasures","createDimensionContent","tooltipSecondary","isNullish","tooltipDualAxis","getTooltipStyle"],"mappings":";;;;AAMO,MAAMA,iBAAiC,CAACC,MAAMC;IACnD,MAAMC,SAAS;QAAE,GAAGF,IAAI;IAAC;IACzB,MAAM,EAAEG,aAAa,EAAEC,KAAK,EAAE,GAAGH;IACjC,MAAM,EAAEI,QAAQ,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGN;IAC1E,MAAMO,aAAaP,cAAc,MAAM,CAACI,UAAU;IAClD,MAAM,EAAEI,UAAU;QAAE,QAAQ;IAAK,CAAC,EAAE,GAAGD;IACvC,MAAM,EAAEE,MAAM,EAAE,GAAGD;IAEnB,MAAME,eAAeP,kBAAkB,CAAC,EAAE,CAAC,YAAY;IACvD,MAAMQ,aAAaR,kBAAkB,CAAC,EAAE,CAAC,UAAU;IAEnDJ,OAAO,OAAO,GAAG;QACf,SAASU;QACT,MAAM;YACJ,OAAO;gBACL,SAAS;YACX;YACA,SAASG,kBACPN,SAAS,OAAO,IAAI,EAAE,EACtBD,YACAQ,gBAAgBZ,MAAM,QAAQ,GAC9BS,YAAY,CAAC,EAAE,EACfC;QAEJ;QACA,WAAW;YACT,OAAO;gBACL,S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AE,QAAQ;IAAK,CAAC,EAAE,GAAGD;IAEvCR,OAAO,OAAO,GAAG;QACf,OAAOmB,gBAAgBV;IACzB;IACA,OAAOT;AACT"}
|
|
@@ -2,3 +2,4 @@ import type { Measure, MeasureTree } from '../../../types';
|
|
|
2
2
|
export declare const findMeasureById: (measures: MeasureTree | undefined, id: string) => Measure | undefined;
|
|
3
3
|
export declare const findFirstMeasure: (measures?: MeasureTree) => Measure | undefined;
|
|
4
4
|
export declare const findAllMeasures: (measures?: MeasureTree) => Measure[];
|
|
5
|
+
export declare const hasMultipleMeasureInSingleView: (measures?: MeasureTree) => boolean;
|
|
@@ -34,6 +34,18 @@ const findAllMeasures = (measures = [])=>{
|
|
|
34
34
|
});
|
|
35
35
|
return result;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
const hasMultipleMeasureInSingleView = (measures = [])=>{
|
|
38
|
+
if (measures.every((m)=>!('children' in m))) return measures.length > 1;
|
|
39
|
+
let found = false;
|
|
40
|
+
preorderTraverse(measures, (node)=>{
|
|
41
|
+
if (node.children && node.children.length > 1) {
|
|
42
|
+
found = true;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
47
|
+
return found;
|
|
48
|
+
};
|
|
49
|
+
export { findAllMeasures, findFirstMeasure, findMeasureById, hasMultipleMeasureInSingleView };
|
|
38
50
|
|
|
39
51
|
//# sourceMappingURL=find.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/utils/measures/find.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/measures/find.ts"],"sourcesContent":["import type { Measure, MeasureTree } from 'src/types'\nimport { preorderTraverse } from '../tree'\n\nexport const findMeasureById = (measures: MeasureTree = [], id: string): Measure | undefined => {\n if (!measures) return undefined\n let result: Measure | undefined\n\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n if (node.id === id) {\n result = node\n return true\n }\n }\n return false\n })\n return result\n}\n\nexport const findFirstMeasure = (measures: MeasureTree = []): Measure | undefined => {\n if (!measures) return undefined\n let result: Measure | undefined\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n result = node\n return true\n }\n return false\n })\n return result\n}\n\nexport const findAllMeasures = (measures: MeasureTree = []): Measure[] => {\n if (!measures) return []\n const result: Measure[] = []\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n result.push(node)\n }\n return false\n })\n return result\n}\n"],"names":["findMeasureById","measures","id","result","preorderTraverse","node","findFirstMeasure","findAllMeasures"],"mappings":";AAGO,MAAMA,kBAAkB,CAACC,WAAwB,EAAE,EAAEC;IAC1D,IAAI,CAACD,UAAU;IACf,IAAIE;IAEJC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GACrB;YAAA,IAAIA,KAAK,EAAE,KAAKH,IAAI;gBAClBC,SAASE;gBACT,OAAO;YACT;QAAA;QAEF,OAAO;IACT;IACA,OAAOF;AACT;AAEO,MAAMG,mBAAmB,CAACL,WAAwB,EAAE;IACzD,IAAI,CAACA,UAAU;IACf,IAAIE;IACJC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GAAI;YACzBF,SAASE;YACT,OAAO;QACT;QACA,OAAO;IACT;IACA,OAAOF;AACT;AAEO,MAAMI,kBAAkB,CAACN,WAAwB,EAAE;IACxD,IAAI,CAACA,UAAU,OAAO,EAAE;IACxB,MAAME,SAAoB,EAAE;IAC5BC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GACrBF,OAAO,IAAI,CAACE;QAEd,OAAO;IACT;IACA,OAAOF;AACT"}
|
|
1
|
+
{"version":3,"file":"pipeline/utils/measures/find.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/measures/find.ts"],"sourcesContent":["import type { Measure, MeasureGroup, MeasureTree } from 'src/types'\nimport { preorderTraverse } from '../tree'\n\nexport const findMeasureById = (measures: MeasureTree = [], id: string): Measure | undefined => {\n if (!measures) return undefined\n let result: Measure | undefined\n\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n if (node.id === id) {\n result = node\n return true\n }\n }\n return false\n })\n return result\n}\n\nexport const findFirstMeasure = (measures: MeasureTree = []): Measure | undefined => {\n if (!measures) return undefined\n let result: Measure | undefined\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n result = node\n return true\n }\n return false\n })\n return result\n}\n\nexport const findAllMeasures = (measures: MeasureTree = []): Measure[] => {\n if (!measures) return []\n const result: Measure[] = []\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if (!('children' in node)) {\n result.push(node)\n }\n return false\n })\n return result\n}\n\nexport const hasMultipleMeasureInSingleView = (measures: MeasureTree = []): boolean => {\n if (measures.every((m) => !('children' in m))) {\n return measures.length > 1\n }\n let found = false\n preorderTraverse<Measure, 'children'>(measures, (node) => {\n if ((node as MeasureGroup).children && (node as MeasureGroup).children!.length > 1) {\n found = true\n return true\n }\n return false\n })\n return found\n}\n"],"names":["findMeasureById","measures","id","result","preorderTraverse","node","findFirstMeasure","findAllMeasures","hasMultipleMeasureInSingleView","m","found"],"mappings":";AAGO,MAAMA,kBAAkB,CAACC,WAAwB,EAAE,EAAEC;IAC1D,IAAI,CAACD,UAAU;IACf,IAAIE;IAEJC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GACrB;YAAA,IAAIA,KAAK,EAAE,KAAKH,IAAI;gBAClBC,SAASE;gBACT,OAAO;YACT;QAAA;QAEF,OAAO;IACT;IACA,OAAOF;AACT;AAEO,MAAMG,mBAAmB,CAACL,WAAwB,EAAE;IACzD,IAAI,CAACA,UAAU;IACf,IAAIE;IACJC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GAAI;YACzBF,SAASE;YACT,OAAO;QACT;QACA,OAAO;IACT;IACA,OAAOF;AACT;AAEO,MAAMI,kBAAkB,CAACN,WAAwB,EAAE;IACxD,IAAI,CAACA,UAAU,OAAO,EAAE;IACxB,MAAME,SAAoB,EAAE;IAC5BC,iBAAsCH,UAAU,CAACI;QAC/C,IAAI,CAAE,eAAcA,IAAG,GACrBF,OAAO,IAAI,CAACE;QAEd,OAAO;IACT;IACA,OAAOF;AACT;AAEO,MAAMK,iCAAiC,CAACP,WAAwB,EAAE;IACvE,IAAIA,SAAS,KAAK,CAAC,CAACQ,IAAM,CAAE,eAAcA,CAAAA,IACxC,OAAOR,SAAS,MAAM,GAAG;IAE3B,IAAIS,QAAQ;IACZN,iBAAsCH,UAAU,CAACI;QAC/C,IAAKA,KAAsB,QAAQ,IAAKA,KAAsB,QAAQ,CAAE,MAAM,GAAG,GAAG;YAClFK,QAAQ;YACR,OAAO;QACT;QACA,OAAO;IACT;IACA,OAAOA;AACT"}
|
|
@@ -29,11 +29,11 @@ const getLightLinearAxis = ()=>({
|
|
|
29
29
|
visible: false,
|
|
30
30
|
tickInside: false,
|
|
31
31
|
tickSize: 4,
|
|
32
|
-
tickColor: '#
|
|
32
|
+
tickColor: '#E3E5EB'
|
|
33
33
|
},
|
|
34
34
|
line: {
|
|
35
35
|
visible: false,
|
|
36
|
-
lineColor: '#
|
|
36
|
+
lineColor: '#E3E5EB',
|
|
37
37
|
lineWidth: 1
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -75,11 +75,11 @@ const getLightBandAxis = ()=>({
|
|
|
75
75
|
visible: false,
|
|
76
76
|
tickInside: false,
|
|
77
77
|
tickSize: 4,
|
|
78
|
-
tickColor: '#
|
|
78
|
+
tickColor: '#E3E5EB'
|
|
79
79
|
},
|
|
80
80
|
line: {
|
|
81
81
|
visible: true,
|
|
82
|
-
lineColor: '#
|
|
82
|
+
lineColor: '#E3E5EB',
|
|
83
83
|
lineWidth: 1
|
|
84
84
|
}
|
|
85
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/common/axes.js","sources":["webpack://@visactor/vseed/./src/theme/common/axes.ts"],"sourcesContent":["import type { YBandAxis, YLinearAxis } from 'src/types'\n\nexport const getLightLinearAxis = (): YLinearAxis => ({\n nice: true,\n zero: true,\n inverse: false,\n label: {\n visible: true,\n labelAngle: 0,\n labelColor: '#8F959E',\n labelFontSize: 12,\n labelFontWeight: 400,\n },\n title: {\n visible: false,\n titleText: '',\n titleColor: '#606773',\n titleFontSize: 12,\n titleFontWeight: 400,\n },\n grid: {\n visible: true,\n gridColor: '#E3E5EB',\n gridWidth: 0.5,\n gridLineDash: [4, 2],\n },\n tick: {\n visible: false,\n tickInside: false,\n tickSize: 4,\n tickColor: '#
|
|
1
|
+
{"version":3,"file":"theme/common/axes.js","sources":["webpack://@visactor/vseed/./src/theme/common/axes.ts"],"sourcesContent":["import type { YBandAxis, YLinearAxis } from 'src/types'\n\nexport const getLightLinearAxis = (): YLinearAxis => ({\n nice: true,\n zero: true,\n inverse: false,\n label: {\n visible: true,\n labelAngle: 0,\n labelColor: '#8F959E',\n labelFontSize: 12,\n labelFontWeight: 400,\n },\n title: {\n visible: false,\n titleText: '',\n titleColor: '#606773',\n titleFontSize: 12,\n titleFontWeight: 400,\n },\n grid: {\n visible: true,\n gridColor: '#E3E5EB',\n gridWidth: 0.5,\n gridLineDash: [4, 2],\n },\n tick: {\n visible: false,\n tickInside: false,\n tickSize: 4,\n tickColor: '#E3E5EB',\n },\n line: {\n visible: false,\n lineColor: '#E3E5EB',\n lineWidth: 1,\n },\n})\n\nexport const getLightBandAxis = (): YBandAxis => ({\n labelAutoHide: true,\n labelAutoHideGap: 4,\n labelAutoLimit: true,\n labelAutoLimitLength: 80,\n labelAutoRotate: false,\n labelAutoRotateAngleRange: [0, -45, -90],\n label: {\n visible: true,\n labelAngle: 0,\n labelColor: '#8F959E',\n labelFontSize: 12,\n labelFontWeight: 400,\n },\n title: {\n visible: false,\n titleText: '',\n titleColor: '#606773',\n titleFontSize: 12,\n titleFontWeight: 400,\n },\n grid: {\n visible: false,\n gridColor: '#E3E5EB',\n gridWidth: 0.5,\n gridLineDash: [4, 2],\n },\n tick: {\n visible: false,\n tickInside: false,\n tickSize: 4,\n tickColor: '#E3E5EB',\n },\n line: {\n visible: true,\n lineColor: '#E3E5EB',\n lineWidth: 1,\n },\n})\n\nexport const getDarkLinearAxis = (): YLinearAxis => ({\n nice: true,\n zero: true,\n label: {\n visible: true,\n labelAngle: 0,\n labelColor: '#888C93',\n labelFontSize: 12,\n labelFontWeight: 400,\n },\n title: {\n visible: false,\n titleText: '',\n titleColor: '#BBBDC3',\n titleFontSize: 12,\n titleFontWeight: 400,\n },\n grid: {\n visible: true,\n gridColor: '#303339',\n gridWidth: 0.5,\n gridLineDash: [4, 2],\n },\n tick: {\n visible: false,\n tickInside: false,\n tickSize: 4,\n tickColor: '#303339',\n },\n line: {\n visible: false,\n lineColor: '#303339',\n lineWidth: 1,\n },\n})\n\nexport const getDarkBandAxis = (): YBandAxis => ({\n labelAutoHide: true,\n labelAutoHideGap: 4,\n labelAutoLimit: true,\n labelAutoLimitLength: 80,\n labelAutoRotate: false,\n labelAutoRotateAngleRange: [0, -45, -90],\n label: {\n visible: true,\n labelAngle: 0,\n labelColor: '#888C93',\n labelFontSize: 12,\n labelFontWeight: 400,\n },\n title: {\n visible: false,\n titleText: '',\n titleColor: '#BBBDC3',\n titleFontSize: 12,\n titleFontWeight: 400,\n },\n grid: {\n visible: false,\n gridColor: '#303339',\n gridWidth: 0.5,\n gridLineDash: [4, 2],\n },\n tick: {\n visible: false,\n tickInside: false,\n tickSize: 4,\n tickColor: '#303339',\n },\n line: {\n visible: true,\n lineColor: '#303339',\n lineWidth: 1,\n },\n})\n"],"names":["getLightLinearAxis","getLightBandAxis","getDarkLinearAxis","getDarkBandAxis"],"mappings":"AAEO,MAAMA,qBAAqB,IAAoB;QACpD,MAAM;QACN,MAAM;QACN,SAAS;QACT,OAAO;YACL,SAAS;YACT,YAAY;YACZ,YAAY;YACZ,eAAe;YACf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,gBAAgB;QAChB,sBAAsB;QACtB,iBAAiB;QACjB,2BAA2B;YAAC;YAAG;YAAK;SAAI;QACxC,OAAO;YACL,SAAS;YACT,YAAY;YACZ,YAAY;YACZ,eAAe;YACf,iBAAiB;QACnB;QACA,OAAO;YACL,SAAS;YACT,WAAW;YACX,YAAY;YACZ,eAAe;YACf,iBAAiB;QACnB;QACA,MAAM;YACJ,SAAS;YACT,WAAW;YACX,WAAW;YACX,cAAc;gBAAC;gBAAG;aAAE;QACtB;QACA,MAAM;YACJ,SAAS;YACT,YAAY;YACZ,UAAU;YACV,WAAW;QACb;QACA,MAAM;YACJ,SAAS;YACT,WAAW;YACX,WAAW;QACb;IACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BoxPlotStyle, OutlierStyle } from '../../types';
|
|
2
|
+
export declare const getLightBoxPlotStyle: () => BoxPlotStyle;
|
|
3
|
+
export declare const getDarkBoxPlotStyle: () => BoxPlotStyle;
|
|
4
|
+
export declare const getLightOutlierStyle: () => OutlierStyle;
|
|
5
|
+
export declare const getDarkOutlierStyle: () => OutlierStyle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getLightBoxPlotStyle = ()=>({
|
|
2
|
+
boxBorderColor: '#e3e5eb'
|
|
3
|
+
});
|
|
4
|
+
const getDarkBoxPlotStyle = ()=>({
|
|
5
|
+
boxBorderColor: '#4b4e53'
|
|
6
|
+
});
|
|
7
|
+
const getLightOutlierStyle = ()=>({
|
|
8
|
+
pointColor: '#8F959E'
|
|
9
|
+
});
|
|
10
|
+
const getDarkOutlierStyle = ()=>({
|
|
11
|
+
pointColor: '#36393e'
|
|
12
|
+
});
|
|
13
|
+
export { getDarkBoxPlotStyle, getDarkOutlierStyle, getLightBoxPlotStyle, getLightOutlierStyle };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=boxPlot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme/common/boxPlot.js","sources":["webpack://@visactor/vseed/./src/theme/common/boxPlot.ts"],"sourcesContent":["import type { BoxPlotStyle, OutlierStyle } from 'src/types'\n\nexport const getLightBoxPlotStyle = (): BoxPlotStyle => {\n return {\n boxBorderColor: '#e3e5eb',\n }\n}\n\nexport const getDarkBoxPlotStyle = (): BoxPlotStyle => {\n return {\n boxBorderColor: '#4b4e53',\n }\n}\n\nexport const getLightOutlierStyle = (): OutlierStyle => {\n return {\n pointColor: '#8F959E',\n }\n}\n\nexport const getDarkOutlierStyle = (): OutlierStyle => {\n return {\n pointColor: '#36393e',\n }\n}\n"],"names":["getLightBoxPlotStyle","getDarkBoxPlotStyle","getLightOutlierStyle","getDarkOutlierStyle"],"mappings":"AAEO,MAAMA,uBAAuB,IAC3B;QACL,gBAAgB;IAClB;AAGK,MAAMC,sBAAsB,IAC1B;QACL,gBAAgB;IAClB;AAGK,MAAMC,uBAAuB,IAC3B;QACL,YAAY;IACd;AAGK,MAAMC,sBAAsB,IAC1B;QACL,YAAY;IACd"}
|
|
@@ -8,9 +8,9 @@ const getDarkCrosshairLine = ()=>({
|
|
|
8
8
|
const getDarkCrosshairRect = ()=>({
|
|
9
9
|
visible: true,
|
|
10
10
|
labelVisible: true,
|
|
11
|
-
labelColor: '#
|
|
12
|
-
labelBackgroundColor: '#
|
|
13
|
-
rectColor: '#
|
|
11
|
+
labelColor: '#ffffff',
|
|
12
|
+
labelBackgroundColor: '#404349',
|
|
13
|
+
rectColor: '#4B4F54'
|
|
14
14
|
});
|
|
15
15
|
const getLightCrosshairLine = ()=>({
|
|
16
16
|
visible: true,
|
|
@@ -24,7 +24,7 @@ const getLightCrosshairRect = ()=>({
|
|
|
24
24
|
labelVisible: true,
|
|
25
25
|
labelColor: '#ffffff',
|
|
26
26
|
labelBackgroundColor: '#364159',
|
|
27
|
-
rectColor: '#
|
|
27
|
+
rectColor: '#D9DDE4'
|
|
28
28
|
});
|
|
29
29
|
export { getDarkCrosshairLine, getDarkCrosshairRect, getLightCrosshairLine, getLightCrosshairRect };
|
|
30
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/common/crosshair.js","sources":["webpack://@visactor/vseed/./src/theme/common/crosshair.ts"],"sourcesContent":["export const getDarkCrosshairLine = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#ffffff',\n labelBackgroundColor: '#404349',\n lineColor: '#55595F',\n})\n\nexport const getDarkCrosshairRect = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#
|
|
1
|
+
{"version":3,"file":"theme/common/crosshair.js","sources":["webpack://@visactor/vseed/./src/theme/common/crosshair.ts"],"sourcesContent":["export const getDarkCrosshairLine = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#ffffff',\n labelBackgroundColor: '#404349',\n lineColor: '#55595F',\n})\n\nexport const getDarkCrosshairRect = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#ffffff',\n labelBackgroundColor: '#404349',\n rectColor: '#4B4F54',\n})\n\nexport const getLightCrosshairLine = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#ffffff',\n labelBackgroundColor: '#21252C',\n lineColor: '#21252C',\n})\nexport const getLightCrosshairRect = () => ({\n visible: true,\n labelVisible: true,\n labelColor: '#ffffff',\n labelBackgroundColor: '#364159',\n rectColor: '#D9DDE4',\n})\n"],"names":["getDarkCrosshairLine","getDarkCrosshairRect","getLightCrosshairLine","getLightCrosshairRect"],"mappings":"AAAO,MAAMA,uBAAuB,IAAO;QACzC,SAAS;QACT,cAAc;QACd,YAAY;QACZ,sBAAsB;QACtB,WAAW;IACb;AAEO,MAAMC,uBAAuB,IAAO;QACzC,SAAS;QACT,cAAc;QACd,YAAY;QACZ,sBAAsB;QACtB,WAAW;IACb;AAEO,MAAMC,wBAAwB,IAAO;QAC1C,SAAS;QACT,cAAc;QACd,YAAY;QACZ,sBAAsB;QACtB,WAAW;IACb;AACO,MAAMC,wBAAwB,IAAO;QAC1C,SAAS;QACT,cAAc;QACd,YAAY;QACZ,sBAAsB;QACtB,WAAW;IACb"}
|
|
@@ -45,12 +45,14 @@ const pickPivotChartGridConfig = (tableConfig)=>({
|
|
|
45
45
|
});
|
|
46
46
|
const getLightPivotChartGridConfig = ()=>{
|
|
47
47
|
const res = pickPivotChartGridConfig(getLightTableConfig());
|
|
48
|
+
res.hoverHeaderInlineBackgroundColor = '#D9DDE446';
|
|
48
49
|
res.chartGridColor = '#F0F1F6';
|
|
49
50
|
res.axisLabelColor = '#BCC1CB';
|
|
50
51
|
return res;
|
|
51
52
|
};
|
|
52
53
|
const getDarkPivotChartGridConfig = ()=>{
|
|
53
54
|
const res = pickPivotChartGridConfig(getDarkTableConfig());
|
|
55
|
+
res.hoverHeaderInlineBackgroundColor = '#4b4f5446';
|
|
54
56
|
return res;
|
|
55
57
|
};
|
|
56
58
|
export { getDarkPivotChartGridConfig, getDarkTableConfig, getDefaultTableConfig, getLightPivotChartGridConfig, getLightTableConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/common/table.js","sources":["webpack://@visactor/vseed/./src/theme/common/table.ts"],"sourcesContent":["import type { PivotChartGridConfig } from 'src/types'\n\nexport const getDefaultTableConfig = () => ({\n bodyFontSize: 12,\n bodyBackgroundColor: 'transparent',\n headerFontSize: 12,\n})\n\nexport const getLightTableConfig = () => ({\n ...getDefaultTableConfig(),\n borderColor: '#e3e5eb',\n\n bodyFontColor: '#141414',\n\n headerFontColor: '#21252c',\n headerBackgroundColor: '#f6f7f9',\n\n hoverBodyBackgroundColor: '#bedaff',\n hoverBodyInlineBackgroundColor: '#bedaff33',\n hoverHeaderBackgroundColor: '#D9DDE4',\n hoverHeaderInlineBackgroundColor: '#D9DDE455',\n\n selectedBorderColor: '#4080ff',\n selectedBackgroundColor: '#bedaff33',\n\n backgroundColor: 'transparent',\n})\n\nexport const getDarkTableConfig = () => ({\n ...getDefaultTableConfig(),\n borderColor: '#4b4e53',\n\n bodyFontColor: '#fdfdfd',\n headerFontColor: '#fdfdfd',\n headerBackgroundColor: '#36393e',\n\n hoverBodyBackgroundColor: '#4284ff66',\n hoverBodyInlineBackgroundColor: '#4284ff10',\n hoverHeaderBackgroundColor: '#6f7984cc',\n hoverHeaderInlineBackgroundColor: '#4b4f54',\n\n selectedBorderColor: '#3073f2',\n selectedBackgroundColor: '#4284ff33',\n})\n\nconst pickPivotChartGridConfig = (tableConfig: any) => {\n return {\n outlineBorderLineWidth: 0,\n frameCornerRadius: 0,\n borderColor: tableConfig.borderColor,\n bodyFontColor: tableConfig.bodyFontColor,\n headerFontColor: tableConfig.headerFontColor,\n\n headerBackgroundColor: 'transparent',\n hoverHeaderBackgroundColor: tableConfig.hoverHeaderBackgroundColor,\n hoverHeaderInlineBackgroundColor: tableConfig.hoverHeaderInlineBackgroundColor,\n\n titleFontColor: tableConfig.headerFontColor,\n titleFontSize: tableConfig.headerFontSize,\n titleFontWeight: 'bold',\n }\n}\n\nexport const getLightPivotChartGridConfig = () => {\n const res = pickPivotChartGridConfig(getLightTableConfig()) as PivotChartGridConfig\n\n res.chartGridColor = '#F0F1F6'\n res.axisLabelColor = '#BCC1CB'\n\n return res\n}\n\nexport const getDarkPivotChartGridConfig = () => {\n const res = pickPivotChartGridConfig(getDarkTableConfig()) as PivotChartGridConfig\n\n return res\n}\n"],"names":["getDefaultTableConfig","getLightTableConfig","getDarkTableConfig","pickPivotChartGridConfig","tableConfig","getLightPivotChartGridConfig","res","getDarkPivotChartGridConfig"],"mappings":"AAEO,MAAMA,wBAAwB,IAAO;QAC1C,cAAc;QACd,qBAAqB;QACrB,gBAAgB;IAClB;AAEO,MAAMC,sBAAsB,IAAO;QACxC,GAAGD,uBAAuB;QAC1B,aAAa;QAEb,eAAe;QAEf,iBAAiB;QACjB,uBAAuB;QAEvB,0BAA0B;QAC1B,gCAAgC;QAChC,4BAA4B;QAC5B,kCAAkC;QAElC,qBAAqB;QACrB,yBAAyB;QAEzB,iBAAiB;IACnB;AAEO,MAAME,qBAAqB,IAAO;QACvC,GAAGF,uBAAuB;QAC1B,aAAa;QAEb,eAAe;QACf,iBAAiB;QACjB,uBAAuB;QAEvB,0BAA0B;QAC1B,gCAAgC;QAChC,4BAA4B;QAC5B,kCAAkC;QAElC,qBAAqB;QACrB,yBAAyB;IAC3B;AAEA,MAAMG,2BAA2B,CAACC,cACzB;QACL,wBAAwB;QACxB,mBAAmB;QACnB,aAAaA,YAAY,WAAW;QACpC,eAAeA,YAAY,aAAa;QACxC,iBAAiBA,YAAY,eAAe;QAE5C,uBAAuB;QACvB,4BAA4BA,YAAY,0BAA0B;QAClE,kCAAkCA,YAAY,gCAAgC;QAE9E,gBAAgBA,YAAY,eAAe;QAC3C,eAAeA,YAAY,cAAc;QACzC,iBAAiB;IACnB;AAGK,MAAMC,+BAA+B;IAC1C,MAAMC,MAAMH,yBAAyBF;IAErCK,IAAI,cAAc,GAAG;IACrBA,IAAI,cAAc,GAAG;IAErB,OAAOA;AACT;AAEO,MAAMC,8BAA8B;IACzC,MAAMD,MAAMH,yBAAyBD;
|
|
1
|
+
{"version":3,"file":"theme/common/table.js","sources":["webpack://@visactor/vseed/./src/theme/common/table.ts"],"sourcesContent":["import type { PivotChartGridConfig } from 'src/types'\n\nexport const getDefaultTableConfig = () => ({\n bodyFontSize: 12,\n bodyBackgroundColor: 'transparent',\n headerFontSize: 12,\n})\n\nexport const getLightTableConfig = () => ({\n ...getDefaultTableConfig(),\n borderColor: '#e3e5eb',\n\n bodyFontColor: '#141414',\n\n headerFontColor: '#21252c',\n headerBackgroundColor: '#f6f7f9',\n\n hoverBodyBackgroundColor: '#bedaff',\n hoverBodyInlineBackgroundColor: '#bedaff33',\n hoverHeaderBackgroundColor: '#D9DDE4',\n hoverHeaderInlineBackgroundColor: '#D9DDE455',\n\n selectedBorderColor: '#4080ff',\n selectedBackgroundColor: '#bedaff33',\n\n backgroundColor: 'transparent',\n})\n\nexport const getDarkTableConfig = () => ({\n ...getDefaultTableConfig(),\n borderColor: '#4b4e53',\n\n bodyFontColor: '#fdfdfd',\n headerFontColor: '#fdfdfd',\n headerBackgroundColor: '#36393e',\n\n hoverBodyBackgroundColor: '#4284ff66',\n hoverBodyInlineBackgroundColor: '#4284ff10',\n hoverHeaderBackgroundColor: '#6f7984cc',\n hoverHeaderInlineBackgroundColor: '#4b4f54',\n\n selectedBorderColor: '#3073f2',\n selectedBackgroundColor: '#4284ff33',\n})\n\nconst pickPivotChartGridConfig = (tableConfig: any) => {\n return {\n outlineBorderLineWidth: 0,\n frameCornerRadius: 0,\n borderColor: tableConfig.borderColor,\n bodyFontColor: tableConfig.bodyFontColor,\n headerFontColor: tableConfig.headerFontColor,\n\n headerBackgroundColor: 'transparent',\n hoverHeaderBackgroundColor: tableConfig.hoverHeaderBackgroundColor,\n hoverHeaderInlineBackgroundColor: tableConfig.hoverHeaderInlineBackgroundColor,\n\n titleFontColor: tableConfig.headerFontColor,\n titleFontSize: tableConfig.headerFontSize,\n titleFontWeight: 'bold',\n }\n}\n\nexport const getLightPivotChartGridConfig = () => {\n const res = pickPivotChartGridConfig(getLightTableConfig()) as PivotChartGridConfig\n\n res.hoverHeaderInlineBackgroundColor = '#D9DDE446'\n\n res.chartGridColor = '#F0F1F6'\n res.axisLabelColor = '#BCC1CB'\n\n return res\n}\n\nexport const getDarkPivotChartGridConfig = () => {\n const res = pickPivotChartGridConfig(getDarkTableConfig()) as PivotChartGridConfig\n\n res.hoverHeaderInlineBackgroundColor = '#4b4f5446'\n\n return res\n}\n"],"names":["getDefaultTableConfig","getLightTableConfig","getDarkTableConfig","pickPivotChartGridConfig","tableConfig","getLightPivotChartGridConfig","res","getDarkPivotChartGridConfig"],"mappings":"AAEO,MAAMA,wBAAwB,IAAO;QAC1C,cAAc;QACd,qBAAqB;QACrB,gBAAgB;IAClB;AAEO,MAAMC,sBAAsB,IAAO;QACxC,GAAGD,uBAAuB;QAC1B,aAAa;QAEb,eAAe;QAEf,iBAAiB;QACjB,uBAAuB;QAEvB,0BAA0B;QAC1B,gCAAgC;QAChC,4BAA4B;QAC5B,kCAAkC;QAElC,qBAAqB;QACrB,yBAAyB;QAEzB,iBAAiB;IACnB;AAEO,MAAME,qBAAqB,IAAO;QACvC,GAAGF,uBAAuB;QAC1B,aAAa;QAEb,eAAe;QACf,iBAAiB;QACjB,uBAAuB;QAEvB,0BAA0B;QAC1B,gCAAgC;QAChC,4BAA4B;QAC5B,kCAAkC;QAElC,qBAAqB;QACrB,yBAAyB;IAC3B;AAEA,MAAMG,2BAA2B,CAACC,cACzB;QACL,wBAAwB;QACxB,mBAAmB;QACnB,aAAaA,YAAY,WAAW;QACpC,eAAeA,YAAY,aAAa;QACxC,iBAAiBA,YAAY,eAAe;QAE5C,uBAAuB;QACvB,4BAA4BA,YAAY,0BAA0B;QAClE,kCAAkCA,YAAY,gCAAgC;QAE9E,gBAAgBA,YAAY,eAAe;QAC3C,eAAeA,YAAY,cAAc;QACzC,iBAAiB;IACnB;AAGK,MAAMC,+BAA+B;IAC1C,MAAMC,MAAMH,yBAAyBF;IAErCK,IAAI,gCAAgC,GAAG;IAEvCA,IAAI,cAAc,GAAG;IACrBA,IAAI,cAAc,GAAG;IAErB,OAAOA;AACT;AAEO,MAAMC,8BAA8B;IACzC,MAAMD,MAAMH,yBAAyBD;IAErCI,IAAI,gCAAgC,GAAG;IAEvC,OAAOA;AACT"}
|
|
@@ -5,6 +5,7 @@ import { getDarkAnnotation } from "../common/annotaion.js";
|
|
|
5
5
|
import { getDarkFunnelTransformTheme } from "../common/funnelTransform.js";
|
|
6
6
|
import { getDarkHeatmapCellTheme } from "../common/heatmapCell.js";
|
|
7
7
|
import { getDarkRegressionLine } from "../common/regressionLine.js";
|
|
8
|
+
import { getDarkBoxPlotStyle, getDarkOutlierStyle } from "../common/boxPlot.js";
|
|
8
9
|
const darkTheme = ()=>{
|
|
9
10
|
const linearAxis = getDarkLinearAxis();
|
|
10
11
|
const bandAxis = getDarkBandAxis();
|
|
@@ -263,7 +264,9 @@ const darkTheme = ()=>{
|
|
|
263
264
|
yAxis: linearAxis,
|
|
264
265
|
crosshairRect: crosshairRect,
|
|
265
266
|
pivotGrid: getDarkPivotChartGridConfig(),
|
|
266
|
-
annotation: getDarkAnnotation()
|
|
267
|
+
annotation: getDarkAnnotation(),
|
|
268
|
+
boxPlotStyle: getDarkBoxPlotStyle(),
|
|
269
|
+
outlierStyle: getDarkOutlierStyle()
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme/dark/dark.js","sources":["webpack://@visactor/vseed/./src/theme/dark/dark.ts"],"sourcesContent":["import type { CustomThemeConfig, YBandAxis } from 'src/types'\nimport {\n getDarkColor,\n getDarkCrosshairLine,\n getDarkCrosshairRect,\n getDarkTableConfig,\n getDarkPivotChartGridConfig,\n getDarkLabel,\n getDarkLegend,\n} from '../common'\nimport { getDarkTooltip } from '../common/tooltip'\nimport { getDarkBandAxis, getDarkLinearAxis } from '../common/axes'\nimport { getDarkAnnotation } from '../common/annotaion'\nimport { getDarkFunnelTransformTheme } from '../common/funnelTransform'\nimport { getDarkHeatmapCellTheme } from '../common/heatmapCell'\nimport { getDarkRegressionLine } from '../common/regressionLine'\n\nexport const darkTheme = (): CustomThemeConfig => {\n const linearAxis = getDarkLinearAxis()\n const bandAxis = getDarkBandAxis()\n const barBandAxis: YBandAxis = {\n ...bandAxis,\n labelAutoHide: false,\n labelAutoHideGap: 1,\n labelAutoLimit: false,\n labelAutoLimitLength: undefined,\n labelAutoRotate: false,\n labelAutoRotateAngleRange: [0, -45, -90],\n }\n const crosshairLine = getDarkCrosshairLine()\n const crosshairRect = getDarkCrosshairRect()\n\n const baseConfig = {\n backgroundColor: 'transparent',\n color: getDarkColor(),\n label: getDarkLabel(),\n legend: getDarkLegend(),\n tooltip: getDarkTooltip(),\n }\n\n const tableConfig = getDarkTableConfig()\n\n return {\n config: {\n table: tableConfig,\n pivotTable: tableConfig,\n\n // cartesian\n line: {\n ...baseConfig,\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n column: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n\n regressionLine: getDarkRegressionLine(),\n },\n columnParallel: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n columnPercent: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n bar: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n barParallel: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n barPercent: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n area: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n areaPercent: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n scatter: {\n ...baseConfig,\n crosshairLine,\n sizeRange: [8, 24],\n xAxis: {\n ...linearAxis,\n line: {\n ...linearAxis.line,\n visible: true,\n },\n },\n yAxis: {\n ...linearAxis,\n line: {\n ...linearAxis.line,\n visible: true,\n },\n },\n label: {\n ...baseConfig.label,\n showValue: false,\n showValuePercent: false,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n regressionLine: getDarkRegressionLine(),\n },\n dualAxis: {\n ...baseConfig,\n xAxis: bandAxis,\n primaryYAxis: linearAxis,\n secondaryYAxis: { ...linearAxis, grid: { visible: false } },\n dualChartType: {\n primary: 'column',\n secondary: 'line',\n },\n crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n // polar\n pie: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n labelLayout: 'arc',\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n donut: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n labelLayout: 'arc',\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n radar: {\n ...baseConfig,\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n rose: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n roseParallel: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n showDimension: true,\n },\n\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n // other\n funnel: {\n ...baseConfig,\n transform: getDarkFunnelTransformTheme(),\n\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n heatmap: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n labelColorSmartInvert: true,\n },\n\n cell: getDarkHeatmapCellTheme(),\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n histogram: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n regressionLine: getDarkRegressionLine(),\n },\n boxPlot: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n },\n }\n}\n"],"names":["darkTheme","linearAxis","getDarkLinearAxis","bandAxis","getDarkBandAxis","barBandAxis","undefined","crosshairLine","getDarkCrosshairLine","crosshairRect","getDarkCrosshairRect","baseConfig","getDarkColor","getDarkLabel","getDarkLegend","getDarkTooltip","tableConfig","getDarkTableConfig","getDarkPivotChartGridConfig","getDarkAnnotation","getDarkRegressionLine","getDarkFunnelTransformTheme","getDarkHeatmapCellTheme"],"mappings":";;;;;;;AAiBO,MAAMA,YAAY;IACvB,MAAMC,aAAaC;IACnB,MAAMC,WAAWC;IACjB,MAAMC,cAAyB;QAC7B,GAAGF,QAAQ;QACX,eAAe;QACf,kBAAkB;QAClB,gBAAgB;QAChB,sBAAsBG;QACtB,iBAAiB;QACjB,2BAA2B;YAAC;YAAG;YAAK;SAAI;IAC1C;IACA,MAAMC,gBAAgBC;IACtB,MAAMC,gBAAgBC;IAEtB,MAAMC,aAAa;QACjB,iBAAiB;QACjB,OAAOC;QACP,OAAOC;QACP,QAAQC;QACR,SAASC;IACX;IAEA,MAAMC,cAAcC;IAEpB,OAAO;QACL,QAAQ;YACN,OAAOD;YACP,YAAYA;YAGZ,MAAM;gBACJ,GAAGL,UAAU;gBACb,OAAOR;gBACP,OAAOF;gBACP,eAAeM;gBACf,WAAWW;gBACX,YAAYC;YACd;YACA,QAAQ;gBACN,GAAGR,UAAU;gBAEb,OAAOR;gBACP,OAAOF;gBACP,eAAeQ;gBACf,mBAAmB;oBAAC;oBAAG;oBAAG;oBAAG;iBA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eQ;gBACf,WAAWS;gBACX,YAAYC;gBACZ,gBAAgBC;YAClB;YACA,SAAS;gBACP,GAAGT,UAAU;gBAEb,OAAOR;gBACP,OAAOF;gBACP,eAAeQ;gBACf,WAAWS;gBACX,YAAYC;YACd;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"file":"theme/dark/dark.js","sources":["webpack://@visactor/vseed/./src/theme/dark/dark.ts"],"sourcesContent":["import type { CustomThemeConfig, YBandAxis } from 'src/types'\nimport {\n getDarkColor,\n getDarkCrosshairLine,\n getDarkCrosshairRect,\n getDarkTableConfig,\n getDarkPivotChartGridConfig,\n getDarkLabel,\n getDarkLegend,\n} from '../common'\nimport { getDarkTooltip } from '../common/tooltip'\nimport { getDarkBandAxis, getDarkLinearAxis } from '../common/axes'\nimport { getDarkAnnotation } from '../common/annotaion'\nimport { getDarkFunnelTransformTheme } from '../common/funnelTransform'\nimport { getDarkHeatmapCellTheme } from '../common/heatmapCell'\nimport { getDarkRegressionLine } from '../common/regressionLine'\nimport { getDarkBoxPlotStyle, getDarkOutlierStyle } from '../common/boxPlot'\n\nexport const darkTheme = (): CustomThemeConfig => {\n const linearAxis = getDarkLinearAxis()\n const bandAxis = getDarkBandAxis()\n const barBandAxis: YBandAxis = {\n ...bandAxis,\n labelAutoHide: false,\n labelAutoHideGap: 1,\n labelAutoLimit: false,\n labelAutoLimitLength: undefined,\n labelAutoRotate: false,\n labelAutoRotateAngleRange: [0, -45, -90],\n }\n const crosshairLine = getDarkCrosshairLine()\n const crosshairRect = getDarkCrosshairRect()\n\n const baseConfig = {\n backgroundColor: 'transparent',\n color: getDarkColor(),\n label: getDarkLabel(),\n legend: getDarkLegend(),\n tooltip: getDarkTooltip(),\n }\n\n const tableConfig = getDarkTableConfig()\n\n return {\n config: {\n table: tableConfig,\n pivotTable: tableConfig,\n\n // cartesian\n line: {\n ...baseConfig,\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n column: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n\n regressionLine: getDarkRegressionLine(),\n },\n columnParallel: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n columnPercent: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [4, 4, 0, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n bar: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n barParallel: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n barPercent: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: barBandAxis,\n crosshairRect: crosshairRect,\n stackCornerRadius: [0, 4, 4, 0],\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n area: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n areaPercent: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairLine: crosshairLine,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n scatter: {\n ...baseConfig,\n crosshairLine,\n sizeRange: [8, 24],\n xAxis: {\n ...linearAxis,\n line: {\n ...linearAxis.line,\n visible: true,\n },\n },\n yAxis: {\n ...linearAxis,\n line: {\n ...linearAxis.line,\n visible: true,\n },\n },\n label: {\n ...baseConfig.label,\n showValue: false,\n showValuePercent: false,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n regressionLine: getDarkRegressionLine(),\n },\n dualAxis: {\n ...baseConfig,\n xAxis: bandAxis,\n primaryYAxis: linearAxis,\n secondaryYAxis: { ...linearAxis, grid: { visible: false } },\n dualChartType: {\n primary: 'column',\n secondary: 'line',\n },\n crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n },\n // polar\n pie: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n labelLayout: 'arc',\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n donut: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n labelLayout: 'arc',\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n radar: {\n ...baseConfig,\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n rose: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n showDimension: true,\n },\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n roseParallel: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n showValuePercent: true,\n showDimension: true,\n },\n\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n // other\n funnel: {\n ...baseConfig,\n transform: getDarkFunnelTransformTheme(),\n\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n heatmap: {\n ...baseConfig,\n label: {\n ...baseConfig.label,\n labelColorSmartInvert: true,\n },\n\n cell: getDarkHeatmapCellTheme(),\n pivotGrid: getDarkPivotChartGridConfig(),\n },\n histogram: {\n ...baseConfig,\n\n xAxis: linearAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n regressionLine: getDarkRegressionLine(),\n },\n boxPlot: {\n ...baseConfig,\n\n xAxis: bandAxis,\n yAxis: linearAxis,\n crosshairRect: crosshairRect,\n pivotGrid: getDarkPivotChartGridConfig(),\n annotation: getDarkAnnotation(),\n\n boxPlotStyle: getDarkBoxPlotStyle(),\n outlierStyle: getDarkOutlierStyle(),\n },\n },\n }\n}\n"],"names":["darkTheme","linearAxis","getDarkLinearAxis","bandAxis","getDarkBandAxis","barBandAxis","undefined","crosshairLine","getDarkCrosshairLine","crosshairRect","getDarkCrosshairRect","baseConfig","getDarkColor","getDarkLabel","getDarkLegend","getDarkTooltip","tableConfig","getDarkTableConfig","getDarkPivotChartGridConfig","getDarkAnnotation","getDarkRegressionLine","getDarkFunnelTransformTheme","getDarkHeatmapCellTheme","getDarkBoxPlotStyle","getDarkOutlierStyle"],"mappings":";;;;;;;;AAkBO,MAAMA,YAAY;IACvB,MAAMC,aAAaC;IACnB,MAAMC,WAAWC;IACjB,MAAMC,cAAyB;QAC7B,GAAGF,QAAQ;QACX,eAAe;QACf,kBAAkB;QAClB,gBAAgB;QAChB,sBAAsBG;QACtB,iBAAiB;QACjB,2BAA2B;YAAC;YAAG;YAAK;SAAI;IAC1C;IACA,MAAMC,gBAAgBC;IACtB,MAAMC,gBAAgBC;IAEtB,MAAMC,aAAa;QACjB,iBAAiB;QACjB,OAAOC;QACP,OAAOC;QACP,QAAQC;QACR,SAASC;IACX;IAEA,MAAMC,cAAcC;IAEpB,OAAO;QACL,QAAQ;YACN,OAAOD;YACP,YAAYA;YAGZ,MAAM;gBACJ,GAAGL,UAAU;gBACb,OAAOR;gBACP,OAAOF;gBACP,eAAeM;gBACf,WAAWW;gBACX,YAAYC;YACd;YACA,QAAQ;gBACN,GAAGR,UAAU;gBAEb,OAAOR;gBACP,OAAOF;gBACP,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BACT,GAAGP,UAAU;gBAEb,OAAOV;gBACP,OAAOA;gBACP,eAAeQ;gBACf,WAAWS;gBACX,YAAYC;gBACZ,gBAAgBC;YAClB;YACA,SAAS;gBACP,GAAGT,UAAU;gBAEb,OAAOR;gBACP,OAAOF;gBACP,eAAeQ;gBACf,WAAWS;gBACX,YAAYC;gBAEZ,cAAcI;gBACd,cAAcC;YAChB;QACF;IACF;AACF"}
|
|
@@ -5,6 +5,7 @@ import { getLightAnnotation } from "../common/annotaion.js";
|
|
|
5
5
|
import { getLightFunnelTransformTheme } from "../common/funnelTransform.js";
|
|
6
6
|
import { getLightHeatmapCellTheme } from "../common/heatmapCell.js";
|
|
7
7
|
import { getLightRegressionLine } from "../common/regressionLine.js";
|
|
8
|
+
import { getLightBoxPlotStyle, getLightOutlierStyle } from "../common/boxPlot.js";
|
|
8
9
|
const lightTheme = ()=>{
|
|
9
10
|
const linearAxis = getLightLinearAxis();
|
|
10
11
|
const bandAxis = getLightBandAxis();
|
|
@@ -269,7 +270,9 @@ const lightTheme = ()=>{
|
|
|
269
270
|
yAxis: linearAxis,
|
|
270
271
|
crosshairRect,
|
|
271
272
|
pivotGrid: getLightPivotChartGridConfig(),
|
|
272
|
-
annotation: getLightAnnotation()
|
|
273
|
+
annotation: getLightAnnotation(),
|
|
274
|
+
boxPlotStyle: getLightBoxPlotStyle(),
|
|
275
|
+
outlierStyle: getLightOutlierStyle()
|
|
273
276
|
}
|
|
274
277
|
}
|
|
275
278
|
};
|