import { TAxisDefinition } from "../../../../Builder/buildAxis"; import { Point } from "../../../../Core/Point"; import { SCRTCoordinateTransform, SCRTPen, SCRTPolarCoordinateTransform, SCRTSolidBrush, TSciChart } from "../../../../types/TSciChart"; import { Pen2DCache } from "../../../Drawing/Pen2DCache"; import { WebGlRenderContext2D } from "../../../Drawing/WebGlRenderContext2D"; import { IThemeProvider } from "../../../Themes/IThemeProvider"; import { SciChartSurface } from "../../SciChartSurface"; import { AxisBase2D, EClipMode, IAxisBase2dOptions } from "../AxisBase2D"; import { PolarAxisLayoutState } from "../AxisLayoutState"; import { PolarAxisRenderer } from "./PolarAxisRenderer"; import { EPolarAxisMode } from "./types/PolarAxisMode"; import { EPolarGridlineMode } from "./types/PolarGridlineMode"; import { EPolarLabelMode } from "./types/PolarLabelMode"; export interface IPolarAxis { /** * Gets or sets whether this polar axis is angular or radial. The X and Y axes for a series must be different modes. */ isAngular: boolean; getTransform(): SCRTCoordinateTransform; /** * For an Angular axis, gets or sets the angle corresponding to the start of the axis. 0 is horizontally right. * For a Radial axis, gets or sets the angle at which the axis is drawn */ startAngle: number; /** * Gets or sets the x offset in pixels for the center of the polar chart. Set this for the angular axis and the radial axis will use the same value. */ xCenterOffset: number; /** * Gets or sets the y offset in pixels for the center of the polar chart. Set this for the angular axis and the radial axis will use the same value. */ yCenterOffset: number; } export interface IPolarAxisOptions extends IAxisBase2dOptions { /** * Sets whether this polar axis is angular or radial. The X and Y axes for a series must be different mode. * If not specified, defaults to angular if this is added as an X axis, and radial for a y axis. */ polarAxisMode?: EPolarAxisMode; /** * Sets the start angle of axis in radians. * * Vvalues in clock notation: * - 3 o'clock => `0` or `2 * Math.PI` * - 6 o'clock => `3 * PI / 2` * - 9 o'clock => `Math.PI` * - 12 o'clock => `Math.PI / 2` * * Default `0` */ startAngle?: number; /** * Sets the start angle of axis in degrees. * * ### Values in clock notation: * - 3 o'clock => `0` or `360` * - 6 o'clock => `270` * - 9 o'clock => `180` * - 12 o'clock => `90` * * @note If both `startAngleDegrees` and `startAngle` are specified, `startAngle` takes precedence. * * Default `0` */ startAngleDegrees?: number; /** * Sets the angular length for an Angular axis in radians. * * Default `2 * Math.PI` */ totalAngle?: number; /** * Sets the angular length for an Angular axis in degrees. * @note If both `totalAngleDegrees` and `totalAngle` are specified, `totalAngle` takes precedence. * * Default `360` */ totalAngleDegrees?: number; /** * Sets whether the gridlines for the radial axis are drawn as Circles or Polygons (for radar chart). */ gridlineMode?: EPolarGridlineMode; /** * Sets the inner radius for a radial axis as a decimal between 0 and 1 which is treated as a fraction of the maximum radius. * If you want to set an absolute innerRadius, use overrideOffset */ innerRadius?: number; /** * Sets the x offset in pixels for the center of the polar chart. Set this for the angular axis and the radial axis will use the same value. */ xCenterOffset?: number; /** * Sets the y offset in pixels for the center of the polar chart. Set this for the angular axis and the radial axis will use the same value. */ yCenterOffset?: number; /** * Sets the scale of the axis used for zooming. Default 1 (one to one scale). */ lengthScale?: number; /** * Sets the label mode for angular axis. Default Horizontal. For radial axis it is ignored. */ polarLabelMode?: EPolarLabelMode; /** * Sets the positioning of axis labels. True for Radial axis draws the labels in the data direction */ isInnerAxis?: boolean; } /** * @summary A 2D Chart Numeric / Value Axis type for use with Polar Charts. * @description A Polar Numeric axis converts to angles around a circle. * @remarks * Set a {@link NumericAxis} on the {@link SciChartSurface.xAxes} or {@link SciChartSurface.yAxes} property. */ export declare abstract class PolarAxisBase extends AxisBase2D implements IPolarAxis { readonly isPolarAxis: boolean; readonly axisLayoutState: PolarAxisLayoutState; protected polarAxisModeProperty: EPolarAxisMode; protected startAngleProperty: number; protected totalAngleProperty: number; protected xCenterOffsetProperty: number; protected yCenterOffsetProperty: number; protected lengthScaleProperty: number; protected gridlineModeProperty: EPolarGridlineMode; protected polarLabelModeProperty: EPolarLabelMode; protected coordTransform: SCRTPolarCoordinateTransform; protected otherAxisProperty: PolarAxisBase; protected innerRadiusProperty: number; /** * Creates an instance of a {@link PolarAxisBase} * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and * access to our WebGL2 Engine and WebAssembly numerical methods * @param options Optional parameters of type {@link IPolarAxisOptions} used to configure the axis at instantiation time */ constructor(webAssemblyContext: TSciChart, options?: IPolarAxisOptions); onAttach(parentSurface: SciChartSurface, isXAxis: boolean, isPrimaryAxis: boolean): void; /** @inheritDoc */ get isAngular(): boolean; /** * Gets or sets whether this polar axis is angular or radial. The X and Y axes for a series must be different mode. */ get polarAxisMode(): EPolarAxisMode; set polarAxisMode(value: EPolarAxisMode); /** * Gets or sets whether the gridlines for the radial axis are drawn as Circles or Polygons (for radar chart). */ get gridlineMode(): EPolarGridlineMode; set gridlineMode(value: EPolarGridlineMode); /** @inheritDoc */ get startAngle(): number; /** @inheritDoc */ set startAngle(value: number); /** * Gets or sets the angular length for an Angular axis. Default 2 pi radians (ie 360 degrees) */ get totalAngle(): number; set totalAngle(value: number); /** * Gets or sets the start angle in degrees. */ get startAngleDegrees(): number | undefined; set startAngleDegrees(value: number | undefined); /** * Gets or sets the total angle in degrees. */ get totalAngleDegrees(): number | undefined; set totalAngleDegrees(value: number | undefined); /** @inheritDoc */ get xCenterOffset(): number; /** @inheritDoc */ set xCenterOffset(value: number); /** @inheritDoc */ get yCenterOffset(): number; /** @inheritDoc */ set yCenterOffset(value: number); /** * Gets or sets the scale of the axis used for zooming. Default 1 (one to one scale). */ get lengthScale(): number; set lengthScale(value: number); /** @inheritDoc */ get axisLength(): number; /** @inheritDoc */ set axisLength(value: number); /** The maximum radius as set by layout */ get maxRadius(): number; /** * Gets or sets the label mode for angular axis. For radial axis is ignored. */ get polarLabelMode(): EPolarLabelMode; set polarLabelMode(value: EPolarLabelMode); /** * Gets or sets the offset of the axis position. * Defines a position of the axis along the layout flow. */ get offset(): number; /** * Called internally by layout strategies when switching between stacked and non-stacked axes. * If you want to set a manual offset, call {@link overrideOffset} */ set offset(value: number); /** * Gets or Sets the inner radius for a radial axis as a decimal between 0 and 1 which is treated as a fraction of the maximum radius. * If you want to set an absolute innerRadius, use overrideOffset */ get innerRadius(): number; set innerRadius(value: number); /** * Gets the other polar axis. Is set in the layout step in {@link PolarAxisBase.measure} method */ get otherAxis(): PolarAxisBase; /** @inheritDoc */ measure(): void; /** @inheritDoc */ zoomBy(minFraction: number, maxFraction: number): void; /** @inheritDoc */ scroll(pixelsToScroll: number, clipMode: EClipMode): boolean; /** * Return the transform function is used to transform from polar to cartesian coordinates * @param usePixelRatio is needed for correct transform for SVG annotations * @returns */ getTransform(usePixelRatio?: boolean): SCRTPolarCoordinateTransform; /** * Gets whether the axis is currently horizontal or not */ get isHorizontalAxis(): boolean; /** @inheritDoc */ get isVerticalChart(): boolean; /** @inheritDoc */ applyTheme(themeProvider: IThemeProvider): void; toJSON(): TAxisDefinition; /** @inheritDoc */ delete(): void; /** @inheritDoc */ protected drawAxisBands(renderContext: WebGlRenderContext2D, ticks: number[], tickCoords: number[], brush: SCRTSolidBrush): void; /** @inheritDoc */ protected getPenForLines(penCache: Pen2DCache, stroke: string, strokeThickness: number, strokeDashArray?: number[]): SCRTPen; /** @inheritDoc */ protected drawGridLines(renderContext: WebGlRenderContext2D, tickCoords: number[], linesPen: SCRTPen, isMajor: boolean): void; /** Converts angle from degrees to radians */ toRadians(angleInDegrees: number): number; /** * Converts from cartesian to polar coordinates * @param x - X cartesian coordinate * @param y - Y cartesian coordinate * @returns {@link Point} where Point.x is angle and Point.y is radius */ reverseTransform(x: number, y: number, flipXYForVertical?: boolean): Point; switchAxisRenderer(useNativeText: boolean): void; protected createAxisRender(): PolarAxisRenderer; }