/// /** Core */ import { CoreComponent } from "cmf.core/src/core"; /** Angular */ import * as ng from "@angular/core"; /** Kendo */ import "kendo.dataviz.chart"; import { PageBag } from "../page/pageBag"; import { CmfDefaultColor, CMF_DEFAULT_COLORS, CMF_DEFAULT_COLORS_PALETTE, CMF_DEFAULT_COLOR_NAMES } from "cmf.core/src/domain/extensions/util"; export { CmfDefaultColor as ChartSeriesColor }; export { CMF_DEFAULT_COLORS as CHART_SERIES_DEFAULT_COLORS }; export { CMF_DEFAULT_COLORS_PALETTE as CHART_SERIES_COLORS_PALETTE }; export { CMF_DEFAULT_COLOR_NAMES as CHART_SERIES_COLOR_NAMES }; /** * Chart series visualization type */ export declare enum ChartSeriesVisualizationType { Bar = 0, Column = 1, Area = 2, Line = 3 } /** * Chart series */ export interface ChartSeries { /** * Name of the Series */ name: string; /** * Color of teh Series */ color: string | number; /** * If the Series is visible */ show: boolean; /** * If the Series is stacked */ stacked?: boolean; /** * the gap between series */ gap?: number; /** * If the Series has extra value to show in the entry tooltip */ hasExtraValue: boolean; /** * Visualization type of the Series: bar, column, area or line */ type: ChartSeriesVisualizationType; /** * Field in the data array to get the value */ field: string; /** * Color field to add specific colors to specific entries */ colorField?: string; /** * Extra value field in the data array to get the extra value */ extraValueField?: string; /** * Extra value color field in the data array to get the extra value color */ extraValueColorField?: string; /** * The series label customization */ labels?: kendo.dataviz.ui.ChartSeriesItemLabels; /** * If the Series tooltip is hided */ hideTooltip?: boolean; } /** * The custom shapes interface */ export interface CustomShapes { /** * Array of rectangles */ rectangle?: Array; /** * Array of lines */ line?: Array; } /** * The Shape interface. * This interface has all the properties of a shape. */ export interface Shape { /** * The initial category of the category axis */ initialCategory: number; /** * The final category of the category axis */ finalCategory: number; /** * The initial value of the value axis */ initialValue: number; /** * The final value of the category axis */ finalValue: number; /** * The content of the tooltip of the shape */ tooltipContent?: string; /** * The tooltip position */ tooltipPosition?: string; /** * The tooltip width */ tooltipWidth?: number; /** * The tooltip height */ tooltipHeight?: number; /** * The stroke color of the shape */ strokeColor?: string; /** * The stroke width of the shape */ strokeWidth?: number; /** * The stroke opacity of the shape */ strokeOpacity?: number; } /** * The Rectangle shape interface. * This interface has its specific properties and extends the Shape interface. */ export interface RectangleShape extends Shape { /** * The color to fill the rectangle */ fillColor?: string; /** * The opacity of the rectangle */ fillOpacity?: number; } /** * The Line shape interface. * This interface has its specific properties and extends the Shape interface. */ export interface LineShape extends Shape { /** * The dash type of the line */ dashType?: string; } /** * DataSeriesChartType */ export declare enum DataSeriesChartType { DataSeries = 0, List = 1 } /** * @whatItDoes * This component show data in a chart in a group of 'series' to visually compare or take conclusions of a trend in a specific data collection * * @howToUse * Used mainly to show information of a range of time frames taken from a KPI * * ### Inputs * `string` : **main-title** - (optional) title that appears above the chart ; * `string` : **sub-title** - (optional) sub-title that appears above the chart ; * `number` : **min** - (optional) min value of the Y axis ; * `number` : **max** - (optional) max value of the Y axis ; * `boolean` : **show-legend** - (optional) if the legend of the chart is visible or not ; * `Array` : **series** - the series of the chart (Array) ; * `string` : **category-field** - a string with the name of the field of each data entry that have the text for the X axis label ; * `boolean` : **firstAxisVisible** - Show first axis * `boolean` : **firstAxisLabelsVisible** - Defines if the first axis labels should be visible * `string` : **units** - a string representation of the units of the values shwo in the chart (EX: '€', 'kg', etc..) ; * `Array` : **data** - an array of items with values to feed the chart (Array beign T any object with the example ; * `any` : **animation** - (optional) if the chart has animations when the values change (default is true) ; * `boolean` : **showLabelsAlways** - Show labels flag . * `CustomShapes` : **customShapes** - The custom shapes to draw * `number` : **axisInterval** - The axis interval value * `boolean` : **secondAxisVisible** - Show second axis * `boolean` : **secondAxisLabelsVisible** - Defines if the second axis labels should be visible * `kendo.dataviz.ui.ChartCategoryAxisItemNotes` : **notes** - Used to add labels along the axis of the chart * `kendo.dataviz.ui.ChartCategoryAxisItemNotes` : **secondAxisNotes** - Used to add labels along the secondary axis of the chart * `string`: **valueField** - The default value field * `DataSeriesChartType`: **chartType** - The chart type whether its a List or a Chart * `kendo.dataviz.ui.ChartPlotArea` : **chartPlotArea** - The plot area configuration options * ### Example * To use the component, assume this HTML Template as an example: * * ```HTML * * * ``` * */ export declare class DataSeriesChart extends CoreComponent implements ng.AfterViewInit, ng.OnDestroy, ng.OnChanges { private _elementRef; private _iterableDiffers; private _keyValueDiffers; private _pageBag; /** * Chart type */ chartType: DataSeriesChartType; /** * The title of the chart (optional) */ title: string; /** * The sub-title of the chart (optional) */ subTitle: string; /** * The min value of the chart scale */ min: number; /** * The max value of the chart scale */ max: number; /** * The units of the value axis */ units: string; /** * If chart plays animations when changing values */ animation: boolean; /** * The array of series of the chart */ series: Array; /** * Field to get the category (label) for each entry in data */ categoryField: string; /** * Field to get the value for each entry in data */ valueField: string; /** * The data for the series */ data: Array; /** * If the legend of the series is visible or not */ showLegendAlways: boolean; /** * Show title always */ private showTitleAlways; /** * Show X labels always */ showXLabelsAlways: boolean; /** * Show Y labels always */ showYLabelsAlways: boolean; /** * Second axis min */ secondAxisMin: number; /** * Second axis max */ secondAxisMax: number; /** * Second axis units */ secondAxisUnits: string; /** * The custom shapes */ customShapes: CustomShapes; /** * Second axis visible */ secondAxisVisible: boolean; /** * First axis visible */ firstAxisVisible: boolean; /** * Horizontal */ horizontal: boolean; /** * Axis interval value */ axisInterval: number; /** * Used to add labels along the axis of the chart */ notes: kendo.dataviz.ui.ChartCategoryAxisItemNotes; /** * Used to add labels along the secondary axis of the chart */ secondAxisNotes: kendo.dataviz.ui.ChartCategoryAxisItemNotes; /** * Defines if the first axis labels should be visible */ firstAxisLabelsVisible: boolean; /** * Defines if the second axis labels should be visible */ secondAxisLabelsVisible: boolean; /** * Chart plot area of data series chart */ chartPlotArea: kendo.dataviz.ui.ChartPlotArea; /** * Stores the element query */ private _elementQuery; /** * Small Size */ _smallSize: boolean; /** * Stores the element that holds the component visual */ private _chart; /** * Width class */ private _widthClass; /** * Height class */ private _heightClass; /** * Kendo UI chart */ private _kendoChart; /** * Last height class */ private _lastHeightClass; /** * Chart options */ private _chartOptions; /** * On theme update callback */ private _onThemeUpdateCallback; /** * Page enter subscription */ private _onPageEnterSubscription; /** * Redraw kendop chart throttled */ private _chartRedrawThrottled; /** * Constructor */ constructor(_elementRef: ng.ElementRef, _iterableDiffers: ng.IterableDiffers, _keyValueDiffers: ng.KeyValueDiffers, _pageBag: PageBag); /** * Calculate step for the category axis * * @private * @param {number} valuesRange * @param {number} maxLabels * @returns {number} * @memberof DataSeriesChart */ private calculateCategoryAxisStep; /** * Check if step should be calculated based on the label limit * * @private * @param {number} valuesRange * @param {number} limit * @returns {boolean} * @memberof DataSeriesChart */ private isOverCategoryAxisLabelLimit; /** * On page enter */ private onPageEnter; /** * On theme change update colors */ private onThemeUpdate; /** * Tooltip for series without extra value */ private getChartTooltip; /** * Tooltip for series with extra value */ private getChartTooltipWithExtraValue; /** * Get color string */ private getColorString; /** * Set category Axis step based on amount of data * * @private * @param {number} valuesRange * @memberof DataSeriesChart */ private setCategoryAxisStep; /** * Set series data */ private setSeriesData; /** * Set chart series properties */ private newSeries; /** * Refresh categories axis */ private refreshCategories; /** * Custom render function to kendo chart * @param chartRenderEvent the chart render event */ customRenderKendoUI(chartRenderEvent: kendo.dataviz.ui.ChartRenderEvent): void; /** * On component resize */ resize(): void; /** * Function used to draw the rectangles logic * @param customShapeRectangle the custom rectangle to draw * @param axis the value axis * @param categoryAxis the category axis * @param group the group to append to */ private drawRectangles; /** * Function used to draw the lines logic * @param customShapeLine the custom line to draw * @param axis the value axis * @param categoryAxis the category axis * @param group the group to append to */ private drawLines; /** * Set axis visible * @param axis * @param visible */ private setAxisVisible; /** * Set title visible */ private setTitleAndLegendVisible; /** * Check changes of a property */ private checkChanges; private isHorizontal; /** * On changes */ private onChanges; /** * Refresh the chart when its data is updated */ refresh(): void; /** * On Init */ ngAfterViewInit(): void; /** * On Destroy */ ngOnDestroy(): void; /** * On Changes */ ngOnChanges(changes: ng.SimpleChanges): void; } export declare class DataSeriesChartModule { }