psychart
Version:
View air conditions on a psychrometric chart
127 lines (126 loc) • 3.26 kB
TypeScript
import { PsychartOptions, Datum, RegionName, DataOptions } from './types';
/**
* Generates an interactive psychrometric chart with plotting capabilities.
*/
export declare class Psychart {
/**
* ID counter that counts up every time Psychart is initialized.
*/
private static id_count;
/**
* The unique serial ID of this instance of Psychart.
*/
private readonly id;
/**
* Psychart full configuration.
*/
private readonly config;
/**
* Defines the string representations of the current unit system.
*/
private readonly units;
/**
* Defines a scaling factor for humidity ratio.
*/
private readonly scaleFactor;
/**
* Defines the base element to attach to the viewing window.
*/
private readonly base;
/**
* This is the base SVG where Psychart is rendered.
*/
private readonly svg;
/**
* Represents the legend for Psychart.
*/
private readonly legend;
/**
* Legend definitions, which contains linear gradients.
*/
private readonly legendDefs;
/**
* The base element for adding lines in the legend.
*/
private readonly legendg;
/**
* Defines all the groups in the SVG ordered by layer.
*/
private readonly g;
/**
* The data series plotted on Psychart with each of their last states and visibility toggles.
*/
private series;
/**
* Helper function to return an array of region names and their corresponding tooltips.
*/
static getRegionNamesAndTips(): Array<[RegionName, string]>;
/**
* Convert from Celsius to Fahrenheit.
*/
private static CtoF;
/**
* Get a range of numbers used for an axis.
*/
private static getRange;
/**
* Construct a new instance of `Psychart` given various configuration properties.
*/
constructor(options?: Partial<PsychartOptions>);
/**
* Interpolate between "corner" psychrometric states.
*/
private interpolate;
/**
* Generate SVG path data from an array of psychrometric states.
*/
private setPathData;
/**
* Draw an axis line given an array of psychrometric states.
*/
private drawAxis;
/**
* Create a line to append onto a parent element.
*/
private createLine;
/**
* Draw an axis label.
*/
private drawLabel;
/**
* Create a label to append onto a parent element.
*/
private createLabel;
/**
* Create a tooltip element.
*/
private drawTooltip;
/**
* Add a line to the legend.
*/
private addToLegend;
/**
* Compute the height of the legend, in pixels.
*/
private getLegendHeight;
/**
* Remove all the children from an element.
*/
private clearChildren;
/**
* Plot one psychrometric state onto the psychrometric chart.
*/
plot(state: Datum, config?: Partial<DataOptions>): void;
/**
* Draw a shaded region on Psychart.
*/
private drawRegion;
/**
* Clear all plotted data from Psychart.
*/
clearData(): void;
/**
* Return the HTML element to append on the parent.
*/
getElement(): HTMLDivElement;
}