import { ISerializedData } from "@plotex/serialization"; import { IPlotConfig, IAxisMap } from "./chart-def"; import { ChartType, ChartTypeString, IChartDef, AxisType, AxisTypeString, HorizontalLabelPosition, HorizontalLabelPositionString, VerticalLabelPosition, VerticalLabelPositionString } from "@plotex/chart-def"; /** * Fluent API for configuring the plot. */ export interface IPlotAPI { /** * Set the type of the chart to be plotted. * * @param chartType - Specifies the chart type. */ chartType(chartType: ChartType | ChartTypeString): IPlotAPI; /** * Set the width of the chart. */ width(width: number | string): IPlotAPI; /** * Set the height of the chart. */ height(height: number | string): IPlotAPI; /** * Configure the x axis. */ x(): IXAxisConfigAPI; /** * Configure the y axis. */ y(): IYAxisConfigAPI; /** * Configure the y axis. */ y2(): IYAxisConfigAPI; /** * Serialize the plot definition so that it can be converted to JSON. * The JSON definition of the chart can be used to instantiate the chart in a browser. */ serialize(): IChartDef; } /** * Plot API for configuring a particular axis. */ export interface IAxisConfigAPI extends IPlotAPI { /** * Set the label for the axis. */ label(label: string): FluentT; } /** * Configure a series. */ export interface IAxisSeriesConfigAPI extends IPlotAPI { } /** * Configure an X axis series. */ export interface IXAxisSeriesConfigAPI extends IAxisSeriesConfigAPI { } /** * Configure a Y axis series. */ export interface IYAxisSeriesConfigAPI extends IAxisSeriesConfigAPI { /** * Set the series label. */ label(label: string): IYAxisSeriesConfigAPI; /** * Set the display format for values of this series. */ format(formatString: string): IYAxisSeriesConfigAPI; /** * Configure an explicit x axis for this series. */ setX(seriesName: string): IXAxisSeriesConfigAPI; } /** * Plot API for configuring a particular axis. */ export interface IXAxisConfigAPI extends IAxisConfigAPI { /** * Set the series for the x axis. */ setSeries(seriesName: string): IXAxisSeriesConfigAPI; /** * Set the type of the axis. */ type(axisType: AxisType | AxisTypeString): IXAxisSeriesConfigAPI; /** * Set the position for the label. */ labelPosition(position: HorizontalLabelPosition | HorizontalLabelPositionString): IXAxisConfigAPI; } /** * Plot API for configuring a particular Y axis. */ export interface IYAxisConfigAPI extends IAxisConfigAPI { /** * Add a series to a Y axis. */ addSeries(seriesName: string): IYAxisSeriesConfigAPI; /** * Set the position for the label. */ labelPosition(position: VerticalLabelPosition | VerticalLabelPositionString): IYAxisConfigAPI; /** * Sets the minimum value to render on the axis. * @param value - The minimum value to render. */ min(value: number): IYAxisConfigAPI; /** * Sets the maximum value to render on the axis. * @param value - The maximum value to render. */ max(value: number): IYAxisConfigAPI; } /** * Fluent API for configuring the plot. */ export declare abstract class AbstractPlotAPI implements IPlotAPI { protected chartDef: IChartDef; private plotDefaults?; constructor(chartDef: IChartDef, plotDefaults?: IPlotConfig); /** * Set the type of the chart to be plotted. * * @param chartType - Specifies the chart type. */ chartType(chartType: ChartType | ChartTypeString): IPlotAPI; /** * Set the width of the chart. */ width(width: number | string): IPlotAPI; /** * Set the height of the chart. */ height(height: number | string): IPlotAPI; /** * Configure the default x axis. */ x(): IXAxisConfigAPI; /** * Configure the y axis. */ y(): IYAxisConfigAPI; /** * Configure the y axis. */ y2(): IYAxisConfigAPI; /** * Serialize the plot definition so that it can be converted to JSON. * The JSON definition of the chart can be used to instantiate the chart in a browser. */ serialize(): IChartDef; /** * Used to external detect the type of this object. */ getTypeCode(): string; } /** * Fluent API for configuring the plot. */ export declare class PlotAPI extends AbstractPlotAPI { /** * Deserialize an instance of PlotAPI from a previously serialize chart def. * * @param chartDef - The chart definition to deserialize from. */ static deserialize(chartDef: IChartDef): IPlotAPI; constructor(data: ISerializedData, plotConfig: IPlotConfig, axisMap: IAxisMap, plotDefaults?: IPlotConfig); } //# sourceMappingURL=plot-api.d.ts.map