@czi-sds/data-viz 0.13.1 → 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.
- package/dist/index.cjs.d.ts +131 -1
- package/dist/index.cjs.js +24837 -29
- package/dist/index.esm.d.ts +131 -1
- package/dist/index.esm.js +24807 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -4
package/dist/index.cjs.d.ts
CHANGED
|
@@ -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,133 @@ 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
|
-
|
|
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 cumulative mode (e.g., "GB", "datasets", "MB")
|
|
170
|
+
* Only shown in legend when mode is "cumulative"
|
|
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
|
+
/**
|
|
179
|
+
* Optional tooltip to display when hovering over the segment
|
|
180
|
+
*/
|
|
181
|
+
tooltip?: TooltipTableContentProps;
|
|
182
|
+
}
|
|
183
|
+
interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
184
|
+
/**
|
|
185
|
+
* Title to display above the chart
|
|
186
|
+
*/
|
|
187
|
+
title?: string;
|
|
188
|
+
/**
|
|
189
|
+
* Badge text to display next to the title
|
|
190
|
+
* If not provided, defaults to showing item count based on selection:
|
|
191
|
+
* - No selection: total count (e.g., "5")
|
|
192
|
+
* - Partial selection: selected count (e.g., "3 of 5")
|
|
193
|
+
* - All selected: "All"
|
|
194
|
+
*/
|
|
195
|
+
badge?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Hide the badge when true
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
hideBadge?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Array of data items to display in the stacked bar
|
|
203
|
+
*/
|
|
204
|
+
data: StackedBarChartDataItem[];
|
|
205
|
+
/**
|
|
206
|
+
* Width of the chart - accepts any CSS width value (e.g., "100%", "20vw", "300px", or number for pixels)
|
|
207
|
+
* @default 100%
|
|
208
|
+
*/
|
|
209
|
+
width?: number | string;
|
|
210
|
+
/**
|
|
211
|
+
* Height of the bar in pixels (minimum 1px)
|
|
212
|
+
* @default 16
|
|
213
|
+
*/
|
|
214
|
+
barHeight?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Whether to show the legend below the chart
|
|
217
|
+
* @default true
|
|
218
|
+
*/
|
|
219
|
+
showLegend?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Whether to show percentage values in the legend
|
|
222
|
+
* @default true
|
|
223
|
+
*/
|
|
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";
|
|
232
|
+
/**
|
|
233
|
+
* Array of selected item indices (controlled component)
|
|
234
|
+
*/
|
|
235
|
+
selectedIndices?: number[];
|
|
236
|
+
/**
|
|
237
|
+
* Callback when legend selection changes
|
|
238
|
+
*/
|
|
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";
|
|
247
|
+
/**
|
|
248
|
+
* Chart mode - controls how segments are calculated
|
|
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"
|
|
252
|
+
*/
|
|
253
|
+
mode?: "porportional" | "cumulative";
|
|
254
|
+
/**
|
|
255
|
+
* Maximum amount for the bar (used only in "cumulative" mode)
|
|
256
|
+
* If not provided, defaults to sum of all values (no remaining segment)
|
|
257
|
+
* If provided and sum < maxAmount, shows gray "remaining" segment
|
|
258
|
+
*/
|
|
259
|
+
maxAmount?: number;
|
|
260
|
+
/**
|
|
261
|
+
* Label for the remaining/unknown segment in cumulative mode
|
|
262
|
+
* @default "Remaining"
|
|
263
|
+
*/
|
|
264
|
+
remainingLabel?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Unit to display with the remaining segment value in cumulative mode
|
|
267
|
+
* If not provided, uses the unit from the first data item (if available)
|
|
268
|
+
*/
|
|
269
|
+
remainingUnit?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Global unit to display with values in cumulative mode (e.g., "GB", "datasets", "K")
|
|
272
|
+
* Individual data items can override this with their own unit property
|
|
273
|
+
* Only shown when mode is "cumulative"
|
|
274
|
+
*/
|
|
275
|
+
unit?: string;
|
|
276
|
+
/**
|
|
277
|
+
* Options for the color generator
|
|
278
|
+
*/
|
|
279
|
+
colorGeneratorOptions?: DiscreteColorGeneratorOptions;
|
|
280
|
+
}
|
|
281
|
+
declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
|
|
282
|
+
export { HeatmapChartProps, _default, _default as HeatmapChart, StackedBarChart };
|
|
283
|
+
export type { StackedBarChartProps, StackedBarChartDataItem };
|