@czi-sds/data-viz 0.14.0 → 0.14.1

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.
@@ -166,8 +166,8 @@ interface StackedBarChartDataItem {
166
166
  */
167
167
  color?: string;
168
168
  /**
169
- * Unit label to display with the value in amount mode (e.g., "GB", "datasets", "MB")
170
- * Only shown in legend when mode is "amount"
169
+ * Unit label to display with the value in cumulative mode (e.g., "GB", "datasets", "MB")
170
+ * Only shown in legend when mode is "cumulative"
171
171
  */
172
172
  unit?: string;
173
173
  /**
@@ -175,7 +175,10 @@ interface StackedBarChartDataItem {
175
175
  * @default false
176
176
  */
177
177
  disabled?: boolean;
178
- tooltip: TooltipTableContentProps;
178
+ /**
179
+ * Optional tooltip to display when hovering over the segment
180
+ */
181
+ tooltip?: TooltipTableContentProps;
179
182
  }
180
183
  interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
181
184
  /**
@@ -205,7 +208,7 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
205
208
  */
206
209
  width?: number | string;
207
210
  /**
208
- * Height of the bar in pixels
211
+ * Height of the bar in pixels (minimum 1px)
209
212
  * @default 16
210
213
  */
211
214
  barHeight?: number;
@@ -219,6 +222,13 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
219
222
  * @default true
220
223
  */
221
224
  showLegendValues?: boolean;
225
+ /**
226
+ * Format for legend values
227
+ * - "percentage": Shows percentage of the item in the bar chart (e.g., "20%")
228
+ * - "count": Shows the count from the data object with the unit defined by the unit prop
229
+ * @default "percentage"
230
+ */
231
+ legendValueFormat?: "percentage" | "count";
222
232
  /**
223
233
  * Array of selected item indices (controlled component)
224
234
  */
@@ -227,33 +237,40 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
227
237
  * Callback when legend selection changes
228
238
  */
229
239
  onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
240
+ /**
241
+ * Behavior to apply when items are selected
242
+ * - "dim": Non-selected segments become semi-transparent (20% opacity)
243
+ * - "hide": Non-selected segments are hidden from the bar chart
244
+ * @default "dim"
245
+ */
246
+ selectionBehavior?: "dim" | "hide";
230
247
  /**
231
248
  * Chart mode - controls how segments are calculated
232
- * - "percentage": Segments fill entire bar (100%), proportional to their values
233
- * - "amount": Segments sized based on actual values relative to maxAmount
234
- * @default "percentage"
249
+ * - "porportional": Segments fill entire bar (100%), proportional to their values
250
+ * - "cumulative": Segments sized based on actual values relative to maxAmount
251
+ * @default "porportional"
235
252
  */
236
- mode?: "percentage" | "amount";
253
+ mode?: "porportional" | "cumulative";
237
254
  /**
238
- * Maximum amount for the bar (used only in "amount" mode)
255
+ * Maximum amount for the bar (used only in "cumulative" mode)
239
256
  * If not provided, defaults to sum of all values (no remaining segment)
240
257
  * If provided and sum < maxAmount, shows gray "remaining" segment
241
258
  */
242
259
  maxAmount?: number;
243
260
  /**
244
- * Label for the remaining/unknown segment in amount mode
261
+ * Label for the remaining/unknown segment in cumulative mode
245
262
  * @default "Remaining"
246
263
  */
247
264
  remainingLabel?: string;
248
265
  /**
249
- * Unit to display with the remaining segment value in amount mode
266
+ * Unit to display with the remaining segment value in cumulative mode
250
267
  * If not provided, uses the unit from the first data item (if available)
251
268
  */
252
269
  remainingUnit?: string;
253
270
  /**
254
- * Global unit to display with values in amount mode (e.g., "GB", "datasets", "K")
271
+ * Global unit to display with values in cumulative mode (e.g., "GB", "datasets", "K")
255
272
  * Individual data items can override this with their own unit property
256
- * Only shown when mode is "amount"
273
+ * Only shown when mode is "cumulative"
257
274
  */
258
275
  unit?: string;
259
276
  /**