@czi-sds/data-viz 0.13.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes } from "react";
3
3
  import { DatasetComponentOption, ECharts, EChartsOption, ScatterSeriesOption } from "echarts";
4
+ import { DiscreteColorGeneratorOptions, TooltipTableContentProps } from "@czi-sds/components";
4
5
  interface CreateChartOptionsProps {
5
6
  /**
6
7
  * Display reference line and axis value under mouse pointer
@@ -150,4 +151,116 @@ interface HeatmapChartProps extends HTMLAttributes<HTMLDivElement>, CreateChartO
150
151
  echartsRendererMode?: "svg" | "canvas";
151
152
  }
152
153
  declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<HeatmapChartProps & import("react").RefAttributes<HTMLDivElement>>>;
153
- export { HeatmapChartProps, _default, _default as HeatmapChart };
154
+ interface StackedBarChartDataItem {
155
+ /**
156
+ * Display name for the segment
157
+ */
158
+ name: string;
159
+ /**
160
+ * Numeric value for the segment
161
+ */
162
+ value: number;
163
+ /**
164
+ * Color for the segment (hex or CSS color)
165
+ * If not provided, colors will be automatically generated using cubehelix palette
166
+ */
167
+ color?: string;
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"
171
+ */
172
+ unit?: string;
173
+ /**
174
+ * Disable the item (prevents all events on the corresponding legend item and bar segment)
175
+ * @default false
176
+ */
177
+ disabled?: boolean;
178
+ tooltip: TooltipTableContentProps;
179
+ }
180
+ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
181
+ /**
182
+ * Title to display above the chart
183
+ */
184
+ title?: string;
185
+ /**
186
+ * Badge text to display next to the title
187
+ * If not provided, defaults to showing item count based on selection:
188
+ * - No selection: total count (e.g., "5")
189
+ * - Partial selection: selected count (e.g., "3 of 5")
190
+ * - All selected: "All"
191
+ */
192
+ badge?: string;
193
+ /**
194
+ * Hide the badge when true
195
+ * @default false
196
+ */
197
+ hideBadge?: boolean;
198
+ /**
199
+ * Array of data items to display in the stacked bar
200
+ */
201
+ data: StackedBarChartDataItem[];
202
+ /**
203
+ * Width of the chart - accepts any CSS width value (e.g., "100%", "20vw", "300px", or number for pixels)
204
+ * @default 100%
205
+ */
206
+ width?: number | string;
207
+ /**
208
+ * Height of the bar in pixels
209
+ * @default 16
210
+ */
211
+ barHeight?: number;
212
+ /**
213
+ * Whether to show the legend below the chart
214
+ * @default true
215
+ */
216
+ showLegend?: boolean;
217
+ /**
218
+ * Whether to show percentage values in the legend
219
+ * @default true
220
+ */
221
+ showLegendValues?: boolean;
222
+ /**
223
+ * Array of selected item indices (controlled component)
224
+ */
225
+ selectedIndices?: number[];
226
+ /**
227
+ * Callback when legend selection changes
228
+ */
229
+ onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
230
+ /**
231
+ * 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"
235
+ */
236
+ mode?: "percentage" | "amount";
237
+ /**
238
+ * Maximum amount for the bar (used only in "amount" mode)
239
+ * If not provided, defaults to sum of all values (no remaining segment)
240
+ * If provided and sum < maxAmount, shows gray "remaining" segment
241
+ */
242
+ maxAmount?: number;
243
+ /**
244
+ * Label for the remaining/unknown segment in amount mode
245
+ * @default "Remaining"
246
+ */
247
+ remainingLabel?: string;
248
+ /**
249
+ * Unit to display with the remaining segment value in amount mode
250
+ * If not provided, uses the unit from the first data item (if available)
251
+ */
252
+ remainingUnit?: string;
253
+ /**
254
+ * Global unit to display with values in amount mode (e.g., "GB", "datasets", "K")
255
+ * Individual data items can override this with their own unit property
256
+ * Only shown when mode is "amount"
257
+ */
258
+ unit?: string;
259
+ /**
260
+ * Options for the color generator
261
+ */
262
+ colorGeneratorOptions?: DiscreteColorGeneratorOptions;
263
+ }
264
+ declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
265
+ export { HeatmapChartProps, _default, _default as HeatmapChart, StackedBarChart };
266
+ export type { StackedBarChartProps, StackedBarChartDataItem };