@milaboratories/miplots4 1.2.2 → 1.2.3

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.
Files changed (58) hide show
  1. package/dist/DataFrame.d.ts.map +1 -1
  2. package/dist/DataFrame.js +2 -1
  3. package/dist/DataFrame.js.map +1 -1
  4. package/dist/selection/ChartRenderer.d.ts.map +1 -1
  5. package/dist/selection/ChartRenderer.js +9 -11
  6. package/dist/selection/ChartRenderer.js.map +1 -1
  7. package/dist/selection/SelectionSettingsImpl.d.ts +0 -1
  8. package/dist/selection/SelectionSettingsImpl.d.ts.map +1 -1
  9. package/dist/selection/SelectionSettingsImpl.js +0 -1
  10. package/dist/selection/SelectionSettingsImpl.js.map +1 -1
  11. package/dist/selection/components/Chart/Bars/GroupSelectedBars.js +1 -1
  12. package/dist/selection/components/Chart/Bars/GroupSelectedBars.js.map +1 -1
  13. package/dist/selection/components/Chart/Bars/StackedBars.d.ts.map +1 -1
  14. package/dist/selection/components/Chart/Bars/StackedBars.js +11 -11
  15. package/dist/selection/components/Chart/Bars/StackedBars.js.map +1 -1
  16. package/dist/selection/components/Chart/ChartAxes.d.ts.map +1 -1
  17. package/dist/selection/components/Chart/ChartAxes.js +7 -8
  18. package/dist/selection/components/Chart/ChartAxes.js.map +1 -1
  19. package/dist/selection/components/Chart/ChartFrame.d.ts +1 -2
  20. package/dist/selection/components/Chart/ChartFrame.d.ts.map +1 -1
  21. package/dist/selection/components/Chart/ChartFrame.js +8 -8
  22. package/dist/selection/components/Chart/ChartFrame.js.map +1 -1
  23. package/dist/selection/components/Chart/Gridlines.d.ts +2 -6
  24. package/dist/selection/components/Chart/Gridlines.d.ts.map +1 -1
  25. package/dist/selection/components/Chart/Gridlines.js +14 -26
  26. package/dist/selection/components/Chart/Gridlines.js.map +1 -1
  27. package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js +1 -1
  28. package/dist/selection/components/Chart/Ribbons/GroupFlowRibbon.js.map +1 -1
  29. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.d.ts.map +1 -1
  30. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js +27 -27
  31. package/dist/selection/components/Chart/Ribbons/StackedGroupFlowRibbon.js.map +1 -1
  32. package/dist/selection/components/Chart/SelectionXAxis.d.ts +18 -0
  33. package/dist/selection/components/Chart/SelectionXAxis.d.ts.map +1 -0
  34. package/dist/selection/components/Chart/SelectionXAxis.js +47 -0
  35. package/dist/selection/components/Chart/SelectionXAxis.js.map +1 -0
  36. package/dist/selection/components/Chart/types.d.ts +0 -1
  37. package/dist/selection/components/Chart/types.d.ts.map +1 -1
  38. package/dist/selection/components/Chart.d.ts.map +1 -1
  39. package/dist/selection/components/Chart.js +7 -12
  40. package/dist/selection/components/Chart.js.map +1 -1
  41. package/dist/selection/components/ChartsGroup.d.ts.map +1 -1
  42. package/dist/selection/components/ChartsGroup.js +73 -72
  43. package/dist/selection/components/ChartsGroup.js.map +1 -1
  44. package/dist/selection/components/types.d.ts +0 -1
  45. package/dist/selection/components/types.d.ts.map +1 -1
  46. package/dist/selection/constants.d.ts +1 -2
  47. package/dist/selection/constants.d.ts.map +1 -1
  48. package/dist/selection/constants.js +2 -2
  49. package/dist/selection/constants.js.map +1 -1
  50. package/dist/selection/createSelectionData.d.ts +2 -6
  51. package/dist/selection/createSelectionData.d.ts.map +1 -1
  52. package/dist/selection/createSelectionData.js +45 -59
  53. package/dist/selection/createSelectionData.js.map +1 -1
  54. package/dist/types/selection.d.ts +0 -5
  55. package/dist/types/selection.d.ts.map +1 -1
  56. package/dist/types/selection.js +0 -1
  57. package/dist/types/selection.js.map +1 -1
  58. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DataFrame.d.ts","sourceRoot":"","sources":["../src/DataFrame.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGnD,MAAM,MAAM,aAAa,GA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KAAK,EAAE,QAAQ,GAAG,QAAQ;IAUjE,OAAO,CAAC,uBAAuB;IAiC/B,WAAW,CAAC,iBAAiB,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC,EAAE;IAiC3F,mBAAmB,CAAC,YAAY,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAmB3E,iBAAiB,CAAC,YAAY,EAAE,QAAQ,EAAE,GAAG,WAAW;CAiB3D"}
package/dist/DataFrame.js CHANGED
@@ -20,7 +20,8 @@ var i = new Uint32Array(), a = class a {
20
20
  e(t, "Unknown input data format");
21
21
  }
22
22
  constructor(e, t) {
23
- this.id = e, this.data = t, this.columnNames = Object.keys(t), this.rowsCount = this.columnNames.length ? t[this.columnNames[0]].length : 0, this.rowIndexes = new Uint32Array(Array.from({ length: this.rowsCount }, (e, t) => t));
23
+ this.id = e, this.data = t, this.columnNames = Object.keys(t), this.rowsCount = this.columnNames.length ? t[this.columnNames[0]].length : 0, this.rowIndexes = new Uint32Array(this.rowsCount);
24
+ for (let e = 0; e < this.rowsCount; e++) this.rowIndexes[e] = e;
24
25
  }
25
26
  getColumn(e) {
26
27
  return this.data[e];
@@ -1 +1 @@
1
- {"version":3,"file":"DataFrame.js","names":[],"sources":["../src/DataFrame.ts"],"sourcesContent":["import { groupBy } from 'lodash';\nimport type { Category, DataValue } from './types';\nimport { exhaustive } from './utils';\n\nexport type DataByColumns = {\n type: 'columns',\n values: Record<string, DataValue[]>,\n id: string,\n overflow?: boolean\n}\nexport type DataSet = DataFrame | DataByColumns;\nexport const NO_GROUPED = Symbol('noGrouped');\nexport type GroupKey = string | typeof NO_GROUPED;\nexport type RowIndex = number;\ntype RowsGroup = Record<\n GroupKey,\n {\n rowIndexes: Uint32Array;\n grouped: RowsGroup;\n }\n>;\n\nfunction isDataByColumns (data:DataSet): data is DataByColumns {\n return 'type' in data && data.type === 'columns';\n}\n\ntype ColumnName = string;\n\nconst EMPTY_INDEXES = new Uint32Array(0);\n\nexport class DataFrame {\n static toCategory = (value: DataValue): string => String(value);\n\n readonly id: string;\n // input data grouped by columns\n readonly data: Record<string, DataValue[]>;\n readonly rowsCount: number;\n readonly columnNames: ColumnName[];\n readonly rowIndexes: Uint32Array;\n\n readonly mapColumnCategories: Map<ColumnName, Category[]> = new Map();\n readonly mapColumnCategoriesRowIndexes: Map<ColumnName, Map<Category, number>> = new Map();\n\n rowsGrouped?: RowsGroup;\n\n static from (data: DataSet):DataFrame {\n if (data instanceof DataFrame) {\n return data;\n } else if (isDataByColumns(data)) {\n return new DataFrame(data.id, data.values);\n } else {\n exhaustive(data, 'Unknown input data format');\n }\n }\n\n constructor(id: string, data: Record<string, DataValue[]>) {\n this.id = id;\n this.data = data;\n this.columnNames = Object.keys(data);\n this.rowsCount = this.columnNames.length ? data[this.columnNames[0]].length : 0;\n this.rowIndexes = new Uint32Array(Array.from({length: this.rowsCount}, (_, i) => i));\n }\n\n getColumn(key: string): DataValue[] {\n return this.data[key];\n }\n\n getColumnValue(key: string, index: number): DataValue {\n return this.data[key]?.[index];\n }\n\n getColumnValueCategory(key: string, index: number): Category {\n return DataFrame.toCategory(this.getColumnValue(key, index));\n }\n\n getColumnCategories(key: string, ignoreNull = true): Category[] {\n if (!this.mapColumnCategories.has(key)) {\n this.computeColumnCategories(key);\n }\n\n const categories = this.mapColumnCategories.get(key) ?? [];\n return ignoreNull && categories && categories.length > 0 && categories[categories.length - 1] === 'null'\n ? categories.slice(0, -1) // full copy without null to heavy for large datasets\n : categories; \n }\n\n getColumnCategoryRowIndex(key: string, value: Category): RowIndex {\n const rowIndex = this.mapColumnCategoriesRowIndexes.get(key)?.get(value);\n \n if (rowIndex === undefined) {\n throw new Error(`Category ${value} not found in column ${key}`);\n }\n\n return rowIndex;\n }\n\n private computeColumnCategories(key: ColumnName) {\n if (!this.columnNames.includes(key)) {\n throw new Error(`Column ${key} does not exist`);\n }\n \n const columnData = this.getColumn(key);\n const uniqValues = new Set<DataValue>();\n const categories: string[] = [];\n const categoriesIndexes = new Map<string, number>();\n let nullIdx = -1;\n for (let i = 0; i < columnData.length; i++) {\n const value = columnData[i];\n if (uniqValues.has(value)) {\n continue;\n }\n uniqValues.add(value);\n if (value === null) {\n nullIdx = i;\n continue;\n }\n const category = DataFrame.toCategory(value);\n categories.push(category);\n categoriesIndexes.set(category, i);\n }\n if (nullIdx !== -1) {\n categories.push('null');\n categoriesIndexes.set('null', nullIdx);\n }\n\n this.mapColumnCategories.set(key, categories);\n this.mapColumnCategoriesRowIndexes.set(key, categoriesIndexes);\n }\n\n setGrouping(groupingColumnIds: (string | null)[], groupingKeys?: (GroupKey[] | undefined)[]) { \n const root = {grouped: {} as RowsGroup, rowIndexes: this.rowIndexes};\n let groups: RowsGroup[keyof RowsGroup][] = [root];\n groupingColumnIds.forEach((column, idx) => {\n const keys: GroupKey[] = column === null ? [NO_GROUPED] : (groupingKeys?.[idx] ?? this.getColumnCategories(column, false));\n const nextGroups: RowsGroup[keyof RowsGroup][] = [];\n groups.forEach(group => {\n if (column === null) {\n group.grouped = {\n [NO_GROUPED]: {\n rowIndexes: group.rowIndexes,\n grouped: {} as RowsGroup,\n },\n };\n nextGroups.push(group.grouped[NO_GROUPED]);\n } else {\n const groupedBy = groupBy(group.rowIndexes, idx => this.getColumnValueCategory(column, idx));\n group.grouped = keys.reduce((res, key) => {\n res[key] = {\n rowIndexes: new Uint32Array(groupedBy[key as string] ?? []),\n grouped: {} as RowsGroup,\n };\n nextGroups.push(res[key]);\n return res;\n }, {} as RowsGroup);\n }\n });\n groups = nextGroups;\n });\n this.rowsGrouped = root.grouped;\n }\n\n // TODO: fix all places where this method is used\n getColumnByGrouping(groupingKeys: GroupKey[], keyYColumn: string): number[] {\n if (!this.rowsGrouped) {\n return [];\n }\n if (!groupingKeys.length) {\n return Array.from(this.rowIndexes).map(idx => Number(this.getColumnValue(keyYColumn, idx)));\n }\n let result: {grouped: RowsGroup; rowIndexes: Uint32Array} = {grouped: this.rowsGrouped, rowIndexes: this.rowIndexes};\n groupingKeys.forEach(key => {\n const nextGroup = result.grouped[key ?? 'null'];\n if (!nextGroup) {\n return [];\n }\n result = nextGroup;\n });\n return Array.from(result.rowIndexes).map(idx => Number(this.getColumnValue(keyYColumn, idx)));\n }\n\n // TODO: fix all places where this method is used\n getRowsByGrouping(groupingKeys: GroupKey[]): Uint32Array {\n if (!this.rowsGrouped) {\n return EMPTY_INDEXES;\n }\n if (!groupingKeys.length) {\n return this.rowIndexes;\n }\n let result: {grouped: RowsGroup; rowIndexes: Uint32Array} = {grouped: this.rowsGrouped, rowIndexes: this.rowIndexes};\n for (const key of groupingKeys) {\n const nextGroup = result.grouped[key];\n if (!nextGroup) {\n return EMPTY_INDEXES;\n }\n result = nextGroup;\n }\n return result.rowIndexes;\n }\n}\n"],"mappings":";;AAWA,MAAa,IAAa,OAAO,YAAY;AAW7C,SAAS,EAAiB,GAAqC;AAC3D,QAAO,UAAU,KAAQ,EAAK,SAAS;;AAK3C,IAAM,IAAgB,IAAI,aAAc,EAE3B,IAAb,MAAa,EAAU;CACnB,OAAO,cAAc,MAA6B,OAAO,EAAM;CAE/D;CAEA;CACA;CACA;CACA;CAEA,sCAA4D,IAAI,KAAK;CACrE,gDAAiF,IAAI,KAAK;CAE1F;CAEA,OAAO,KAAM,GAAyB;AAClC,MAAI,aAAgB,EAChB,QAAO;MACA,EAAgB,EAAK,CAC5B,QAAO,IAAI,EAAU,EAAK,IAAI,EAAK,OAAO;AAE1C,IAAW,GAAM,4BAA4B;;CAIrD,YAAY,GAAY,GAAmC;AAKvD,EAJA,KAAK,KAAK,GACV,KAAK,OAAO,GACZ,KAAK,cAAc,OAAO,KAAK,EAAK,EACpC,KAAK,YAAY,KAAK,YAAY,SAAS,EAAK,KAAK,YAAY,IAAI,SAAS,GAC9E,KAAK,aAAa,IAAI,YAAY,MAAM,KAAK,EAAC,QAAQ,KAAK,WA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EAAO,WAAW,CAAC,KAAI,MAAO,OAAO,KAAK,eAAe,GAAY,EAAI,CAAC,CAAC;;CAIjG,kBAAkB,GAAuC;AACrD,MAAI,CAAC,KAAK,YACN,QAAO;AAEX,MAAI,CAAC,EAAa,OACd,QAAO,KAAK;EAEhB,IAAI,IAAwD;GAAC,SAAS,KAAK;GAAa,YAAY,KAAK;GAAW;AACpH,OAAK,IAAM,KAAO,GAAc;GAC5B,IAAM,IAAY,EAAO,QAAQ;AACjC,OAAI,CAAC,EACD,QAAO;AAEX,OAAS;;AAEb,SAAO,EAAO"}
1
+ {"version":3,"file":"DataFrame.js","names":[],"sources":["../src/DataFrame.ts"],"sourcesContent":["import { groupBy } from 'lodash';\nimport type { Category, DataValue } from './types';\nimport { exhaustive } from './utils';\n\nexport type DataByColumns = {\n type: 'columns',\n values: Record<string, DataValue[]>,\n id: string,\n overflow?: boolean\n}\nexport type DataSet = DataFrame | DataByColumns;\nexport const NO_GROUPED = Symbol('noGrouped');\nexport type GroupKey = string | typeof NO_GROUPED;\nexport type RowIndex = number;\ntype RowsGroup = Record<\n GroupKey,\n {\n rowIndexes: Uint32Array;\n grouped: RowsGroup;\n }\n>;\n\nfunction isDataByColumns (data:DataSet): data is DataByColumns {\n return 'type' in data && data.type === 'columns';\n}\n\ntype ColumnName = string;\n\nconst EMPTY_INDEXES = new Uint32Array(0);\n\nexport class DataFrame {\n static toCategory = (value: DataValue): string => String(value);\n\n readonly id: string;\n // input data grouped by columns\n readonly data: Record<string, DataValue[]>;\n readonly rowsCount: number;\n readonly columnNames: ColumnName[];\n readonly rowIndexes: Uint32Array;\n\n readonly mapColumnCategories: Map<ColumnName, Category[]> = new Map();\n readonly mapColumnCategoriesRowIndexes: Map<ColumnName, Map<Category, number>> = new Map();\n\n rowsGrouped?: RowsGroup;\n\n static from (data: DataSet):DataFrame {\n if (data instanceof DataFrame) {\n return data;\n } else if (isDataByColumns(data)) {\n return new DataFrame(data.id, data.values);\n } else {\n exhaustive(data, 'Unknown input data format');\n }\n }\n\n constructor(id: string, data: Record<string, DataValue[]>) {\n this.id = id;\n this.data = data;\n this.columnNames = Object.keys(data);\n this.rowsCount = this.columnNames.length ? data[this.columnNames[0]].length : 0;\n this.rowIndexes = new Uint32Array(this.rowsCount);\n for (let i = 0; i < this.rowsCount; i++) this.rowIndexes[i] = i;\n }\n\n getColumn(key: string): DataValue[] {\n return this.data[key];\n }\n\n getColumnValue(key: string, index: number): DataValue {\n return this.data[key]?.[index];\n }\n\n getColumnValueCategory(key: string, index: number): Category {\n return DataFrame.toCategory(this.getColumnValue(key, index));\n }\n\n getColumnCategories(key: string, ignoreNull = true): Category[] {\n if (!this.mapColumnCategories.has(key)) {\n this.computeColumnCategories(key);\n }\n\n const categories = this.mapColumnCategories.get(key) ?? [];\n return ignoreNull && categories && categories.length > 0 && categories[categories.length - 1] === 'null'\n ? categories.slice(0, -1) // full copy without null to heavy for large datasets\n : categories; \n }\n\n getColumnCategoryRowIndex(key: string, value: Category): RowIndex {\n const rowIndex = this.mapColumnCategoriesRowIndexes.get(key)?.get(value);\n \n if (rowIndex === undefined) {\n throw new Error(`Category ${value} not found in column ${key}`);\n }\n\n return rowIndex;\n }\n\n private computeColumnCategories(key: ColumnName) {\n if (!this.columnNames.includes(key)) {\n throw new Error(`Column ${key} does not exist`);\n }\n \n const columnData = this.getColumn(key);\n const uniqValues = new Set<DataValue>();\n const categories: string[] = [];\n const categoriesIndexes = new Map<string, number>();\n let nullIdx = -1;\n for (let i = 0; i < columnData.length; i++) {\n const value = columnData[i];\n if (uniqValues.has(value)) {\n continue;\n }\n uniqValues.add(value);\n if (value === null) {\n nullIdx = i;\n continue;\n }\n const category = DataFrame.toCategory(value);\n categories.push(category);\n categoriesIndexes.set(category, i);\n }\n if (nullIdx !== -1) {\n categories.push('null');\n categoriesIndexes.set('null', nullIdx);\n }\n\n this.mapColumnCategories.set(key, categories);\n this.mapColumnCategoriesRowIndexes.set(key, categoriesIndexes);\n }\n\n setGrouping(groupingColumnIds: (string | null)[], groupingKeys?: (GroupKey[] | undefined)[]) { \n const root = {grouped: {} as RowsGroup, rowIndexes: this.rowIndexes};\n let groups: RowsGroup[keyof RowsGroup][] = [root];\n groupingColumnIds.forEach((column, idx) => {\n const keys: GroupKey[] = column === null ? [NO_GROUPED] : (groupingKeys?.[idx] ?? this.getColumnCategories(column, false));\n const nextGroups: RowsGroup[keyof RowsGroup][] = [];\n groups.forEach(group => {\n if (column === null) {\n group.grouped = {\n [NO_GROUPED]: {\n rowIndexes: group.rowIndexes,\n grouped: {} as RowsGroup,\n },\n };\n nextGroups.push(group.grouped[NO_GROUPED]);\n } else {\n const groupedBy = groupBy(group.rowIndexes, idx => this.getColumnValueCategory(column, idx));\n group.grouped = keys.reduce((res, key) => {\n res[key] = {\n rowIndexes: new Uint32Array(groupedBy[key as string] ?? []),\n grouped: {} as RowsGroup,\n };\n nextGroups.push(res[key]);\n return res;\n }, {} as RowsGroup);\n }\n });\n groups = nextGroups;\n });\n this.rowsGrouped = root.grouped;\n }\n\n // TODO: fix all places where this method is used\n getColumnByGrouping(groupingKeys: GroupKey[], keyYColumn: string): number[] {\n if (!this.rowsGrouped) {\n return [];\n }\n if (!groupingKeys.length) {\n return Array.from(this.rowIndexes).map(idx => Number(this.getColumnValue(keyYColumn, idx)));\n }\n let result: {grouped: RowsGroup; rowIndexes: Uint32Array} = {grouped: this.rowsGrouped, rowIndexes: this.rowIndexes};\n groupingKeys.forEach(key => {\n const nextGroup = result.grouped[key ?? 'null'];\n if (!nextGroup) {\n return [];\n }\n result = nextGroup;\n });\n return Array.from(result.rowIndexes).map(idx => Number(this.getColumnValue(keyYColumn, idx)));\n }\n\n // TODO: fix all places where this method is used\n getRowsByGrouping(groupingKeys: GroupKey[]): Uint32Array {\n if (!this.rowsGrouped) {\n return EMPTY_INDEXES;\n }\n if (!groupingKeys.length) {\n return this.rowIndexes;\n }\n let result: {grouped: RowsGroup; rowIndexes: Uint32Array} = {grouped: this.rowsGrouped, rowIndexes: this.rowIndexes};\n for (const key of groupingKeys) {\n const nextGroup = result.grouped[key];\n if (!nextGroup) {\n return EMPTY_INDEXES;\n }\n result = nextGroup;\n }\n return result.rowIndexes;\n }\n}\n"],"mappings":";;AAWA,MAAa,IAAa,OAAO,YAAY;AAW7C,SAAS,EAAiB,GAAqC;AAC3D,QAAO,UAAU,KAAQ,EAAK,SAAS;;AAK3C,IAAM,IAAgB,IAAI,aAAc,EAE3B,IAAb,MAAa,EAAU;CACnB,OAAO,cAAc,MAA6B,OAAO,EAAM;CAE/D;CAEA;CACA;CACA;CACA;CAEA,sCAA4D,IAAI,KAAK;CACrE,gDAAiF,IAAI,KAAK;CAE1F;CAEA,OAAO,KAAM,GAAyB;AAClC,MAAI,aAAgB,EAChB,QAAO;MACA,EAAgB,EAAK,CAC5B,QAAO,IAAI,EAAU,EAAK,IAAI,EAAK,OAAO;AAE1C,IAAW,GAAM,4BAA4B;;CAIrD,YAAY,GAAY,GAAmC;AAKvD,EAJA,KAAK,KAAK,GACV,KAAK,OAAO,GACZ,KAAK,cAAc,OAAO,KAAK,EAAK,EACpC,KAAK,YAAY,KAAK,YAAY,SAAS,EAAK,KAAK,YAAY,IAAI,SAAS,GAC9E,KAAK,aAAa,IAAI,YAAY,KAAK,UAAU;AACjD,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,WAAW,IAAK,MAAK,WAAW,KAAK;;CAGlE,UAAU,GAA0B;AAChC,SAAO,KAAK,KAAK;;CAGrB,eAAe,GAAa,GAA0B;AAClD,SAAO,KAAK,KAAK,KAAO;;CAG5B,uBAAuB,GAAa,GAAyB;AACzD,SAAO,EAAU,WAAW,KAAK,eAAe,GAAK,EAAM,CAAC;;CAGhE,oBAAoB,GAAa,IAAa,IAAkB;AAC5D,EAAK,KAAK,oBAAoB,IAAI,EAAI,IAClC,KAAK,wBAAwB,EAAI;EAGrC,IAAM,IAAa,KAAK,oBAAoB,IAAI,EAAI,IAAI,EAAE;AAC1D,SAAO,KAAc,KAAc,EAAW,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6CrB,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,GAAG,SAAS;IAgC5E,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO;IAKjD,aAAa;IAab,MAAM,CAAC,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,EACV,OAAO,EACP,aAAa,EACb,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,SAAS,EACT,OAAO,GACR,EAAE;QACD,OAAO,EAAE,oBAAoB,CAAC;QAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAC;QACvC,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,UAAU,EAAE,CAAC;QACtB,aAAa,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC;QACtD,KAAK,EAAE,sBAAsB,CAAC;QAC9B,KAAK,EAAE,sBAAsB,CAAC;QAC9B,KAAK,EAAE,SAAS,CAAC;QACjB,aAAa,EAAE,aAAa,CAAC;QAC7B,SAAS,EAAE,kBAAkB,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;KACjB;IAyED,WAAW,CAAC,OAAO,EAAE,MAAM;CAG5B;AAED,eAAe,aAAa,CAAC"}
@@ -108,19 +108,18 @@ var f = class {
108
108
  this.solidColor = n ? i : t;
109
109
  }
110
110
  createAxisLabels(e) {
111
- let n = new t("500 14px Manrope"), i = this.orderedFaceted.facetKeys, o = i.map((e) => this.orderedFaceted.byFacet[e]?.stages.length ?? 0).reduce((e, t) => Math.max(e, t), 0), s = 0;
112
- for (let e of i) for (let t of this.orderedFaceted.byFacet[e]?.stages ?? []) s = Math.max(s, n.getTextWidth(t.label));
113
- this.maxLabelPx = s;
114
- let c = o > 0 ? this.cellPlotWidth / o : this.cellPlotWidth;
115
- this.xLabelsPosition = e.labelsPosition ?? (s > c * .65 ? "90deg" : "center");
116
- let l = this.xLabelsPosition !== "center";
111
+ let n = new t("500 14px Manrope"), i = this.orderedFaceted.facetKeys, o = 0;
112
+ for (let e of i) for (let t of this.orderedFaceted.byFacet[e]?.filterNames ?? []) o = Math.max(o, n.getTextWidth(t));
113
+ this.maxLabelPx = o, this.xLabelsPosition = e.labelsPosition ?? "45deg";
114
+ let s = this.xLabelsPosition !== "center";
117
115
  this.xLabelsByFacet = {}, this.xCountsByFacet = {}, this.maxLabelLines = 1;
118
116
  for (let e of i) {
119
- let t = this.orderedFaceted.byFacet[e]?.stages ?? [], n = {}, i = {};
120
- for (let [e, o] of t.entries()) {
121
- let t = l ? [o.label] : r(o.label, 120, 14);
122
- n[String(e)] = t, i[String(e)] = a(o.total), this.maxLabelLines = Math.max(this.maxLabelLines, t.length);
117
+ let t = this.orderedFaceted.byFacet[e], n = {}, i = {};
118
+ for (let [e, i] of (t?.filterNames ?? []).entries()) {
119
+ let t = s ? [i] : r(i, 120, 14);
120
+ n[String(e)] = t, this.maxLabelLines = Math.max(this.maxLabelLines, t.length);
123
121
  }
122
+ for (let [e, n] of (t?.stages ?? []).entries()) i[String(e)] = a(n.total);
124
123
  this.xLabelsByFacet[e] = n, this.xCountsByFacet[e] = i;
125
124
  }
126
125
  }
@@ -215,7 +214,6 @@ var f = class {
215
214
  countsByFacet: this.xCountsByFacet,
216
215
  countsFontSize: 14,
217
216
  labelsPosition: this.xLabelsPosition,
218
- showGrid: f.showGrid,
219
217
  showTicks: f.showTicks,
220
218
  hiddenLabels: f.hiddenLabels,
221
219
  title: f.title
@@ -1 +1 @@
1
- {"version":3,"file":"ChartRenderer.js","names":[],"sources":["../../src/selection/ChartRenderer.tsx"],"sourcesContent":["import { scaleOrdinal } from 'd3-scale';\nimport type { ReactElement } from 'react';\nimport type { Root } from 'react-dom/client';\nimport { createRoot } from 'react-dom/client';\n\nimport { Error } from '../common/Error';\nimport type { LegendData, LegendItem } from '../common/types';\nimport { TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport { splitTextByWidth } from '../discrete/utils';\nimport type { ColumnName, FrameType, TitlePosition } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { Margins } from './components/types';\nimport {\n AGGREGATE_RIBBON_COLOR,\n AXIS_LABEL_LINE_HEIGHT,\n COUNT_LINE_HEIGHT,\n FACET_TITLE_FONT_PX,\n FACET_TITLE_LINE,\n FACET_TITLE_LINE_HEIGHT,\n LABEL_LINE_HEIGHT_PX,\n LABEL_ROTATION_THRESHOLD,\n LABEL_WRAP_WIDTH_PX,\n MIN_MARGIN,\n MIN_PADDING,\n X_COUNT_BOTTOM_PAD,\n X_LABEL_TOP_PAD,\n Y_TICK_RESERVE,\n} from './constants';\nimport type { FacetedSelectionData } from './createSelectionData';\nimport type {\n SelectionFillColor,\n SelectionSettingsImpl,\n SelectionXAxisSettings,\n SelectionYAxisSettings,\n} from './SelectionSettingsImpl';\nimport { formatCount, formatPercent } from './utils';\n\ntype GroupingSettings = NonNullable<SelectionSettingsImpl['grouping']>;\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = <></>;\n\n // Single-cell plot dimensions (inputs to the grid layout).\n cellPlotWidth = 0;\n cellPlotHeight = 0;\n\n // Grid shape.\n nCols = 1;\n nRows = 1;\n isFaceted = false;\n cellLabelHeight = 0;\n orderedFaceted: FacetedSelectionData = { facetKeys: [], byFacet: {}, groupNames: [] };\n facetLabels: Record<string, string[]> = {};\n // Pre-wrapped per-facet title lines, sized to fit `cellPlotWidth`.\n facetTitles: Record<string, string[]> = {};\n\n // Grouping/color resolution.\n grouped = false;\n groupNames: string[] = [];\n colorMap: Map<string, string> = new Map();\n solidColor = '';\n\n // Axis labels (per-facet, multiline support) + auto-rotation decision.\n xLabelsByFacet: Record<string, Record<string, string[]>> = {};\n xCountsByFacet: Record<string, Record<string, string>> = {};\n xLabelsPosition: 'center' | '45deg' | '90deg' = 'center';\n maxLabelLines = 1;\n maxLabelPx = 0;\n\n // Caption-derived padding pieces.\n yTickWidth = 0;\n labelBlock = 0;\n xTitleHeight = 0;\n yTitleWidth = 0;\n // Tick-area reserves: full when labels are shown (room for tick mark + offset\n // + axis title clearance), shrunk to the tick-mark width alone when labels\n // are hidden so the chart can reclaim the freed space.\n yTickReserve = 0;\n xLabelTopReserve = 0;\n\n // Per-cell paddings + grid offsets.\n topPad = 0;\n rightPad = MIN_PADDING;\n fullLeftPad = 0;\n fullBottomPad = 0;\n colLeftPads: number[] = [];\n rowBottomPads: number[] = [];\n colXOffsets: number[] = [0];\n rowYOffsets: number[] = [0];\n gridWidth = 0;\n gridHeight = 0;\n\n // Outer layout.\n legend: LegendData = { width: 0, height: 0, items: [] };\n mainTitle: string[] = [];\n margins: Margins = { top: MIN_MARGIN, bottom: MIN_MARGIN, left: MIN_MARGIN, right: MIN_MARGIN };\n totalWidth = 0;\n totalHeight = 0;\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(width: number, height: number) {\n this.cellPlotWidth = width;\n this.cellPlotHeight = height;\n }\n\n updateGrid({\n faceted,\n facetLabels,\n facetBy,\n facetSettings,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n }) {\n const orderedFacetKeys = facetSettings.order?.length\n ? facetSettings.order.filter((k) => faceted.facetKeys.includes(k))\n : faceted.facetKeys;\n this.orderedFaceted = { ...faceted, facetKeys: orderedFacetKeys };\n this.facetLabels = facetLabels;\n this.isFaceted = facetBy.length > 0;\n\n if (this.isFaceted) {\n const wrapWidth = Math.max(this.cellPlotWidth, 40);\n this.facetTitles = {};\n let maxLines = 1;\n for (const fk of orderedFacetKeys) {\n const text = (facetLabels[fk] ?? []).join(' / ');\n const lines = text ? splitTextByWidth(text, wrapWidth, FACET_TITLE_FONT_PX) : [];\n this.facetTitles[fk] = lines;\n if (lines.length > maxLines) maxLines = lines.length;\n }\n this.cellLabelHeight = FACET_TITLE_LINE + (maxLines - 1) * FACET_TITLE_LINE_HEIGHT;\n } else {\n this.facetTitles = {};\n this.cellLabelHeight = 0;\n }\n\n const n = orderedFacetKeys.length;\n this.nCols = Math.min(n, facetSettings.nCols ?? Math.max(1, Math.ceil(Math.sqrt(n))));\n this.nRows = facetSettings.nRows ?? Math.max(1, Math.ceil(n / this.nCols));\n }\n\n updateGroupingMaps(grouping: GroupingSettings | undefined, fillColor: SelectionFillColor) {\n // fillColor's shape is the \"fixed vs grouping\" signal (mirrors scatterplot\n // dotFill). When a MappingLink, render grouped/stacked using\n // `grouping.inheritedAes`. When a string, render solid bars in that color.\n const isMappedFill = typeof fillColor === 'object' && fillColor !== null;\n this.grouped = isMappedFill && Boolean(grouping);\n\n const orderedGroupNames = grouping?.order\n ? grouping.order.map(String).filter((n) => this.orderedFaceted.groupNames.includes(n))\n : this.orderedFaceted.groupNames;\n this.groupNames = [\n ...orderedGroupNames,\n ...this.orderedFaceted.groupNames.filter((n) => !orderedGroupNames.includes(n)),\n ];\n\n // colorMap is only consulted on the grouped path (Chart.tsx ungrouped/\n // active-group paths use solidColor instead). Compose populates\n // grouping.inheritedAes whenever fillColor is a MappingLink; missing\n // entries fall back to the solid bar color downstream so the chart still\n // renders if a group key drops out.\n const inheritedAes = grouping?.inheritedAes;\n this.colorMap = new Map<string, string>();\n if (this.grouped && inheritedAes) {\n for (const name of this.groupNames) {\n const c = inheritedAes[name]?.fillColor;\n if (c) this.colorMap.set(name, c);\n }\n }\n\n // Concrete bar color for the ungrouped path. When fillColor is a\n // MappingLink (grouped), Chart.tsx routes the unified ribbon through\n // AGGREGATE_RIBBON_COLOR instead, so this value is only consulted as a\n // (rare) colorMap-miss fallback in the active-group branch.\n this.solidColor = isMappedFill ? AGGREGATE_RIBBON_COLOR : fillColor;\n }\n\n createAxisLabels(xAxis: SelectionXAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n const facetKeys = this.orderedFaceted.facetKeys;\n\n // Auto-rotate decision: the same `cellPlotWidth` drives every cell, so one\n // decision applies to all. Rotate when any label is >65% of its band\n // width — below that threshold a centered (possibly two-line) label still\n // fits.\n const nStages = facetKeys\n .map((fk) => this.orderedFaceted.byFacet[fk]?.stages.length ?? 0)\n .reduce((a, b) => Math.max(a, b), 0);\n let maxLabelPx = 0;\n for (const fk of facetKeys) {\n for (const stage of this.orderedFaceted.byFacet[fk]?.stages ?? []) {\n maxLabelPx = Math.max(maxLabelPx, tm.getTextWidth(stage.label));\n }\n }\n this.maxLabelPx = maxLabelPx;\n const bandWidth = nStages > 0 ? this.cellPlotWidth / nStages : this.cellPlotWidth;\n // User override (form-set rotation) wins over the auto-decision.\n this.xLabelsPosition =\n xAxis.labelsPosition ??\n (maxLabelPx > bandWidth * LABEL_ROTATION_THRESHOLD ? '90deg' : 'center');\n const rotateLabels = this.xLabelsPosition !== 'center';\n\n // Per-facet stage labels + counts. Centered → wrap to two lines at 120px;\n // rotated 90° → one line per stage.\n this.xLabelsByFacet = {};\n this.xCountsByFacet = {};\n this.maxLabelLines = 1;\n for (const fk of facetKeys) {\n const stages = this.orderedFaceted.byFacet[fk]?.stages ?? [];\n const labels: Record<string, string[]> = {};\n const counts: Record<string, string> = {};\n for (const [i, stage] of stages.entries()) {\n const lines = rotateLabels\n ? [stage.label]\n : splitTextByWidth(stage.label, LABEL_WRAP_WIDTH_PX, LABEL_LINE_HEIGHT_PX);\n labels[String(i)] = lines;\n counts[String(i)] = formatCount(stage.total);\n this.maxLabelLines = Math.max(this.maxLabelLines, lines.length);\n }\n this.xLabelsByFacet[fk] = labels;\n this.xCountsByFacet[fk] = counts;\n }\n }\n\n updateCaptionsSize(xAxis: SelectionXAxisSettings, yAxis: SelectionYAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n\n // Y axis: when labels are hidden, drop tick-label width AND most of the\n // tick reserve (room for tick mark + offset + axis-title clearance).\n // Histogram pattern: hidden → just tick-mark size, no offset.\n if (yAxis.hiddenLabels) {\n this.yTickWidth = 0;\n this.yTickReserve = yAxis.showTicks ? 4 : 0;\n } else {\n // \"100%\" is the widest formatPercent output for selection's [0, 100]\n // Y scale, regardless of d3's tick count choice.\n this.yTickWidth = tm.getTextWidth(formatPercent(100));\n this.yTickReserve = Y_TICK_RESERVE;\n }\n\n // X axis: same gating for label height block + the gap above the label.\n if (xAxis.hiddenLabels) {\n this.labelBlock = 0;\n this.xLabelTopReserve = xAxis.showTicks ? 4 : 0;\n } else {\n const rotateLabels = this.xLabelsPosition !== 'center';\n this.labelBlock = !rotateLabels\n ? this.maxLabelLines * AXIS_LABEL_LINE_HEIGHT\n : this.xLabelsPosition === '45deg'\n ? Math.ceil(this.maxLabelPx * 0.71) + 10\n : Math.ceil(this.maxLabelPx) + 10;\n this.xLabelTopReserve = X_LABEL_TOP_PAD;\n }\n\n this.xTitleHeight = xAxis.title ? AXIS_LABEL_LINE_HEIGHT + 6 : 0;\n this.yTitleWidth = yAxis.title ? AXIS_LABEL_LINE_HEIGHT + 4 : 0;\n }\n\n updateChartDimensions() {\n // Axis paddings: full = reserve space for labels/title; slim = MIN_PADDING.\n // Selection always uses edge-only axes when faceted (stages and Y range\n // are structurally identical across cells), mirroring histogram's layout.\n this.fullLeftPad = this.yTitleWidth + this.yTickWidth + this.yTickReserve;\n this.fullBottomPad = this.xLabelTopReserve + this.labelBlock + this.xTitleHeight;\n // topPad reserves only the count-label strip above each bar — vertical\n // breathing room between rows comes from `cellLabelHeight` (facet title)\n // + the previous row's `bottomPad`. Adding MIN_MARGIN here would\n // double-count that gap and the stacked padding looks too loose\n // compared to histogram/discrete.\n this.topPad = COUNT_LINE_HEIGHT + X_COUNT_BOTTOM_PAD;\n this.rightPad = MIN_PADDING;\n\n // Per-column / per-row paddings. When faceted, only col 0 reserves the\n // full Y-axis space and only the row(s) hosting bottom-edge cells reserve\n // full X-axis-label space; other cells use MIN_PADDING. Non-faceted (a\n // single cell) reserves both axes for that one cell.\n this.colLeftPads = Array.from({ length: this.nCols }, (_, c) =>\n !this.isFaceted || c === 0 ? this.fullLeftPad : MIN_PADDING,\n );\n // A row is \"bottom-edge\" if it's the last row, or it's nRows-2 in a\n // ragged grid (some columns have only nRows-1 cells, so their last cell\n // sits in row nRows-2 and needs the X-axis label space).\n const n = this.orderedFaceted.facetKeys.length;\n const isRagged = n % this.nCols !== 0;\n this.rowBottomPads = Array.from({ length: this.nRows }, (_, r) => {\n const isBottomRow = r === this.nRows - 1 || (r === this.nRows - 2 && isRagged);\n return !this.isFaceted || isBottomRow ? this.fullBottomPad : MIN_PADDING;\n });\n\n this.colXOffsets = [0];\n for (const [c, leftPad] of this.colLeftPads.entries()) {\n this.colXOffsets.push(this.colXOffsets[c] + leftPad + this.cellPlotWidth + this.rightPad);\n }\n this.rowYOffsets = [0];\n for (const [r, bottomPad] of this.rowBottomPads.entries()) {\n this.rowYOffsets.push(\n this.rowYOffsets[r] + this.topPad + this.cellLabelHeight + this.cellPlotHeight + bottomPad,\n );\n }\n this.gridWidth = this.colXOffsets[this.nCols];\n this.gridHeight = this.rowYOffsets[this.nRows];\n }\n\n updateLegendSize(showLegend: boolean, grouping: GroupingSettings | undefined) {\n if (!showLegend || !this.grouped || this.groupNames.length === 0) {\n this.legend = { width: 0, height: 0, items: [] };\n return;\n }\n const legendItems: LegendItem[] = [\n {\n id: 'selection-group',\n type: 'discreteColor',\n title: grouping?.columnName.label ?? grouping?.columnName.value ?? '',\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n values: this.groupNames,\n scale: scaleOrdinal<string, string>()\n .domain(this.groupNames)\n .range(this.groupNames.map((n) => this.colorMap.get(n) ?? '')),\n labels: Object.fromEntries(\n this.groupNames.map((n) => [\n n,\n n === 'null' ? (grouping?.columnName.nullValueLabel ?? 'N/A') : n,\n ]),\n ),\n },\n ];\n // Legend height matches the grid's plot-body strip, like discrete.\n const arranged = arrangeLegendParts(legendItems, this.cellPlotHeight);\n const maxRight = arranged.reduce((m, it) => Math.max(m, it.left + it.width), 0);\n this.legend = { width: maxRight + MIN_MARGIN, height: this.cellPlotHeight, items: arranged };\n }\n\n createMainTitle(title: string, showTitle: boolean) {\n this.mainTitle =\n showTitle && title ? splitTextByWidth(title, Math.max(this.cellPlotWidth, 40), 20) : [];\n }\n\n updateMargins() {\n const titleBlock =\n this.mainTitle.length > 0 ? this.mainTitle.length * TITLE_LINE_HEIGHT + TITLE_MARGIN * 2 : 0;\n this.margins = {\n top: Math.max(titleBlock, MIN_MARGIN),\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN + this.legend.width,\n };\n this.totalWidth = this.margins.left + this.gridWidth + this.margins.right;\n this.totalHeight = this.margins.top + this.gridHeight + this.margins.bottom;\n }\n\n render({\n faceted,\n facetLabels,\n width,\n height,\n title,\n showTitle,\n grouping,\n showLegend,\n facetBy,\n facetSettings,\n xAxis,\n yAxis,\n frame,\n titlePosition,\n fillColor,\n opacity,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n width: number;\n height: number;\n title: string;\n showTitle: boolean;\n grouping: GroupingSettings | undefined;\n showLegend: boolean;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n xAxis: SelectionXAxisSettings;\n yAxis: SelectionYAxisSettings;\n frame: FrameType;\n titlePosition: TitlePosition;\n fillColor: SelectionFillColor;\n opacity: number;\n }) {\n this.updateChartSizes(width, height);\n this.updateGrid({ faceted, facetLabels, facetBy, facetSettings });\n this.updateGroupingMaps(grouping, fillColor);\n this.createAxisLabels(xAxis);\n this.updateCaptionsSize(xAxis, yAxis);\n this.updateChartDimensions();\n this.updateLegendSize(showLegend, grouping);\n this.createMainTitle(title, showTitle);\n this.updateMargins();\n\n const component = (\n <ChartsGroup\n facetData={{\n faceted: this.orderedFaceted,\n facetLabels: this.facetLabels,\n facetTitles: this.facetTitles,\n }}\n gridLayout={{\n nRows: this.nRows,\n nCols: this.nCols,\n totalWidth: this.totalWidth,\n totalHeight: this.totalHeight,\n margins: this.margins,\n cellPlotWidth: this.cellPlotWidth,\n cellPlotHeight: this.cellPlotHeight,\n cellLabelHeight: this.cellLabelHeight,\n topPad: this.topPad,\n rightPad: this.rightPad,\n colLeftPads: this.colLeftPads,\n rowBottomPads: this.rowBottomPads,\n colXOffsets: this.colXOffsets,\n rowYOffsets: this.rowYOffsets,\n sharedX: this.isFaceted,\n sharedY: this.isFaceted,\n }}\n xAxis={{\n labelsByFacet: this.xLabelsByFacet,\n countsByFacet: this.xCountsByFacet,\n countsFontSize: 14,\n labelsPosition: this.xLabelsPosition,\n showGrid: xAxis.showGrid,\n showTicks: xAxis.showTicks,\n hiddenLabels: xAxis.hiddenLabels,\n title: xAxis.title,\n }}\n yAxis={{\n showGrid: yAxis.showGrid,\n showTicks: yAxis.showTicks,\n hiddenLabels: yAxis.hiddenLabels,\n title: yAxis.title,\n }}\n style={{\n frameType: this.isFaceted ? 'full' : frame,\n barColor: this.solidColor,\n opacity,\n colorMap: this.colorMap,\n nullValueLabel: grouping?.columnName.nullValueLabel,\n }}\n title={{\n text: this.mainTitle,\n show: this.mainTitle.length > 0,\n position: titlePosition,\n }}\n legend={this.legend}\n showFacetLabels={this.isFaceted}\n grouped={this.grouped}\n orderedGroupNames={this.groupNames}\n />\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"mappings":";;;;;;;;;;;AAyCA,IAAM,IAAN,MAAoB;CAClB,YAAyB;CACzB,aAAiC;CACjC,WAA+B;CAC/B,YAA0B,kBAAA,GAAA,EAAK,CAAA;CAG/B,gBAAgB;CAChB,iBAAiB;CAGjB,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,iBAAuC;EAAE,WAAW,EAAE;EAAE,SAAS,EAAE;EAAE,YAAY,EAAE;EAAE;CACrF,cAAwC,EAAE;CAE1C,cAAwC,EAAE;CAG1C,UAAU;CACV,aAAuB,EAAE;CACzB,2BAAgC,IAAI,KAAK;CACzC,aAAa;CAGb,iBAA2D,EAAE;CAC7D,iBAAyD,EAAE;CAC3D,kBAAgD;CAChD,gBAAgB;CAChB,aAAa;CAGb,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CAId,eAAe;CACf,mBAAmB;CAGnB,SAAS;CACT,WAAA;CACA,cAAc;CACd,gBAAgB;CAChB,cAAwB,EAAE;CAC1B,gBAA0B,EAAE;CAC5B,cAAwB,CAAC,EAAE;CAC3B,cAAwB,CAAC,EAAE;CAC3B,YAAY;CACZ,aAAa;CAGb,SAAqB;EAAE,OAAO;EAAG,QAAQ;EAAG,OAAO,EAAE;EAAE;CACvD,YAAsB,EAAE;CACxB,UAAmB;EAAE,KAAA;EAAiB,QAAA;EAAoB,MAAA;EAAkB,OAAA;EAAmB;CAC/F,aAAa;CACb,cAAc;CAEd,QAAQ;AAMN,EALI,KAAK,cAAc,KAAK,aAC1B,KAAK,WAAW,YAAY,KAAK,SAAS,EAC1C,KAAK,aAAa,MAClB,KAAK,WAAW,OAElB,iBAAiB;AAEf,GADA,KAAK,WAAW,SAAS,EACzB,KAAK,YAAY;IACjB;;CAGJ,KAAK,GAAmB;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IACb,UAAU,KAAK;IACf,aAAa,KAAK;IAClB,eAAe,KAAK;IACpB,aAAa,KAAK;IAClB,aAAa,KAAK;IAClB,SAAS,KAAK;IACd,SAAS,KAAK;IACf;GACD,OAAO;IACL,eAAe,KAAK;IACpB,eAAe,KAAK;IACpB,gBAAgB;IAChB,gBAAgB,KAAK;IACrB,UAAU,EAAM;IAChB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,UAAU,EAAM;IAChB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,WAAW,KAAK,YAAY,SAAS;IACrC,UAAU,KAAK;IACf;IACA,UAAU,KAAK;IACf,gBAAgB,GAAU,WAAW;IACtC;GACD,OAAO;IACL,MAAM,KAAK;IACX,MAAM,KAAK,UAAU,SAAS;IAC9B,UAAU;IACX;GACD,QAAQ,KAAK;GACb,iBAAiB,KAAK;GACtB,SAAS,KAAK;GACd,mBAAmB,KAAK;GACxB,CAAA;AAGJ,EADA,KAAK,YAAY,GACjB,KAAK,WAAW,OAAO,EAAU;;CAGnC,YAAY,GAAiB;AAC3B,OAAK,WAAW,OAAO,kBAAC,GAAD,EAAgB,YAAW,CAAA,CAAC"}
1
+ {"version":3,"file":"ChartRenderer.js","names":[],"sources":["../../src/selection/ChartRenderer.tsx"],"sourcesContent":["import { scaleOrdinal } from 'd3-scale';\nimport type { ReactElement } from 'react';\nimport type { Root } from 'react-dom/client';\nimport { createRoot } from 'react-dom/client';\n\nimport { Error } from '../common/Error';\nimport type { LegendData, LegendItem } from '../common/types';\nimport { TITLE_LINE_HEIGHT, TITLE_MARGIN } from '../constants';\nimport { splitTextByWidth } from '../discrete/utils';\nimport type { ColumnName, FrameType, TitlePosition } from '../types';\nimport { arrangeLegendParts } from '../utils/arrangeLegendParts';\nimport { TextMeasurer } from '../utils/TextMeasurer/TextMeasurer';\nimport { ChartsGroup } from './components/ChartsGroup';\nimport type { Margins } from './components/types';\nimport {\n AGGREGATE_RIBBON_COLOR,\n AXIS_LABEL_LINE_HEIGHT,\n COUNT_LINE_HEIGHT,\n FACET_TITLE_FONT_PX,\n FACET_TITLE_LINE,\n FACET_TITLE_LINE_HEIGHT,\n LABEL_LINE_HEIGHT_PX,\n LABEL_WRAP_WIDTH_PX,\n MIN_MARGIN,\n MIN_PADDING,\n X_COUNT_BOTTOM_PAD,\n X_LABEL_TOP_PAD,\n Y_TICK_RESERVE,\n} from './constants';\nimport type { FacetedSelectionData } from './createSelectionData';\nimport type {\n SelectionFillColor,\n SelectionSettingsImpl,\n SelectionXAxisSettings,\n SelectionYAxisSettings,\n} from './SelectionSettingsImpl';\nimport { formatCount, formatPercent } from './utils';\n\ntype GroupingSettings = NonNullable<SelectionSettingsImpl['grouping']>;\n\nclass ChartRenderer {\n reactRoot: Root | null = null;\n parentNode: HTMLElement | null = null;\n rootNode: HTMLElement | null = null;\n component: ReactElement = <></>;\n\n // Single-cell plot dimensions (inputs to the grid layout).\n cellPlotWidth = 0;\n cellPlotHeight = 0;\n\n // Grid shape.\n nCols = 1;\n nRows = 1;\n isFaceted = false;\n cellLabelHeight = 0;\n orderedFaceted: FacetedSelectionData = { facetKeys: [], byFacet: {}, groupNames: [] };\n facetLabels: Record<string, string[]> = {};\n // Pre-wrapped per-facet title lines, sized to fit `cellPlotWidth`.\n facetTitles: Record<string, string[]> = {};\n\n // Grouping/color resolution.\n grouped = false;\n groupNames: string[] = [];\n colorMap: Map<string, string> = new Map();\n solidColor = '';\n\n // Axis labels (per-facet, multiline support) + auto-rotation decision.\n xLabelsByFacet: Record<string, Record<string, string[]>> = {};\n xCountsByFacet: Record<string, Record<string, string>> = {};\n xLabelsPosition: 'center' | '45deg' | '90deg' = 'center';\n maxLabelLines = 1;\n maxLabelPx = 0;\n\n // Caption-derived padding pieces.\n yTickWidth = 0;\n labelBlock = 0;\n xTitleHeight = 0;\n yTitleWidth = 0;\n // Tick-area reserves: full when labels are shown (room for tick mark + offset\n // + axis title clearance), shrunk to the tick-mark width alone when labels\n // are hidden so the chart can reclaim the freed space.\n yTickReserve = 0;\n xLabelTopReserve = 0;\n\n // Per-cell paddings + grid offsets.\n topPad = 0;\n rightPad = MIN_PADDING;\n fullLeftPad = 0;\n fullBottomPad = 0;\n colLeftPads: number[] = [];\n rowBottomPads: number[] = [];\n colXOffsets: number[] = [0];\n rowYOffsets: number[] = [0];\n gridWidth = 0;\n gridHeight = 0;\n\n // Outer layout.\n legend: LegendData = { width: 0, height: 0, items: [] };\n mainTitle: string[] = [];\n margins: Margins = { top: MIN_MARGIN, bottom: MIN_MARGIN, left: MIN_MARGIN, right: MIN_MARGIN };\n totalWidth = 0;\n totalHeight = 0;\n\n clear() {\n if (this.parentNode && this.rootNode) {\n this.parentNode.removeChild(this.rootNode);\n this.parentNode = null;\n this.rootNode = null;\n }\n setTimeout(() => {\n this.reactRoot?.unmount();\n this.reactRoot = null;\n });\n }\n\n init(node: HTMLElement) {\n if (this.parentNode === null) {\n this.parentNode = node;\n this.rootNode = document.createElement('div');\n this.parentNode.appendChild(this.rootNode);\n this.reactRoot = createRoot(this.rootNode);\n }\n }\n\n updateChartSizes(width: number, height: number) {\n this.cellPlotWidth = width;\n this.cellPlotHeight = height;\n }\n\n updateGrid({\n faceted,\n facetLabels,\n facetBy,\n facetSettings,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n }) {\n const orderedFacetKeys = facetSettings.order?.length\n ? facetSettings.order.filter((k) => faceted.facetKeys.includes(k))\n : faceted.facetKeys;\n this.orderedFaceted = { ...faceted, facetKeys: orderedFacetKeys };\n this.facetLabels = facetLabels;\n this.isFaceted = facetBy.length > 0;\n\n if (this.isFaceted) {\n const wrapWidth = Math.max(this.cellPlotWidth, 40);\n this.facetTitles = {};\n let maxLines = 1;\n for (const fk of orderedFacetKeys) {\n const text = (facetLabels[fk] ?? []).join(' / ');\n const lines = text ? splitTextByWidth(text, wrapWidth, FACET_TITLE_FONT_PX) : [];\n this.facetTitles[fk] = lines;\n if (lines.length > maxLines) maxLines = lines.length;\n }\n this.cellLabelHeight = FACET_TITLE_LINE + (maxLines - 1) * FACET_TITLE_LINE_HEIGHT;\n } else {\n this.facetTitles = {};\n this.cellLabelHeight = 0;\n }\n\n const n = orderedFacetKeys.length;\n this.nCols = Math.min(n, facetSettings.nCols ?? Math.max(1, Math.ceil(Math.sqrt(n))));\n this.nRows = facetSettings.nRows ?? Math.max(1, Math.ceil(n / this.nCols));\n }\n\n updateGroupingMaps(grouping: GroupingSettings | undefined, fillColor: SelectionFillColor) {\n // fillColor's shape is the \"fixed vs grouping\" signal (mirrors scatterplot\n // dotFill). When a MappingLink, render grouped/stacked using\n // `grouping.inheritedAes`. When a string, render solid bars in that color.\n const isMappedFill = typeof fillColor === 'object' && fillColor !== null;\n this.grouped = isMappedFill && Boolean(grouping);\n\n const orderedGroupNames = grouping?.order\n ? grouping.order.map(String).filter((n) => this.orderedFaceted.groupNames.includes(n))\n : this.orderedFaceted.groupNames;\n this.groupNames = [\n ...orderedGroupNames,\n ...this.orderedFaceted.groupNames.filter((n) => !orderedGroupNames.includes(n)),\n ];\n\n // colorMap is only consulted on the grouped path (Chart.tsx ungrouped/\n // active-group paths use solidColor instead). Compose populates\n // grouping.inheritedAes whenever fillColor is a MappingLink; missing\n // entries fall back to the solid bar color downstream so the chart still\n // renders if a group key drops out.\n const inheritedAes = grouping?.inheritedAes;\n this.colorMap = new Map<string, string>();\n if (this.grouped && inheritedAes) {\n for (const name of this.groupNames) {\n const c = inheritedAes[name]?.fillColor;\n if (c) this.colorMap.set(name, c);\n }\n }\n\n // Concrete bar color for the ungrouped path. When fillColor is a\n // MappingLink (grouped), Chart.tsx routes the unified ribbon through\n // AGGREGATE_RIBBON_COLOR instead, so this value is only consulted as a\n // (rare) colorMap-miss fallback in the active-group branch.\n this.solidColor = isMappedFill ? AGGREGATE_RIBBON_COLOR : fillColor;\n }\n\n createAxisLabels(xAxis: SelectionXAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n const facetKeys = this.orderedFaceted.facetKeys;\n\n let maxLabelPx = 0;\n for (const fk of facetKeys) {\n for (const name of this.orderedFaceted.byFacet[fk]?.filterNames ?? []) {\n maxLabelPx = Math.max(maxLabelPx, tm.getTextWidth(name));\n }\n }\n this.maxLabelPx = maxLabelPx;\n this.xLabelsPosition = xAxis.labelsPosition ?? '45deg';\n const rotateLabels = this.xLabelsPosition !== 'center';\n\n // labels = filter name per gap (N); counts = population total per bar (N+1).\n // Centered labels wrap to two lines; rotated stay on one.\n this.xLabelsByFacet = {};\n this.xCountsByFacet = {};\n this.maxLabelLines = 1;\n for (const fk of facetKeys) {\n const facetData = this.orderedFaceted.byFacet[fk];\n const labels: Record<string, string[]> = {};\n const counts: Record<string, string> = {};\n for (const [gapIndex, name] of (facetData?.filterNames ?? []).entries()) {\n const lines = rotateLabels\n ? [name]\n : splitTextByWidth(name, LABEL_WRAP_WIDTH_PX, LABEL_LINE_HEIGHT_PX);\n labels[String(gapIndex)] = lines;\n this.maxLabelLines = Math.max(this.maxLabelLines, lines.length);\n }\n for (const [barIndex, stage] of (facetData?.stages ?? []).entries()) {\n counts[String(barIndex)] = formatCount(stage.total);\n }\n this.xLabelsByFacet[fk] = labels;\n this.xCountsByFacet[fk] = counts;\n }\n }\n\n updateCaptionsSize(xAxis: SelectionXAxisSettings, yAxis: SelectionYAxisSettings) {\n const tm = new TextMeasurer('500 14px Manrope');\n\n // Y axis: when labels are hidden, drop tick-label width AND most of the\n // tick reserve (room for tick mark + offset + axis-title clearance).\n // Histogram pattern: hidden → just tick-mark size, no offset.\n if (yAxis.hiddenLabels) {\n this.yTickWidth = 0;\n this.yTickReserve = yAxis.showTicks ? 4 : 0;\n } else {\n // \"100%\" is the widest formatPercent output for selection's [0, 100]\n // Y scale, regardless of d3's tick count choice.\n this.yTickWidth = tm.getTextWidth(formatPercent(100));\n this.yTickReserve = Y_TICK_RESERVE;\n }\n\n // X axis: same gating for label height block + the gap above the label.\n if (xAxis.hiddenLabels) {\n this.labelBlock = 0;\n this.xLabelTopReserve = xAxis.showTicks ? 4 : 0;\n } else {\n const rotateLabels = this.xLabelsPosition !== 'center';\n this.labelBlock = !rotateLabels\n ? this.maxLabelLines * AXIS_LABEL_LINE_HEIGHT\n : this.xLabelsPosition === '45deg'\n ? Math.ceil(this.maxLabelPx * 0.71) + 10\n : Math.ceil(this.maxLabelPx) + 10;\n this.xLabelTopReserve = X_LABEL_TOP_PAD;\n }\n\n this.xTitleHeight = xAxis.title ? AXIS_LABEL_LINE_HEIGHT + 6 : 0;\n this.yTitleWidth = yAxis.title ? AXIS_LABEL_LINE_HEIGHT + 4 : 0;\n }\n\n updateChartDimensions() {\n // Axis paddings: full = reserve space for labels/title; slim = MIN_PADDING.\n // Selection always uses edge-only axes when faceted (stages and Y range\n // are structurally identical across cells), mirroring histogram's layout.\n this.fullLeftPad = this.yTitleWidth + this.yTickWidth + this.yTickReserve;\n this.fullBottomPad = this.xLabelTopReserve + this.labelBlock + this.xTitleHeight;\n // topPad reserves only the count-label strip above each bar — vertical\n // breathing room between rows comes from `cellLabelHeight` (facet title)\n // + the previous row's `bottomPad`. Adding MIN_MARGIN here would\n // double-count that gap and the stacked padding looks too loose\n // compared to histogram/discrete.\n this.topPad = COUNT_LINE_HEIGHT + X_COUNT_BOTTOM_PAD;\n this.rightPad = MIN_PADDING;\n\n // Per-column / per-row paddings. When faceted, only col 0 reserves the\n // full Y-axis space and only the row(s) hosting bottom-edge cells reserve\n // full X-axis-label space; other cells use MIN_PADDING. Non-faceted (a\n // single cell) reserves both axes for that one cell.\n this.colLeftPads = Array.from({ length: this.nCols }, (_, c) =>\n !this.isFaceted || c === 0 ? this.fullLeftPad : MIN_PADDING,\n );\n // A row is \"bottom-edge\" if it's the last row, or it's nRows-2 in a\n // ragged grid (some columns have only nRows-1 cells, so their last cell\n // sits in row nRows-2 and needs the X-axis label space).\n const n = this.orderedFaceted.facetKeys.length;\n const isRagged = n % this.nCols !== 0;\n this.rowBottomPads = Array.from({ length: this.nRows }, (_, r) => {\n const isBottomRow = r === this.nRows - 1 || (r === this.nRows - 2 && isRagged);\n return !this.isFaceted || isBottomRow ? this.fullBottomPad : MIN_PADDING;\n });\n\n this.colXOffsets = [0];\n for (const [c, leftPad] of this.colLeftPads.entries()) {\n this.colXOffsets.push(this.colXOffsets[c] + leftPad + this.cellPlotWidth + this.rightPad);\n }\n this.rowYOffsets = [0];\n for (const [r, bottomPad] of this.rowBottomPads.entries()) {\n this.rowYOffsets.push(\n this.rowYOffsets[r] + this.topPad + this.cellLabelHeight + this.cellPlotHeight + bottomPad,\n );\n }\n this.gridWidth = this.colXOffsets[this.nCols];\n this.gridHeight = this.rowYOffsets[this.nRows];\n }\n\n updateLegendSize(showLegend: boolean, grouping: GroupingSettings | undefined) {\n if (!showLegend || !this.grouped || this.groupNames.length === 0) {\n this.legend = { width: 0, height: 0, items: [] };\n return;\n }\n const legendItems: LegendItem[] = [\n {\n id: 'selection-group',\n type: 'discreteColor',\n title: grouping?.columnName.label ?? grouping?.columnName.value ?? '',\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n values: this.groupNames,\n scale: scaleOrdinal<string, string>()\n .domain(this.groupNames)\n .range(this.groupNames.map((n) => this.colorMap.get(n) ?? '')),\n labels: Object.fromEntries(\n this.groupNames.map((n) => [\n n,\n n === 'null' ? (grouping?.columnName.nullValueLabel ?? 'N/A') : n,\n ]),\n ),\n },\n ];\n // Legend height matches the grid's plot-body strip, like discrete.\n const arranged = arrangeLegendParts(legendItems, this.cellPlotHeight);\n const maxRight = arranged.reduce((m, it) => Math.max(m, it.left + it.width), 0);\n this.legend = { width: maxRight + MIN_MARGIN, height: this.cellPlotHeight, items: arranged };\n }\n\n createMainTitle(title: string, showTitle: boolean) {\n this.mainTitle =\n showTitle && title ? splitTextByWidth(title, Math.max(this.cellPlotWidth, 40), 20) : [];\n }\n\n updateMargins() {\n const titleBlock =\n this.mainTitle.length > 0 ? this.mainTitle.length * TITLE_LINE_HEIGHT + TITLE_MARGIN * 2 : 0;\n this.margins = {\n top: Math.max(titleBlock, MIN_MARGIN),\n bottom: MIN_MARGIN,\n left: MIN_MARGIN,\n right: MIN_MARGIN + this.legend.width,\n };\n this.totalWidth = this.margins.left + this.gridWidth + this.margins.right;\n this.totalHeight = this.margins.top + this.gridHeight + this.margins.bottom;\n }\n\n render({\n faceted,\n facetLabels,\n width,\n height,\n title,\n showTitle,\n grouping,\n showLegend,\n facetBy,\n facetSettings,\n xAxis,\n yAxis,\n frame,\n titlePosition,\n fillColor,\n opacity,\n }: {\n faceted: FacetedSelectionData;\n facetLabels: Record<string, string[]>;\n width: number;\n height: number;\n title: string;\n showTitle: boolean;\n grouping: GroupingSettings | undefined;\n showLegend: boolean;\n facetBy: ColumnName[];\n facetSettings: SelectionSettingsImpl['facetSettings'];\n xAxis: SelectionXAxisSettings;\n yAxis: SelectionYAxisSettings;\n frame: FrameType;\n titlePosition: TitlePosition;\n fillColor: SelectionFillColor;\n opacity: number;\n }) {\n this.updateChartSizes(width, height);\n this.updateGrid({ faceted, facetLabels, facetBy, facetSettings });\n this.updateGroupingMaps(grouping, fillColor);\n this.createAxisLabels(xAxis);\n this.updateCaptionsSize(xAxis, yAxis);\n this.updateChartDimensions();\n this.updateLegendSize(showLegend, grouping);\n this.createMainTitle(title, showTitle);\n this.updateMargins();\n\n const component = (\n <ChartsGroup\n facetData={{\n faceted: this.orderedFaceted,\n facetLabels: this.facetLabels,\n facetTitles: this.facetTitles,\n }}\n gridLayout={{\n nRows: this.nRows,\n nCols: this.nCols,\n totalWidth: this.totalWidth,\n totalHeight: this.totalHeight,\n margins: this.margins,\n cellPlotWidth: this.cellPlotWidth,\n cellPlotHeight: this.cellPlotHeight,\n cellLabelHeight: this.cellLabelHeight,\n topPad: this.topPad,\n rightPad: this.rightPad,\n colLeftPads: this.colLeftPads,\n rowBottomPads: this.rowBottomPads,\n colXOffsets: this.colXOffsets,\n rowYOffsets: this.rowYOffsets,\n sharedX: this.isFaceted,\n sharedY: this.isFaceted,\n }}\n xAxis={{\n labelsByFacet: this.xLabelsByFacet,\n countsByFacet: this.xCountsByFacet,\n countsFontSize: 14,\n labelsPosition: this.xLabelsPosition,\n showTicks: xAxis.showTicks,\n hiddenLabels: xAxis.hiddenLabels,\n title: xAxis.title,\n }}\n yAxis={{\n showGrid: yAxis.showGrid,\n showTicks: yAxis.showTicks,\n hiddenLabels: yAxis.hiddenLabels,\n title: yAxis.title,\n }}\n style={{\n frameType: this.isFaceted ? 'full' : frame,\n barColor: this.solidColor,\n opacity,\n colorMap: this.colorMap,\n nullValueLabel: grouping?.columnName.nullValueLabel,\n }}\n title={{\n text: this.mainTitle,\n show: this.mainTitle.length > 0,\n position: titlePosition,\n }}\n legend={this.legend}\n showFacetLabels={this.isFaceted}\n grouped={this.grouped}\n orderedGroupNames={this.groupNames}\n />\n );\n this.component = component;\n this.reactRoot?.render(component);\n }\n\n renderError(message: string) {\n this.reactRoot?.render(<Error message={message} />);\n }\n}\n\nexport default ChartRenderer;\n"],"mappings":";;;;;;;;;;;AAwCA,IAAM,IAAN,MAAoB;CAClB,YAAyB;CACzB,aAAiC;CACjC,WAA+B;CAC/B,YAA0B,kBAAA,GAAA,EAAK,CAAA;CAG/B,gBAAgB;CAChB,iBAAiB;CAGjB,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,kBAAkB;CAClB,iBAAuC;EAAE,WAAW,EAAE;EAAE,SAAS,EAAE;EAAE,YAAY,EAAE;EAAE;CACrF,cAAwC,EAAE;CAE1C,cAAwC,EAAE;CAG1C,UAAU;CACV,aAAuB,EAAE;CACzB,2BAAgC,IAAI,KAAK;CACzC,aAAa;CAGb,iBAA2D,EAAE;CAC7D,iBAAyD,EAAE;CAC3D,kBAAgD;CAChD,gBAAgB;CAChB,aAAa;CAGb,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CAId,eAAe;CACf,m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B,GAAO,EAAM,EACrC,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GAAY,EAAS,EAC3C,KAAK,gBAAgB,GAAO,EAAU,EACtC,KAAK,eAAe;EAEpB,IAAM,IACJ,kBAAC,GAAD;GACE,WAAW;IACT,SAAS,KAAK;IACd,aAAa,KAAK;IAClB,aAAa,KAAK;IACnB;GACD,YAAY;IACV,OAAO,KAAK;IACZ,OAAO,KAAK;IACZ,YAAY,KAAK;IACjB,aAAa,KAAK;IAClB,SAAS,KAAK;IACd,eAAe,KAAK;IACpB,gBAAgB,KAAK;IACrB,iBAAiB,KAAK;IACtB,QAAQ,KAAK;IACb,UAAU,KAAK;IACf,aAAa,KAAK;IAClB,eAAe,KAAK;IACpB,aAAa,KAAK;IAClB,aAAa,KAAK;IAClB,SAAS,KAAK;IACd,SAAS,KAAK;IACf;GACD,OAAO;IACL,eAAe,KAAK;IACpB,eAAe,KAAK;IACpB,gBAAgB;IAChB,gBAAgB,KAAK;IACrB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,UAAU,EAAM;IAChB,WAAW,EAAM;IACjB,cAAc,EAAM;IACpB,OAAO,EAAM;IACd;GACD,OAAO;IACL,WAAW,KAAK,YAAY,SAAS;IACrC,UAAU,KAAK;IACf;IACA,UAAU,KAAK;IACf,gBAAgB,GAAU,WAAW;IACtC;GACD,OAAO;IACL,MAAM,KAAK;IACX,MAAM,KAAK,UAAU,SAAS;IAC9B,UAAU;IACX;GACD,QAAQ,KAAK;GACb,iBAAiB,KAAK;GACtB,SAAS,KAAK;GACd,mBAAmB,KAAK;GACxB,CAAA;AAGJ,EADA,KAAK,YAAY,GACjB,KAAK,WAAW,OAAO,EAAU;;CAGnC,YAAY,GAAiB;AAC3B,OAAK,WAAW,OAAO,kBAAC,GAAD,EAAgB,YAAW,CAAA,CAAC"}
@@ -6,7 +6,6 @@ export type SelectionFillColor = string | {
6
6
  };
7
7
  export type SelectionXAxisSettings = {
8
8
  title: string;
9
- showGrid: boolean;
10
9
  showTicks: boolean;
11
10
  hiddenLabels: boolean;
12
11
  labelsPosition: 'center' | '45deg' | '90deg' | null;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSettingsImpl.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionSettingsImpl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,eAAe;IAE5B,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAExC,QAAQ,CAAC,QAAQ,EACb;QACE,UAAU,EAAE,UAAU,CAAC;QACvB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;QACpB,YAA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,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;gBAErC,QAAQ,EAAE,iBAAiB;CA2CxC"}
@@ -27,7 +27,6 @@ var n = class {
27
27
  position: n.title.position ?? "center"
28
28
  }, this.xAxis = {
29
29
  title: n.xAxis?.title ?? "",
30
- showGrid: n.xAxis?.showGrid ?? !1,
31
30
  showTicks: n.xAxis?.showTicks ?? !0,
32
31
  hiddenLabels: n.xAxis?.hiddenLabels ?? !1,
33
32
  labelsPosition: n.xAxis?.labelsPosition ?? null
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionSettingsImpl.js","names":[],"sources":["../../src/selection/SelectionSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\n\nimport type {\n AesRecord,\n ColumnName,\n DataValue,\n FrameType,\n SettingsInterface,\n TitlePosition,\n} from '../types';\nimport { SelectionSettingsSchema } from '../types/selection';\nimport type { SelectionSettings } from '../types/selection';\n\nexport type SelectionFillColor = string | { type: string; value?: string };\n\nexport type SelectionXAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n labelsPosition: 'center' | '45deg' | '90deg' | null;\n};\n\nexport type SelectionYAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n};\n\nexport class SelectionSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'selection';\n\n readonly selectionStage: ColumnName;\n readonly weight: ColumnName | undefined;\n\n readonly grouping:\n | {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n }\n | undefined;\n readonly showLegend: boolean;\n\n readonly facetBy: ColumnName[];\n readonly facetSettings: {\n order?: string[];\n nRows?: number;\n nCols?: number;\n };\n\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly xAxis: SelectionXAxisSettings;\n readonly yAxis: SelectionYAxisSettings;\n readonly frame: FrameType;\n\n readonly fillColor: SelectionFillColor;\n readonly opacity: number;\n readonly size: { width: number; height: number };\n\n constructor(settings: SelectionSettings) {\n SelectionSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n\n this.selectionStage = settings.selectionStage;\n this.weight = settings.weight;\n this.grouping = settings.grouping;\n this.showLegend = settings.legend?.show ?? true;\n\n this.facetBy = settings.facetBy ?? [];\n this.facetSettings = {\n order: settings.facetSettings?.order,\n nRows: settings.facetSettings?.nRows,\n nCols: settings.facetSettings?.nCols,\n };\n\n this.title = {\n name: settings.title.name,\n show: settings.title.show ?? true,\n position: settings.title.position ?? 'center',\n };\n\n this.xAxis = {\n title: settings.xAxis?.title ?? '',\n showGrid: settings.xAxis?.showGrid ?? false,\n showTicks: settings.xAxis?.showTicks ?? true,\n hiddenLabels: settings.xAxis?.hiddenLabels ?? false,\n labelsPosition: settings.xAxis?.labelsPosition ?? null,\n };\n this.yAxis = {\n title: settings.yAxis?.title ?? '',\n showGrid: settings.yAxis?.showGrid ?? true,\n showTicks: settings.yAxis?.showTicks ?? true,\n hiddenLabels: settings.yAxis?.hiddenLabels ?? false,\n };\n this.frame = settings.frame?.type ?? 'left-bottom';\n this.fillColor = settings.fillColor;\n this.opacity = settings.opacity ?? 1;\n\n this.size = {\n width: settings.size?.width ?? 800,\n height: settings.size?.height ?? 500,\n };\n }\n}\n"],"mappings":";;AA8BA,IAAa,IAAb,MAAgE;CAC9D;CACA,OAAgB;CAEhB;CACA;CAEA;CAOA;CAEA;CACA;CAMA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA,YAAY,GAA6B;AAuCvC,EAtCA,EAAwB,MAAM,EAAS,EACvC,KAAK,KAAK,EAAO,SAAS,WAAW,EAErC,KAAK,iBAAiB,EAAS,gBAC/B,KAAK,SAAS,EAAS,QACvB,KAAK,WAAW,EAAS,UACzB,KAAK,aAAa,EAAS,QAAQ,QAAQ,IAE3C,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,gBAAgB;GACnB,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAChC,EAED,KAAK,QAAQ;GACX,MAAM,EAAS,MAAM;GACrB,MAAM,EAAS,MAAM,QAAQ;GAC7B,UAAU,EAAS,MAAM,YAAY;GACtC,EAED,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC9C,gBAAgB,EAAS,OAAO,kBAAkB;GACnD,EACD,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC/C,EACD,KAAK,QAAQ,EAAS,OAAO,QAAQ,eACrC,KAAK,YAAY,EAAS,WAC1B,KAAK,UAAU,EAAS,WAAW,GAEnC,KAAK,OAAO;GACV,OAAO,EAAS,MAAM,SAAS;GAC/B,QAAQ,EAAS,MAAM,UAAU;GAClC"}
1
+ {"version":3,"file":"SelectionSettingsImpl.js","names":[],"sources":["../../src/selection/SelectionSettingsImpl.ts"],"sourcesContent":["import lodash from 'lodash';\n\nimport type {\n AesRecord,\n ColumnName,\n DataValue,\n FrameType,\n SettingsInterface,\n TitlePosition,\n} from '../types';\nimport { SelectionSettingsSchema } from '../types/selection';\nimport type { SelectionSettings } from '../types/selection';\n\nexport type SelectionFillColor = string | { type: string; value?: string };\n\nexport type SelectionXAxisSettings = {\n title: string;\n showTicks: boolean;\n hiddenLabels: boolean;\n labelsPosition: 'center' | '45deg' | '90deg' | null;\n};\n\nexport type SelectionYAxisSettings = {\n title: string;\n showGrid: boolean;\n showTicks: boolean;\n hiddenLabels: boolean;\n};\n\nexport class SelectionSettingsImpl implements SettingsInterface {\n readonly id: string;\n readonly type = 'selection';\n\n readonly selectionStage: ColumnName;\n readonly weight: ColumnName | undefined;\n\n readonly grouping:\n | {\n columnName: ColumnName;\n order?: DataValue[];\n inheritedAes?: AesRecord;\n }\n | undefined;\n readonly showLegend: boolean;\n\n readonly facetBy: ColumnName[];\n readonly facetSettings: {\n order?: string[];\n nRows?: number;\n nCols?: number;\n };\n\n readonly title: { name: string; show: boolean; position: TitlePosition };\n readonly xAxis: SelectionXAxisSettings;\n readonly yAxis: SelectionYAxisSettings;\n readonly frame: FrameType;\n\n readonly fillColor: SelectionFillColor;\n readonly opacity: number;\n readonly size: { width: number; height: number };\n\n constructor(settings: SelectionSettings) {\n SelectionSettingsSchema.parse(settings);\n this.id = lodash.uniqueId('settings');\n\n this.selectionStage = settings.selectionStage;\n this.weight = settings.weight;\n this.grouping = settings.grouping;\n this.showLegend = settings.legend?.show ?? true;\n\n this.facetBy = settings.facetBy ?? [];\n this.facetSettings = {\n order: settings.facetSettings?.order,\n nRows: settings.facetSettings?.nRows,\n nCols: settings.facetSettings?.nCols,\n };\n\n this.title = {\n name: settings.title.name,\n show: settings.title.show ?? true,\n position: settings.title.position ?? 'center',\n };\n\n this.xAxis = {\n title: settings.xAxis?.title ?? '',\n showTicks: settings.xAxis?.showTicks ?? true,\n hiddenLabels: settings.xAxis?.hiddenLabels ?? false,\n labelsPosition: settings.xAxis?.labelsPosition ?? null,\n };\n this.yAxis = {\n title: settings.yAxis?.title ?? '',\n showGrid: settings.yAxis?.showGrid ?? true,\n showTicks: settings.yAxis?.showTicks ?? true,\n hiddenLabels: settings.yAxis?.hiddenLabels ?? false,\n };\n this.frame = settings.frame?.type ?? 'left-bottom';\n this.fillColor = settings.fillColor;\n this.opacity = settings.opacity ?? 1;\n\n this.size = {\n width: settings.size?.width ?? 800,\n height: settings.size?.height ?? 500,\n };\n }\n}\n"],"mappings":";;AA6BA,IAAa,IAAb,MAAgE;CAC9D;CACA,OAAgB;CAEhB;CACA;CAEA;CAOA;CAEA;CACA;CAMA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA,YAAY,GAA6B;AAsCvC,EArCA,EAAwB,MAAM,EAAS,EACvC,KAAK,KAAK,EAAO,SAAS,WAAW,EAErC,KAAK,iBAAiB,EAAS,gBAC/B,KAAK,SAAS,EAAS,QACvB,KAAK,WAAW,EAAS,UACzB,KAAK,aAAa,EAAS,QAAQ,QAAQ,IAE3C,KAAK,UAAU,EAAS,WAAW,EAAE,EACrC,KAAK,gBAAgB;GACnB,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAC/B,OAAO,EAAS,eAAe;GAChC,EAED,KAAK,QAAQ;GACX,MAAM,EAAS,MAAM;GACrB,MAAM,EAAS,MAAM,QAAQ;GAC7B,UAAU,EAAS,MAAM,YAAY;GACtC,EAED,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC9C,gBAAgB,EAAS,OAAO,kBAAkB;GACnD,EACD,KAAK,QAAQ;GACX,OAAO,EAAS,OAAO,SAAS;GAChC,UAAU,EAAS,OAAO,YAAY;GACtC,WAAW,EAAS,OAAO,aAAa;GACxC,cAAc,EAAS,OAAO,gBAAgB;GAC/C,EACD,KAAK,QAAQ,EAAS,OAAO,QAAQ,eACrC,KAAK,YAAY,EAAS,WAC1B,KAAK,UAAU,EAAS,WAAW,GAEnC,KAAK,OAAO;GACV,OAAO,EAAS,MAAM,SAAS;GAC/B,QAAQ,EAAS,MAAM,UAAU;GAClC"}
@@ -4,7 +4,7 @@ import { toPercent as t } from "../../../utils.js";
4
4
  import { memo as n } from "react";
5
5
  import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  const o = n(function({ common: n, facetActiveGroup: o, color: s, onGroupClick: c }) {
7
- let { stageIndex: l, stage: u, geometry: d, layerOpacity: f, tooltip: p } = n, { left: m, width: h, centerX: g, height: _, yScale: v } = d, y = u.groups.find((e) => e.name === o), b = y?.surviving ?? 0, x = b + (y?.discarded ?? 0);
7
+ let { stageIndex: l, stage: u, geometry: d, layerOpacity: f, tooltip: p } = n, { left: m, width: h, centerX: g, height: _, yScale: v } = d, y = u.groups.get(o), b = y?.surviving ?? 0, x = b + (y?.discarded ?? 0);
8
8
  if (x <= 0) return null;
9
9
  let S = v(t(x / u.total)), C = v(t(b / u.total)), w = C - S, T = _ - C, E = e((e, t) => {
10
10
  p.onEnter({
@@ -1 +1 @@
1
- {"version":3,"file":"GroupSelectedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/GroupSelectedBars.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIVIDER_STROKE } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Group-selected bars: only the active group is drawn, with its preserved /\n// discarded segments at actual heights and a dashed divider between them.\nexport const GroupSelectedBars = memo(function GroupSelectedBars({\n common,\n facetActiveGroup,\n color,\n onGroupClick,\n}: {\n common: BarsCommon;\n facetActiveGroup: string;\n color: string;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const groupData = stage.groups.find((g) => g.name === facetActiveGroup);\n const gSurviving = groupData?.surviving ?? 0;\n const gDiscarded = groupData?.discarded ?? 0;\n const gTotal = gSurviving + gDiscarded;\n if (gTotal <= 0) return null;\n\n const yOverlayTop = yScale(toPercent(gTotal / stage.total));\n const ySurvivingTop = yScale(toPercent(gSurviving / stage.total));\n const discardedHeight = ySurvivingTop - yOverlayTop;\n const preservedHeight = height - ySurvivingTop;\n\n const handleEnter = useFunction((section: 'preserved' | 'discarded', anchorY: number) => {\n tooltip.onEnter({\n stageIndex,\n section,\n stage,\n anchorX: centerX,\n anchorY,\n groupName: facetActiveGroup,\n });\n });\n const handleClick = useFunction(() => onGroupClick(facetActiveGroup));\n\n return (\n <>\n {discardedHeight > 0 && (\n <rect\n x={left}\n y={yOverlayTop}\n width={width}\n height={discardedHeight}\n fill={color}\n opacity={DESATURATE_ALPHA * layerOpacity}\n onMouseEnter={() => handleEnter('discarded', yOverlayTop + discardedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {preservedHeight > 0 && (\n <rect\n x={left}\n y={ySurvivingTop}\n width={width}\n height={preservedHeight}\n fill={color}\n opacity={layerOpacity}\n onMouseEnter={() => handleEnter('preserved', ySurvivingTop + preservedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {discardedHeight > 0 && preservedHeight > 0 && (\n <line\n x1={left}\n y1={ySurvivingTop}\n x2={left + width}\n y2={ySurvivingTop}\n stroke={DIVIDER_STROKE}\n strokeWidth={1}\n strokeDasharray=\"4,3\"\n />\n )}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAoB,EAAK,SAA2B,EAC/D,WACA,qBACA,UACA,mBAMC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAY,EAAM,OAAO,MAAM,MAAM,EAAE,SAAS,EAAiB,EACjE,IAAa,GAAW,aAAa,GAErC,IAAS,KADI,GAAW,aAAa;AAE3C,KAAI,KAAU,EAAG,QAAO;CAExB,IAAM,IAAc,EAAO,EAAU,IAAS,EAAM,MAAM,CAAC,EACrD,IAAgB,EAAO,EAAU,IAAa,EAAM,MAAM,CAAC,EAC3D,IAAkB,IAAgB,GAClC,IAAkB,IAAS,GAE3B,IAAc,GAAa,GAAoC,MAAoB;AACvF,IAAQ,QAAQ;GACd;GACA;GACA;GACA,SAAS;GACT;GACA,WAAW;GACZ,CAAC;GACF,EACI,IAAc,QAAkB,EAAa,EAAiB,CAAC;AAErE,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAA,KAA4B;GAC5B,oBAAoB,EAAY,aAAa,IAAc,IAAkB,EAAE;GAC/E,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAS;GACT,oBAAoB,EAAY,aAAa,IAAgB,IAAkB,EAAE;GACjF,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KAAK,IAAkB,KACxC,kBAAC,QAAD;GACE,IAAI;GACJ,IAAI;GACJ,IAAI,IAAO;GACX,IAAI;GACJ,QAAA;GACA,aAAa;GACb,iBAAgB;GAChB,CAAA;EAEH,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"GroupSelectedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/GroupSelectedBars.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIVIDER_STROKE } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Group-selected bars: only the active group is drawn, with its preserved /\n// discarded segments at actual heights and a dashed divider between them.\nexport const GroupSelectedBars = memo(function GroupSelectedBars({\n common,\n facetActiveGroup,\n color,\n onGroupClick,\n}: {\n common: BarsCommon;\n facetActiveGroup: string;\n color: string;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const groupData = stage.groups.get(facetActiveGroup);\n const gSurviving = groupData?.surviving ?? 0;\n const gDiscarded = groupData?.discarded ?? 0;\n const gTotal = gSurviving + gDiscarded;\n if (gTotal <= 0) return null;\n\n const yOverlayTop = yScale(toPercent(gTotal / stage.total));\n const ySurvivingTop = yScale(toPercent(gSurviving / stage.total));\n const discardedHeight = ySurvivingTop - yOverlayTop;\n const preservedHeight = height - ySurvivingTop;\n\n const handleEnter = useFunction((section: 'preserved' | 'discarded', anchorY: number) => {\n tooltip.onEnter({\n stageIndex,\n section,\n stage,\n anchorX: centerX,\n anchorY,\n groupName: facetActiveGroup,\n });\n });\n const handleClick = useFunction(() => onGroupClick(facetActiveGroup));\n\n return (\n <>\n {discardedHeight > 0 && (\n <rect\n x={left}\n y={yOverlayTop}\n width={width}\n height={discardedHeight}\n fill={color}\n opacity={DESATURATE_ALPHA * layerOpacity}\n onMouseEnter={() => handleEnter('discarded', yOverlayTop + discardedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {preservedHeight > 0 && (\n <rect\n x={left}\n y={ySurvivingTop}\n width={width}\n height={preservedHeight}\n fill={color}\n opacity={layerOpacity}\n onMouseEnter={() => handleEnter('preserved', ySurvivingTop + preservedHeight / 2)}\n onMouseLeave={tooltip.onLeave}\n onClick={handleClick}\n style={{ cursor: 'pointer' }}\n />\n )}\n {discardedHeight > 0 && preservedHeight > 0 && (\n <line\n x1={left}\n y1={ySurvivingTop}\n x2={left + width}\n y2={ySurvivingTop}\n stroke={DIVIDER_STROKE}\n strokeWidth={1}\n strokeDasharray=\"4,3\"\n />\n )}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAoB,EAAK,SAA2B,EAC/D,WACA,qBACA,UACA,mBAMC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAY,EAAM,OAAO,IAAI,EAAiB,EAC9C,IAAa,GAAW,aAAa,GAErC,IAAS,KADI,GAAW,aAAa;AAE3C,KAAI,KAAU,EAAG,QAAO;CAExB,IAAM,IAAc,EAAO,EAAU,IAAS,EAAM,MAAM,CAAC,EACrD,IAAgB,EAAO,EAAU,IAAa,EAAM,MAAM,CAAC,EAC3D,IAAkB,IAAgB,GAClC,IAAkB,IAAS,GAE3B,IAAc,GAAa,GAAoC,MAAoB;AACvF,IAAQ,QAAQ;GACd;GACA;GACA;GACA,SAAS;GACT;GACA,WAAW;GACZ,CAAC;GACF,EACI,IAAc,QAAkB,EAAa,EAAiB,CAAC;AAErE,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAA,KAA4B;GAC5B,oBAAoB,EAAY,aAAa,IAAc,IAAkB,EAAE;GAC/E,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KACjB,kBAAC,QAAD;GACE,GAAG;GACH,GAAG;GACI;GACP,QAAQ;GACR,MAAM;GACN,SAAS;GACT,oBAAoB,EAAY,aAAa,IAAgB,IAAkB,EAAE;GACjF,cAAc,EAAQ;GACtB,SAAS;GACT,OAAO,EAAE,QAAQ,WAAW;GAC5B,CAAA;EAEH,IAAkB,KAAK,IAAkB,KACxC,kBAAC,QAAD;GACE,IAAI;GACJ,IAAI;GACJ,IAAI,IAAO;GACX,IAAI;GACJ,QAAA;GACA,aAAa;GACb,iBAAgB;GAChB,CAAA;EAEH,EAAA,CAAA;EAEL"}
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBars.d.ts","sourceRoot":"","sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,WAAW;YASd,UAAU;gBACN,MAAM,EAAE;cACV,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;mBACd,MAAM;kBACP,MAAM,GAAG,IAAI;kBACb,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;kBAC7B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;EA+EpC,CAAC"}
1
+ {"version":3,"file":"StackedBars.d.ts","sourceRoot":"","sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,WAAW;YASd,UAAU;gBACN,MAAM,EAAE;cACV,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;mBACd,MAAM;kBACP,MAAM,GAAG,IAAI;kBACb,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;kBAC7B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;EA8EpC,CAAC"}
@@ -15,16 +15,16 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
15
15
  });
16
16
  }), T = e(() => {
17
17
  f(null), v.onLeave();
18
- }), E = e((e) => p(e)), D = new Map(h.groups.map((e) => [e.name, e])), O = h.total > 0 ? C(r(h.surviving / h.total)) : S, k = [], A = [], j = O, M = 0;
18
+ }), E = e((e) => p(e)), D = h.total > 0 ? C(r(h.surviving / h.total)) : S, O = [], k = [], A = D, j = 0;
19
19
  for (let e of c) {
20
- let r = D.get(e);
20
+ let r = h.groups.get(e);
21
21
  if (!r) continue;
22
22
  let i = r.surviving / h.total * S, a = r.discarded / h.total * S, s = d && d !== e;
23
23
  if (i > 0) {
24
- let t = j + i / 2;
25
- k.push(/* @__PURE__ */ o("rect", {
24
+ let t = A + i / 2;
25
+ O.push(/* @__PURE__ */ o("rect", {
26
26
  x: y,
27
- y: j,
27
+ y: A,
28
28
  width: b,
29
29
  height: i,
30
30
  fill: l.get(e) ?? u,
@@ -33,13 +33,13 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
33
33
  onMouseLeave: T,
34
34
  onClick: () => E(e),
35
35
  style: { cursor: "pointer" }
36
- }, `bar-p-${m}-${e}`)), j += i;
36
+ }, `bar-p-${m}-${e}`)), A += i;
37
37
  }
38
38
  if (a > 0) {
39
- let r = M + a / 2;
40
- A.push(/* @__PURE__ */ o("rect", {
39
+ let r = j + a / 2;
40
+ k.push(/* @__PURE__ */ o("rect", {
41
41
  x: y,
42
- y: M,
42
+ y: j,
43
43
  width: b,
44
44
  height: a,
45
45
  fill: l.get(e) ?? u,
@@ -48,10 +48,10 @@ const c = i(function({ common: i, stackOrder: c, colorMap: l, fallbackColor: u,
48
48
  onMouseLeave: T,
49
49
  onClick: () => E(e),
50
50
  style: { cursor: "pointer" }
51
- }, `bar-d-${m}-${e}`)), M += a;
51
+ }, `bar-d-${m}-${e}`)), j += a;
52
52
  }
53
53
  }
54
- return /* @__PURE__ */ s(a, { children: [k, A] });
54
+ return /* @__PURE__ */ s(a, { children: [O, k] });
55
55
  });
56
56
  export { c as StackedBars };
57
57
 
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"sourcesContent":["import React, { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIM_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Stacked-grouped bars: per-group rects above and below the divider, stacked\n// in caller-provided order. Hover dims non-hovered groups.\nexport const StackedBars = memo(function StackedBars({\n common,\n stackOrder,\n colorMap,\n fallbackColor,\n hoveredGroup,\n onGroupHover,\n onGroupClick,\n}: {\n common: BarsCommon;\n stackOrder: string[];\n colorMap: Map<string, string>;\n fallbackColor: string;\n hoveredGroup: string | null;\n onGroupHover: (name: string | null) => void;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const handleEnter = useFunction(\n (groupName: string, section: 'preserved' | 'discarded', anchorY: number) => {\n onGroupHover(groupName);\n tooltip.onEnter({ stageIndex, section, stage, anchorX: centerX, anchorY, groupName });\n },\n );\n const handleLeave = useFunction(() => {\n onGroupHover(null);\n tooltip.onLeave();\n });\n const handleClick = useFunction((groupName: string) => onGroupClick(groupName));\n\n const groupByName = new Map(stage.groups.map((g) => [g.name, g]));\n const dividerY = stage.total > 0 ? yScale(toPercent(stage.surviving / stage.total)) : height;\n const preserved: React.JSX.Element[] = [];\n const discarded: React.JSX.Element[] = [];\n // Both halves stack top-to-bottom in stackOrder so a given group appears at\n // the same vertical reading order in preserved and discarded — without this\n // the two halves are mirrored around the divider and the same group ends up\n // adjacent to the divider on both sides.\n let yP = dividerY;\n let yD = 0;\n for (const groupName of stackOrder) {\n const groupData = groupByName.get(groupName);\n if (!groupData) continue;\n const survivingHeight = (groupData.surviving / stage.total) * height;\n const discardedHeight = (groupData.discarded / stage.total) * height;\n const dimmed = hoveredGroup && hoveredGroup !== groupName;\n\n if (survivingHeight > 0) {\n const anchorY = yP + survivingHeight / 2;\n preserved.push(\n <rect\n key={`bar-p-${stageIndex}-${groupName}`}\n x={left}\n y={yP}\n width={width}\n height={survivingHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : 1) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'preserved', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yP += survivingHeight;\n }\n if (discardedHeight > 0) {\n const anchorY = yD + discardedHeight / 2;\n discarded.push(\n <rect\n key={`bar-d-${stageIndex}-${groupName}`}\n x={left}\n y={yD}\n width={width}\n height={discardedHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : DESATURATE_ALPHA) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'discarded', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yD += discardedHeight;\n }\n }\n return (\n <>\n {preserved}\n {discarded}\n </>\n );\n});\n"],"mappings":";;;;;AASA,MAAa,IAAc,EAAK,SAAqB,EACnD,WACA,eACA,aACA,kBACA,iBACA,iBACA,mBASC;CACD,IAAM,EAAE,eAAY,UAAO,aAAU,iBAAc,eAAY,GACzD,EAAE,SAAM,UAAO,YAAS,WAAQ,cAAW,GAE3C,IAAc,GACjB,GAAmB,GAAoC,MAAoB;AAE1E,EADA,EAAa,EAAU,EACvB,EAAQ,QAAQ;GAAE;GAAY;GAAS;GAAO,SAAS;GAAS;GAAS;GAAW,CAAC;GAExF,EACK,IAAc,QAAkB;AAEpC,EADA,EAAa,KAAK,EAClB,EAAQ,SAAS;GACjB,EACI,IAAc,GAAa,MAAsB,EAAa,EAAU,CAAC,EAEzE,IAAc,IAAI,IAAI,EAAM,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAC3D,IAAW,EAAM,QAAQ,IAAI,EAAO,EAAU,EAAM,YAAY,EAAM,MAAM,CAAC,GAAG,GAChF,IAAiC,EAAE,EACnC,IAAiC,EAAE,EAKrC,IAAK,GACL,IAAK;AACT,MAAK,IAAM,KAAa,GAAY;EAClC,IAAM,IAAY,EAAY,IAAI,EAAU;AAC5C,MAAI,CAAC,EAAW;EAChB,IAAM,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAmB,EAAU,YAAY,EAAM,QAAS,GACxD,IAAS,KAAgB,MAAiB;AAEhD,MAAI,IAAkB,GAAG;GACvB,IAAM,IAAU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IAAc,KAAK;IACtC,oBAAoB,EAAY,GAAW,aAAa,EAAQ;IAChE,cAAc;IACd,eAAe,EAAY,EAAU;IACrC,OAAO,EAAE,QAAQ,WAAW;IAC5B,EAXK,SAAS,EAAW,GAAG,IAW5B,CACH,EACD,KAAM;;AAER,MAAI,IAAkB,GAAG;GACvB,IAAM,IAAU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IAAc,KAAoB;IACrD,oBAAoB,EAAY,GAAW,aAAa,EAAQ;IAChE,cAAc;IACd,eAAe,EAAY,EAAU;IACrC,OAAO,EAAE,QAAQ,WAAW;IAC5B,EAXK,SAAS,EAAW,GAAG,IAW5B,CACH,EACD,KAAM;;;AAGV,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,EACA,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"StackedBars.js","names":[],"sources":["../../../../../src/selection/components/Chart/Bars/StackedBars.tsx"],"sourcesContent":["import React, { memo } from 'react';\n\nimport { useFunction } from '../../../../utils/hooks/useFunction';\nimport { DESATURATE_ALPHA, DIM_OPACITY } from '../../../constants';\nimport { toPercent } from '../../../utils';\nimport type { BarsCommon } from '../types';\n\n// Stacked-grouped bars: per-group rects above and below the divider, stacked\n// in caller-provided order. Hover dims non-hovered groups.\nexport const StackedBars = memo(function StackedBars({\n common,\n stackOrder,\n colorMap,\n fallbackColor,\n hoveredGroup,\n onGroupHover,\n onGroupClick,\n}: {\n common: BarsCommon;\n stackOrder: string[];\n colorMap: Map<string, string>;\n fallbackColor: string;\n hoveredGroup: string | null;\n onGroupHover: (name: string | null) => void;\n onGroupClick: (name: string) => void;\n}) {\n const { stageIndex, stage, geometry, layerOpacity, tooltip } = common;\n const { left, width, centerX, height, yScale } = geometry;\n\n const handleEnter = useFunction(\n (groupName: string, section: 'preserved' | 'discarded', anchorY: number) => {\n onGroupHover(groupName);\n tooltip.onEnter({ stageIndex, section, stage, anchorX: centerX, anchorY, groupName });\n },\n );\n const handleLeave = useFunction(() => {\n onGroupHover(null);\n tooltip.onLeave();\n });\n const handleClick = useFunction((groupName: string) => onGroupClick(groupName));\n\n const dividerY = stage.total > 0 ? yScale(toPercent(stage.surviving / stage.total)) : height;\n const preserved: React.JSX.Element[] = [];\n const discarded: React.JSX.Element[] = [];\n // Both halves stack top-to-bottom in stackOrder so a given group appears at\n // the same vertical reading order in preserved and discarded — without this\n // the two halves are mirrored around the divider and the same group ends up\n // adjacent to the divider on both sides.\n let yP = dividerY;\n let yD = 0;\n for (const groupName of stackOrder) {\n const groupData = stage.groups.get(groupName);\n if (!groupData) continue;\n const survivingHeight = (groupData.surviving / stage.total) * height;\n const discardedHeight = (groupData.discarded / stage.total) * height;\n const dimmed = hoveredGroup && hoveredGroup !== groupName;\n\n if (survivingHeight > 0) {\n const anchorY = yP + survivingHeight / 2;\n preserved.push(\n <rect\n key={`bar-p-${stageIndex}-${groupName}`}\n x={left}\n y={yP}\n width={width}\n height={survivingHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : 1) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'preserved', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yP += survivingHeight;\n }\n if (discardedHeight > 0) {\n const anchorY = yD + discardedHeight / 2;\n discarded.push(\n <rect\n key={`bar-d-${stageIndex}-${groupName}`}\n x={left}\n y={yD}\n width={width}\n height={discardedHeight}\n fill={colorMap.get(groupName) ?? fallbackColor}\n opacity={(dimmed ? DIM_OPACITY : DESATURATE_ALPHA) * layerOpacity}\n onMouseEnter={() => handleEnter(groupName, 'discarded', anchorY)}\n onMouseLeave={handleLeave}\n onClick={() => handleClick(groupName)}\n style={{ cursor: 'pointer' }}\n />,\n );\n yD += discardedHeight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AU,IAAK,IAAkB;AAgBvC,GAfA,EAAU,KACR,kBAAC,QAAD;IAEE,GAAG;IACH,GAAG;IACI;IACP,QAAQ;IACR,MAAM,EAAS,IAAI,EAAU,IAAI;IACjC,UAAU,IAAS,IAAc,KAAoB;IACrD,oBAAoB,EAAY,GAAW,aAAa,EAAQ;IAChE,cAAc;IACd,eAAe,EAAY,EAAU;IACrC,OAAO,EAAE,QAAQ,WAAW;IAC5B,EAXK,SAAS,EAAW,GAAG,IAW5B,CACH,EACD,KAAM;;;AAGV,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,EACA,EAAA,CAAA;EAEL"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChartAxes.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKlE,eAAO,MAAM,SAAS;YAKZ,UAAU;WACX,UAAU;WACV,UAAU;EAkEjB,CAAC"}
1
+ {"version":3,"file":"ChartAxes.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKlE,eAAO,MAAM,SAAS;YAKZ,UAAU;WACX,UAAU;WACV,UAAU;EAiEjB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import "../../../constants.js";
2
- import { BandAxis as e } from "../../../common/BandAxis.js";
3
- import { ContinuousAxis as t } from "../../../common/ContinuousAxis.js";
4
- import { formatPercent as n } from "../../utils.js";
2
+ import { ContinuousAxis as e } from "../../../common/ContinuousAxis.js";
3
+ import { formatPercent as t } from "../../utils.js";
4
+ import { SelectionXAxis as n } from "./SelectionXAxis.js";
5
5
  import { memo as r } from "react";
6
6
  import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  const s = r(function({ layout: r, xAxis: s, yAxis: c }) {
@@ -9,20 +9,19 @@ const s = r(function({ layout: r, xAxis: s, yAxis: c }) {
9
9
  return /* @__PURE__ */ o(i, { children: [
10
10
  h && /* @__PURE__ */ a("g", {
11
11
  transform: `translate(0,${f})`,
12
- children: /* @__PURE__ */ a(e, {
12
+ children: /* @__PURE__ */ a(n, {
13
13
  scale: l,
14
- orient: "bottom",
15
14
  labels: s.labels,
16
15
  labelsPosition: _,
17
- tickSize: v ? 4 : 0,
16
+ showTicks: v,
18
17
  hiddenLabels: y
19
18
  })
20
19
  }),
21
- g && /* @__PURE__ */ a(t, {
20
+ g && /* @__PURE__ */ a(e, {
22
21
  scale: u,
23
22
  orient: "left",
24
23
  tickSize: x ? 4 : 0,
25
- tickFormat: n,
24
+ tickFormat: t,
26
25
  hiddenLabels: S
27
26
  }),
28
27
  b && /* @__PURE__ */ a("text", {
@@ -1 +1 @@
1
- {"version":3,"file":"ChartAxes.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { BandAxis } from '../../../common/BandAxis';\nimport { ContinuousAxis } from '../../../common/ContinuousAxis';\nimport { BLACK } from '../../../constants';\nimport { formatPercent } from '../../utils';\nimport type { CellLayout, ChartXAxis, ChartYAxis } from './types';\n\n// X (band) axis at the bottom + Y (continuous, percent) axis on the left.\n// Each is gated by show flag; titles render as separate <text> nodes outside\n// the axis components for layout independence.\nexport const ChartAxes = memo(function ChartAxes({\n layout,\n xAxis,\n yAxis,\n}: {\n layout: CellLayout;\n xAxis: ChartXAxis;\n yAxis: ChartYAxis;\n}) {\n const { xScale, yScale, width, height, paddingLeft, paddingBottom, showXAxis, showYAxis } =\n layout;\n const {\n labelsPosition: xLabelsPosition = 'center',\n showTicks: xShowTicks = true,\n hiddenLabels: xHiddenLabels = false,\n title: xAxisTitle = '',\n } = xAxis;\n const {\n showTicks: yShowTicks = true,\n hiddenLabels: yHiddenLabels = false,\n title: yAxisTitle = '',\n } = yAxis;\n\n return (\n <>\n {showXAxis && (\n <g transform={`translate(0,${height})`}>\n <BandAxis\n scale={xScale}\n orient=\"bottom\"\n labels={xAxis.labels}\n labelsPosition={xLabelsPosition}\n tickSize={xShowTicks ? 4 : 0}\n hiddenLabels={xHiddenLabels}\n />\n </g>\n )}\n {showYAxis && (\n <ContinuousAxis\n scale={yScale}\n orient=\"left\"\n tickSize={yShowTicks ? 4 : 0}\n tickFormat={formatPercent}\n hiddenLabels={yHiddenLabels}\n />\n )}\n {xAxisTitle && (\n <text\n x={width / 2}\n y={height + paddingBottom - 6}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {xAxisTitle}\n </text>\n )}\n {yAxisTitle && (\n <text\n transform={`translate(${-paddingLeft + 14},${height / 2}) rotate(-90)`}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {yAxisTitle}\n </text>\n )}\n </>\n );\n});\n"],"mappings":";;;;;;AAWA,MAAa,IAAY,EAAK,SAAmB,EAC/C,WACA,UACA,YAKC;CACD,IAAM,EAAE,WAAQ,WAAQ,UAAO,WAAQ,gBAAa,kBAAe,cAAW,iBAC5E,GACI,EACJ,gBAAgB,IAAkB,UAClC,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB,GACE,EACJ,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB;AAEJ,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,KACC,kBAAC,KAAD;GAAG,WAAW,eAAe,EAAO;aAClC,kBAAC,GAAD;IACE,OAAO;IACP,QAAO;IACP,QAAQ,EAAM;IACd,gBAAgB;IAChB,UAAU,IAAa,IAAI;IAC3B,cAAc;IACd,CAAA;GACA,CAAA;EAEL,KACC,kBAAC,GAAD;GACE,OAAO;GACP,QAAO;GACP,UAAU,IAAa,IAAI;GAC3B,YAAY;GACZ,cAAc;GACd,CAAA;EAEH,KACC,kBAAC,QAAD;GACE,GAAG,IAAQ;GACX,GAAG,IAAS,IAAgB;GAC5B,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,KACC,kBAAC,QAAD;GACE,WAAW,aAAa,CAAC,IAAc,GAAG,GAAG,IAAS,EAAE;GACxD,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,EAAA,CAAA;EAEL"}
1
+ {"version":3,"file":"ChartAxes.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartAxes.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { ContinuousAxis } from '../../../common/ContinuousAxis';\nimport { SelectionXAxis } from './SelectionXAxis';\nimport { BLACK } from '../../../constants';\nimport { formatPercent } from '../../utils';\nimport type { CellLayout, ChartXAxis, ChartYAxis } from './types';\n\n// X (band) axis at the bottom + Y (continuous, percent) axis on the left.\n// Each is gated by show flag; titles render as separate <text> nodes outside\n// the axis components for layout independence.\nexport const ChartAxes = memo(function ChartAxes({\n layout,\n xAxis,\n yAxis,\n}: {\n layout: CellLayout;\n xAxis: ChartXAxis;\n yAxis: ChartYAxis;\n}) {\n const { xScale, yScale, width, height, paddingLeft, paddingBottom, showXAxis, showYAxis } =\n layout;\n const {\n labelsPosition: xLabelsPosition = 'center',\n showTicks: xShowTicks = true,\n hiddenLabels: xHiddenLabels = false,\n title: xAxisTitle = '',\n } = xAxis;\n const {\n showTicks: yShowTicks = true,\n hiddenLabels: yHiddenLabels = false,\n title: yAxisTitle = '',\n } = yAxis;\n\n return (\n <>\n {showXAxis && (\n <g transform={`translate(0,${height})`}>\n <SelectionXAxis\n scale={xScale}\n labels={xAxis.labels}\n labelsPosition={xLabelsPosition}\n showTicks={xShowTicks}\n hiddenLabels={xHiddenLabels}\n />\n </g>\n )}\n {showYAxis && (\n <ContinuousAxis\n scale={yScale}\n orient=\"left\"\n tickSize={yShowTicks ? 4 : 0}\n tickFormat={formatPercent}\n hiddenLabels={yHiddenLabels}\n />\n )}\n {xAxisTitle && (\n <text\n x={width / 2}\n y={height + paddingBottom - 6}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {xAxisTitle}\n </text>\n )}\n {yAxisTitle && (\n <text\n transform={`translate(${-paddingLeft + 14},${height / 2}) rotate(-90)`}\n textAnchor=\"middle\"\n fontSize=\"14px\"\n fontWeight=\"500\"\n fontFamily=\"Manrope\"\n fill={BLACK}\n >\n {yAxisTitle}\n </text>\n )}\n </>\n );\n});\n"],"mappings":";;;;;;AAWA,MAAa,IAAY,EAAK,SAAmB,EAC/C,WACA,UACA,YAKC;CACD,IAAM,EAAE,WAAQ,WAAQ,UAAO,WAAQ,gBAAa,kBAAe,cAAW,iBAC5E,GACI,EACJ,gBAAgB,IAAkB,UAClC,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB,GACE,EACJ,WAAW,IAAa,IACxB,cAAc,IAAgB,IAC9B,OAAO,IAAa,OAClB;AAEJ,QACE,kBAAA,GAAA,EAAA,UAAA;EACG,KACC,kBAAC,KAAD;GAAG,WAAW,eAAe,EAAO;aAClC,kBAAC,GAAD;IACE,OAAO;IACP,QAAQ,EAAM;IACd,gBAAgB;IAChB,WAAW;IACX,cAAc;IACd,CAAA;GACA,CAAA;EAEL,KACC,kBAAC,GAAD;GACE,OAAO;GACP,QAAO;GACP,UAAU,IAAa,IAAI;GAC3B,YAAY;GACZ,cAAc;GACd,CAAA;EAEH,KACC,kBAAC,QAAD;GACE,GAAG,IAAQ;GACX,GAAG,IAAS,IAAgB;GAC5B,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,KACC,kBAAC,QAAD;GACE,WAAW,aAAa,CAAC,IAAc,GAAG,GAAG,IAAS,EAAE;GACxD,YAAW;GACX,UAAS;GACT,YAAW;GACX,YAAW;GACX,MAAA;aAEC;GACI,CAAA;EAER,EAAA,CAAA;EAEL"}
@@ -3,7 +3,6 @@ export declare const ChartFrame: import('react').NamedExoticComponent<{
3
3
  width: number;
4
4
  height: number;
5
5
  frameType: FrameType;
6
- xShowGrid: boolean;
7
- yShowGrid: boolean;
6
+ showGrid: boolean;
8
7
  }>;
9
8
  //# sourceMappingURL=ChartFrame.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKhD,eAAO,MAAM,UAAU;WAOd,MAAM;YACL,MAAM;eACH,SAAS;eACT,OAAO;eACP,OAAO;EAqClB,CAAC"}
1
+ {"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMhD,eAAO,MAAM,UAAU;WAMd,MAAM;YACL,MAAM;eACH,SAAS;cACV,OAAO;EAmBjB,CAAC"}
@@ -1,32 +1,32 @@
1
1
  import "../../../constants.js";
2
2
  import { memo as e } from "react";
3
3
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- const r = e(function({ width: e, height: r, frameType: i, xShowGrid: a, yShowGrid: o }) {
4
+ const r = e(function({ width: e, height: r, frameType: i, showGrid: a }) {
5
5
  return i === "empty" ? null : /* @__PURE__ */ n("g", {
6
6
  strokeWidth: 1,
7
7
  children: [
8
- (a || i !== "left") && /* @__PURE__ */ t("line", {
9
- stroke: i === "left" ? "#E1E3EB" : "#110529",
8
+ i !== "left" && /* @__PURE__ */ t("line", {
9
+ stroke: "#110529",
10
10
  x1: "0",
11
11
  x2: e,
12
12
  y1: r,
13
13
  y2: r
14
14
  }),
15
- (a || i !== "bottom") && /* @__PURE__ */ t("line", {
16
- stroke: i === "bottom" ? "#E1E3EB" : "#110529",
15
+ i !== "bottom" && /* @__PURE__ */ t("line", {
16
+ stroke: "#110529",
17
17
  x1: "0",
18
18
  x2: "0",
19
19
  y1: "0",
20
20
  y2: r
21
21
  }),
22
- (a || i === "full") && /* @__PURE__ */ t("line", {
23
- stroke: i === "full" ? "#110529" : "#E1E3EB",
22
+ i === "full" && /* @__PURE__ */ t("line", {
23
+ stroke: "#110529",
24
24
  x1: e,
25
25
  x2: e,
26
26
  y1: "0",
27
27
  y2: r
28
28
  }),
29
- (o || i === "full") && /* @__PURE__ */ t("line", {
29
+ (a || i === "full") && /* @__PURE__ */ t("line", {
30
30
  stroke: i === "full" ? "#110529" : "#E1E3EB",
31
31
  x1: "0",
32
32
  x2: e,
@@ -1 +1 @@
1
- {"version":3,"file":"ChartFrame.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { BLACK, GRID_GRAY } from '../../../constants';\nimport type { FrameType } from '../../../types';\n\n// Border lines around the plot body. `frameType` picks which sides are BLACK\n// (drawn as the prominent axis line) vs GRID_GRAY (drawn for visual closure\n// only when the corresponding gridline is on or `frameType === 'full'`).\nexport const ChartFrame = memo(function ChartFrame({\n width,\n height,\n frameType,\n xShowGrid,\n yShowGrid,\n}: {\n width: number;\n height: number;\n frameType: FrameType;\n xShowGrid: boolean;\n yShowGrid: boolean;\n}) {\n if (frameType === 'empty') return null;\n return (\n <g strokeWidth={1}>\n {(xShowGrid || frameType !== 'left') && (\n <line\n stroke={frameType === 'left' ? GRID_GRAY : BLACK}\n x1=\"0\"\n x2={width}\n y1={height}\n y2={height}\n />\n )}\n {(xShowGrid || frameType !== 'bottom') && (\n <line\n stroke={frameType === 'bottom' ? GRID_GRAY : BLACK}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2={height}\n />\n )}\n {(xShowGrid || frameType === 'full') && (\n <line\n stroke={frameType === 'full' ? BLACK : GRID_GRAY}\n x1={width}\n x2={width}\n y1=\"0\"\n y2={height}\n />\n )}\n {(yShowGrid || frameType === 'full') && (\n <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />\n )}\n </g>\n );\n});\n"],"mappings":";;;AAQA,MAAa,IAAa,EAAK,SAAoB,EACjD,UACA,WACA,cACA,cACA,gBAOC;AAED,QADI,MAAc,UAAgB,OAEhC,kBAAC,KAAD;EAAG,aAAa;YAAhB;IACI,KAAa,MAAc,WAC3B,kBAAC,QAAD;IACE,QAAQ,MAAc,SAAA,YAAA;IACtB,IAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,CAAA;IAEF,KAAa,MAAc,aAC3B,kBAAC,QAAD;IACE,QAAQ,MAAc,WAAA,YAAA;IACtB,IAAG;IACH,IAAG;IACH,IAAG;IACH,IAAI;IACJ,CAAA;IAEF,KAAa,MAAc,WAC3B,kBAAC,QAAD;IACE,QAAQ,MAAc,SAAA,YAAA;IACtB,IAAI;IACJ,IAAI;IACJ,IAAG;IACH,IAAI;IACJ,CAAA;IAEF,KAAa,MAAc,WAC3B,kBAAC,QAAD;IAAM,QAAQ,MAAc,SAAA,YAAA;IAA4B,IAAG;IAAI,IAAI;IAAO,IAAG;IAAI,IAAG;IAAM,CAAA;GAE1F;;EAEN"}
1
+ {"version":3,"file":"ChartFrame.js","names":[],"sources":["../../../../src/selection/components/Chart/ChartFrame.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { BLACK, GRID_GRAY } from '../../../constants';\nimport type { FrameType } from '../../../types';\n\n// Border lines around the plot body. `frameType` picks which sides are BLACK\n// (drawn as the prominent axis line) vs GRID_GRAY (drawn for visual closure\n// only when `frameType === 'full'`). The Selection Plot has no X gridlines, so\n// the vertical/right borders depend on `frameType` alone.\nexport const ChartFrame = memo(function ChartFrame({\n width,\n height,\n frameType,\n showGrid,\n}: {\n width: number;\n height: number;\n frameType: FrameType;\n showGrid: boolean;\n}) {\n if (frameType === 'empty') return null;\n return (\n <g strokeWidth={1}>\n {frameType !== 'left' && (\n <line stroke={BLACK} x1=\"0\" x2={width} y1={height} y2={height} />\n )}\n {frameType !== 'bottom' && (\n <line stroke={BLACK} x1=\"0\" x2=\"0\" y1=\"0\" y2={height} />\n )}\n {frameType === 'full' && (\n <line stroke={BLACK} x1={width} x2={width} y1=\"0\" y2={height} />\n )}\n {(showGrid || frameType === 'full') && (\n <line stroke={frameType === 'full' ? BLACK : GRID_GRAY} x1=\"0\" x2={width} y1=\"0\" y2=\"0\" />\n )}\n </g>\n );\n});\n"],"mappings":";;;AASA,MAAa,IAAa,EAAK,SAAoB,EACjD,UACA,WACA,cACA,eAMC;AAED,QADI,MAAc,UAAgB,OAEhC,kBAAC,KAAD;EAAG,aAAa;YAAhB;GACG,MAAc,UACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAG;IAAI,IAAI;IAAO,IAAI;IAAQ,IAAI;IAAU,CAAA;GAElE,MAAc,YACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAG;IAAI,IAAG;IAAI,IAAG;IAAI,IAAI;IAAU,CAAA;GAEzD,MAAc,UACb,kBAAC,QAAD;IAAM,QAAA;IAAe,IAAI;IAAO,IAAI;IAAO,IAAG;IAAI,IAAI;IAAU,CAAA;IAEhE,KAAY,MAAc,WAC1B,kBAAC,QAAD;IAAM,QAAQ,MAAc,SAAA,YAAA;IAA4B,IAAG;IAAI,IAAI;IAAO,IAAG;IAAI,IAAG;IAAM,CAAA;GAE1F;;EAEN"}
@@ -1,10 +1,6 @@
1
- import { ScaleBand, ScaleLinear } from 'd3-scale';
1
+ import { ScaleLinear } from 'd3-scale';
2
2
  export declare const Gridlines: import('react').NamedExoticComponent<{
3
- xScale: ScaleBand<string>;
4
- yScale: ScaleLinear<number, number>;
3
+ scale: ScaleLinear<number, number>;
5
4
  width: number;
6
- height: number;
7
- xShow: boolean;
8
- yShow: boolean;
9
5
  }>;
10
6
  //# sourceMappingURL=Gridlines.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Gridlines.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMvD,eAAO,MAAM,SAAS;YAQZ,SAAS,CAAC,MAAM,CAAC;YACjB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;WAC5B,MAAM;YACL,MAAM;WACP,OAAO;WACP,OAAO;EA0Bd,CAAC"}
1
+ {"version":3,"file":"Gridlines.d.ts","sourceRoot":"","sources":["../../../../src/selection/components/Chart/Gridlines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM5C,eAAO,MAAM,SAAS;WAIb,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;WAC3B,MAAM;EAUb,CAAC"}