import { Question } from "survey-core"; import { ICalculationResult } from "./visualizerBase"; import { HistogramModel } from "./histogram"; import { EditableSeriesListWidget } from "./utils/editableSeriesListWidget"; import { IAxisDescription } from "./axisDescription"; /** * Defines configuration options for a pivot chart series. * * Assign an array of `IPivotSeriesOptions` objects to the [`visualizer.series`](/dashboard/documentation/api-reference/IPivotVisualizerOptions#series) property to define chart series. * * [View Demo](/dashboard/examples/household-income-analysis-pivot-chart/ (linkStyle)) * @since 3.0.0 */ export interface IPivotSeriesOptions { /** * The data field whose values are aggregated and plotted on the Y axis. If not specified, the [`seriesField`](#seriesField) is used. * @since 3.0.0 */ valueField?: string; /** * The data field whose values define individual series and appear in the legend. * @since 3.0.0 */ seriesField?: string; /** * The aggregation function applied to [`valueField`](#valueField). * * Supported values: * * - `"count"` (default) * - `"sum"` * @since 3.0.0 */ aggregation?: "sum" | "count"; /** * The Y axis to which this series is bound. Applies only when [`useSecondaryYAxis`](/dashboard/documentation/api-reference/IPivotVisualizerOptions#useSecondaryYAxis) is `true`. * * Supported values: * * - `"primary"` * - `"secondary"` * @since 3.0.0 */ yAxis?: "primary" | "secondary"; } /** * Defines configuration options for a pivot chart visualizer. * * [View Demo](/dashboard/examples/household-income-analysis-pivot-chart/ (linkStyle)) * @since 3.0.0 */ export interface IPivotVisualizerOptions { /** * An array of survey questions available for use in the pivot chart. * * To populate this array, instantiate a [`SurveyModel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model), call its [`getAllQuestions()`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#getAllQuestions) method, optionally filter the result, and assign it to this property. * * [View Demo](/dashboard/examples/household-income-analysis-pivot-chart/ (linkStyle)) * @since 3.0.0 */ questions?: Question[] | string[]; /** * The data field whose values define categories on the X axis. * @since 3.0.0 */ categoryField?: string; /** * [Series definitions](/dashboard/documentation/api-reference/IPivotSeriesOptions) for the pivot chart. * @since 3.0.0 */ series?: IPivotSeriesOptions[]; /** * The maximum number of series per axis. * * Default value: `undefined` (no limit) * @since 3.0.0 */ maxSeriesCount?: number; /** * Specifies whether to display a secondary Y axis. * * Default value: `false` * * If you enable this option, use the [`series[].yAxis`](/dashboard/documentation/api-reference/IPivotSeriesOptions#yAxis) property to assign individual series to the secondary axis. * @since 3.0.0 */ useSecondaryYAxis?: boolean; } export declare class PivotModel extends HistogramModel { questions: Array; private isRoot; private _pivotContinuousData; private axisXSelector; axisXQuestionName: string; private axisYSelectors; primaryYAxes: Array; primaryYAxesSeriesListWidget: EditableSeriesListWidget; secondaryYAxes: Array; secondaryYAxesSeriesListWidget: EditableSeriesListWidget; private _useSecondaryYAxis; private _savedSecondaryYAxes; private questionsY; private _questionDefinition; private _aggregations; get series(): IPivotSeriesOptions[]; set series(seriesOptions: IPivotSeriesOptions[]); get categoryField(): string; set categoryField(fieldName: string); getState(): any; protected setStateCore(state: any): void; private applySeriesOptions; private getQuestionSeriesLabels; getChartAxisSetting(axisDescription: IAxisDescription, seriesLabels: Array, opposite: boolean): {}; private registerSideBarItems; constructor(questions: Array, data: Array<{ [index: string]: any; }>, options?: IPivotVisualizerOptions, isRoot?: boolean, type?: string); private moveToolbarItemsToSidebar; get useSecondaryYAxis(): boolean; set useSecondaryYAxis(newValue: boolean); get yAxes(): Array; get allowSecondaryAxis(): boolean; getYAxisInfo(): {}[]; protected getName(): string; protected getTitle(question: Question): string; setAxisQuestions(...axisQuestionNames: string[]): void; protected setChartType(chartType: string): void; private isXYChart; private movePrimaryItemToSecondary; private moveSecondaryItemToPrimary; private setupPivot; protected getContinuousValues(): { original: any; continuous: number; row: any; }[]; protected isSupportAnswersOrder(): boolean; getSeriesValues(): Array; getSeriesLabels(): Array; getSeriesValueIndexes(): { [index: string]: number; }; updateStatisticsSeriesValue(statistics: Array>, dataRow: { [index: string]: any; }, valueIndex: number, seriesValueIndexes: { [index: string]: number; }): void; protected calculateAggregation(dataRow: any, series: IAxisDescription, currentValue: number): number; protected getCalculatedValuesCore(): ICalculationResult; protected renderToolbar(container: HTMLElement): void; render(targetElement: HTMLElement | string, isRoot?: boolean): void; protected renderBanner(container: HTMLElement): void; }