/** Core */ import { CoreComponent } from "cmf.core/src/core"; import * as ng from "@angular/core"; import moment from "moment"; import "moment-duration-format/lib/moment-duration-format"; /** Models */ import { RealTimeChartSerie, RealTimeChartValues, RealTimeChartSeriesDefinition } from "./realTimeChartModel"; /** * Used to defines the margins, will alternate between default and thin */ export interface ChartMargins { top: number; right: number; bottom: number; left: number; } /** * Chart dimensions, used to adapt the chart to the container dims */ export interface ChartDimensions { width: number; height: number; } /** * @whatItDoes * * This component is used to draw a chart where the X axis is always time based * * @howToUse * * This component is used with the inputs and outputs mentioned below. * * * ### Inputs * `boolean` : **showCaption** - Defines if the axis labels will be visible * `boolean` : **showAxesLabels** - Defines if the axis tick text will be visible * `moment.Duration` : **range** - X axis range * `moment.Duration` : **timeStep** - X axis step (range between x axis labels) * `string` : **dateTimeFormat** - X axis step label text format * `number` : **min** - Y axis minimum value * `number` : **max** - Y axis maximum value * `number` : **valueStep** - Y axis step (range between values) * `string` : **units** - Y axis units * `RealTimeChartSerie[]` : **series** - Array of series definition * `RealTimeChartValues` : **values** - Values for each serie. The values can be both an arrar of number or objects (with value and timestamp) * * ### Outputs * (This component as no outputs) * * ### Example * To use the component, assume this HTML Template as an example: * * ```HTML * * * ``` * * @description * * ### Dependencies * * moment * * moment.duration * * d3 * * #### Components * * #### Services * * #### Directives * * ElementQuery : `cmf.core.controls` * */ export declare class RealTimeChart extends CoreComponent implements ng.OnChanges, ng.AfterViewInit, ng.OnDestroy { private _elementRef; private _ngZone; /** * Used to determine the size of the container */ private _graph; /** * Gets the ElementQuery element */ private _elementQuery; /** * Used to attach elements to the chart */ private _chart; /** * Used to attach elements to the chart */ private _svg; /** * x axis configurations */ private _xScale; private _xAxis; private _xAxisRange; private _xAxisTickInterval; private _xAxisTicks; private _xAxisTimeStep; private _xAxisSteps; private _xAxisLabels; /** * Defines if the x axis transition will be animated * Used to prevent x axis tick animation after resize */ private _xAxisAnimation; /** * x axis configurations */ private _yScale; private _yAxis; private _yAxisMin; private _yAxisMax; private _yAxisRange; private _yAxisValueStep; private _yAxisSteps; private _yAxisStepsValueFormat; private _yAxisLabels; private _yAxisUnits; /** * Chart paths reference - Used to shift the paths */ private _lines; /** * Chart areas reference - Used to shift the areas */ private _areas; /** * Used to prevent multiple and unnecessary setups */ private _chartSetup; /** * Used to guarantee that both the tick and the line drawer millis are the same */ private _now; /** * Used to clip the series paths */ private _clipper; /** * Chart dimensions */ private _dims; /** * Default config - cloned so the object doesn't get re used by different instances */ private _defaultConfig; /** * Used for color and chart points handling */ private _util; /** * Defines if the axis labels will be visible */ showCaption: boolean; /** * Defines if the axis tick text will be visible */ showAxesLabels: boolean; /** * X axis range */ range: moment.Duration; /** * X axis step (range between values) */ timeStep: moment.Duration; /** * X tick text format */ dateTimeFormat: string; /** * Y axis minimum value */ min: number; /** * Y axis maximum value */ max: number; /** * Y axis step (range between values) */ valueStep: number; /** * Y axis units */ units: string; /** * Array of series definition */ series: RealTimeChartSerie[]; /** * Values for each serie. The values can be both an arrar of number or objects (with value and timestamp) */ values: RealTimeChartValues; /** * Chart Id - used to fetch the html element */ id: string; /** * Used to define the chart margins, will alternate between default and thin */ margins: ChartMargins; /** * Used to manage the displayed values */ seriesValues: RealTimeChartSeriesDefinition; /** * Constructor * * @param viewContainerRef the reference to the component view container */ constructor(viewContainerRef: ng.ViewContainerRef, _elementRef: ng.ElementRef, _ngZone: ng.NgZone); /** * Check if a number has decimal places * @param n Number to check for decimal places */ private hasDecimalPlaces; /** * Get the timestamp for "now" * @returns Timestamp for now */ private nowInMillis; /** * Get timestamp in milliseconds rounded to the second */ private momentInMillis; /** * Calculate chart dimensions based on container size * @param width Width of the container * @param height Height of the container * @param Array containing width and height */ private calculateDimensions; /** * Checks if the supplied dimensions are valid * @param dims Dimensions object, containing width and height */ private areDimensionsValid; /** * Method to be called by d3 to customize the X axis * @param g d3 object */ private xAxisCustomization; /** * Method to be called by d3 to customize the X axis * @param g d3 object */ private yAxisCustomization; /** * Setup axis configs - so we don't need to check the defaults every time */ private setupAxisConfigs; private onContainerResize; /** * Setup chart */ private setupChart; /** * Used to produce each frame of the chart */ private tick; /** * Setup chart series based on what was received by input */ private setupSeries; /** * Set chart new values based on what was received by input */ private setChartValues; /** * On changes method * * @param changes the changes made to the component properties */ ngOnChanges(changes: ng.SimpleChanges): void; /** * Setup axis configuration and chart */ ngAfterViewInit(): void; /** * On destroy - unsubscribe size change event */ ngOnDestroy(): void; } export declare class RealTimeChartModule { }