igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
276 lines (272 loc) • 9.12 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrCategoryAxisBase } from "./igr-category-axis-base";
import { CategoryXAxis } from "./CategoryXAxis";
/**
* Represents a IgxDataChartComponent category X axis.
*
* `CategoryXAxis` class represents a IgxDataChartComponent category X axis.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource} >
*
* <IgrCategoryXAxis name="xAxis" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrLineSeries
* name="series1"
* xAxisName="xAxis"
* yAxisName="yAxis"
* valueMemberPath="Value"/>
* </IgrDataChart>
* ```
*
* ```ts
* this.columnSeries1 = new IgrLineSeries({ name: "Series1" });
* this.columnSeries1.dataSource = this.categoryData;
* this.columnSeries1.xAxis = this.categoryXAxis;
* this.columnSeries1.yAxis = this.numericYAxis;
* this.columnSeries1.xAxisName = "categoryXAxis";
* this.columnSeries1.yAxisName = "numericYAxis";
* this.columnSeries1.valueMemberPath = "USA";
* ```
*/
export class IgrCategoryXAxis extends IgrCategoryAxisBase {
createImplementation() {
return new CategoryXAxis();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor(props) {
super(props);
this._actualIntervalChange = null;
this._actualIntervalChange_wrapped = null;
this._actualMinorIntervalChange = null;
this._actualMinorIntervalChange_wrapped = null;
}
/**
* Gets or sets interval of labels on the secondary axis.
*/
get companionAxisInterval() {
return this.i.qf;
}
set companionAxisInterval(v) {
this.i.qf = +v;
}
/**
* Gets or sets label angle on the secondary axis.
*/
get companionAxisMinorInterval() {
return this.i.qg;
}
set companionAxisMinorInterval(v) {
this.i.qg = +v;
}
/**
* Gets or sets number of visible categories at maximum zooming level
* This property is overridden by chart's WindowRectMinWidth property
*/
get zoomMaximumCategoryRange() {
return this.i.zoomMaximumCategoryRange;
}
set zoomMaximumCategoryRange(v) {
this.i.zoomMaximumCategoryRange = +v;
}
/**
* Gets or sets maximum pixel span of series item that will be visible at maximum zooming level
* This property ensures that series item does not get stretch above specified value.
* This property is overridden by chart's WindowRectMinWidth property
*/
get zoomMaximumItemSpan() {
return this.i.zoomMaximumItemSpan;
}
set zoomMaximumItemSpan(v) {
this.i.zoomMaximumItemSpan = +v;
}
/**
* Gets or sets range of categories that the chart will zoom in to and fill plot area
* This property is overridden by chart's WindowRect or WindowScaleHorizontal properties
*/
get zoomToCategoryRange() {
return this.i.zoomToCategoryRange;
}
set zoomToCategoryRange(v) {
this.i.zoomToCategoryRange = +v;
}
/**
* Gets or sets starting category that chart will move its zoom window. Acceptable value is between 0 and number of data items
* This property is overridden by chart's WindowRect or WindowScaleHorizontal properties
*/
get zoomToCategoryStart() {
return this.i.zoomToCategoryStart;
}
set zoomToCategoryStart(v) {
this.i.zoomToCategoryStart = +v;
}
/**
* Gets or sets pixel span of series item that will be used to zoom chart such that the item has desired span
* Chart will automatically zoom in until series item has specified pixel span.
* This property is overridden by chart's WindowRect or WindowScaleHorizontal properties
*/
get zoomToItemSpan() {
return this.i.zoomToItemSpan;
}
set zoomToItemSpan(v) {
this.i.zoomToItemSpan = +v;
}
/**
* Gets or sets the frequency of displayed labels.
* The set value is a factor that determines which labels will be hidden. For example, an interval of 2 will display every other label.
*
* `Interval` determines how often to show a label, tickmark, and/or gridline along the x-axis. Set this property to _n_ to display a label every _nth_ item.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource} >
*
* <IgrCategoryXAxis name="xAxis" interval="3" />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrLineSeries
* name="series1"
* xAxisName="xAxis"
* yAxisName="yAxis"
* valueMemberPath="Value"/>
* </IgrDataChart>
* ```
*/
get interval() {
return this.i.qk;
}
set interval(v) {
this.i.qk = +v;
}
/**
* Gets the effective value for the current Interval.
*
* ```ts
* let effectiveInterval: number = xAxis.actualInterval;
* ```
*/
get actualInterval() {
return this.i.qd;
}
set actualInterval(v) {
this.i.qd = +v;
}
/**
* Gets or sets the frequency of displayed minor lines.
* The set value is a factor that determines how the minor lines will be displayed.
*
* `MinorInterval` determines how often to show a minor gridline along the x-axis. This property is relevant only when the displayed series is a type with grouping, like column series.
*
* `MinorInterval` is expressed as a number between 0 and 1, representing the frequency of the interval. To display minor gridlines representing 10ths of an item width, set `MinorInterval` to 0.1.
*
* ```ts
* <IgrDataChart
* dataSource={this.state.dataSource} >
*
* <IgrCategoryXAxis name="xAxis"
* minorInterval={0.1}
* minorStroke="green"
* minorStrokeThickness={1} />
* <IgrNumericYAxis name="yAxis" />
*
* <IgrLineSeries
* name="series1"
* xAxisName="xAxis"
* yAxisName="yAxis"
* valueMemberPath="value"/>
* </IgrDataChart>
* ```
*/
get minorInterval() {
return this.i.ql;
}
set minorInterval(v) {
this.i.ql = +v;
}
/**
* Gets the effective value for the current MinorInterval.
*
* ```ts
* let effectiveMinorInterval: number = xAxis.actualMinorInterval;
* ```
*/
get actualMinorInterval() {
return this.i.qe;
}
set actualMinorInterval(v) {
this.i.qe = +v;
}
/**
* Scrolls the specified item into view.
* @param item * Data item to scroll into view
*/
scrollIntoView(item) {
this.i.q2(item);
}
scrollRangeIntoView(minimum, maximum) {
this.i.q3(minimum, maximum);
}
/**
* Gets window zoom scale required to zoom to specified number of categories
*/
getWindowZoomFromCategories(categoriesCount) {
let iv = this.i.getWindowZoomFromCategories(categoriesCount);
return (iv);
}
/**
* Gets window zoom scale required to zoom to specified span of series item
*/
getWindowZoomFromItemSpan(pixels) {
let iv = this.i.getWindowZoomFromItemSpan(pixels);
return (iv);
}
get actualIntervalChange() {
return this._actualIntervalChange;
}
set actualIntervalChange(ev) {
if (this._actualIntervalChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualIntervalChange_wrapped);
this._actualIntervalChange_wrapped = null;
this._actualIntervalChange = null;
}
this._actualIntervalChange = ev;
this._actualIntervalChange_wrapped = (o, e) => {
let ext = this.actualInterval;
if (this.beforeActualIntervalChange) {
this.beforeActualIntervalChange(this, ext);
}
if (this._actualIntervalChange) {
this._actualIntervalChange(this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualIntervalChange_wrapped);
}
get actualMinorIntervalChange() {
return this._actualMinorIntervalChange;
}
set actualMinorIntervalChange(ev) {
if (this._actualMinorIntervalChange_wrapped !== null) {
this.i.propertyChanged = delegateRemove(this.i.propertyChanged, this._actualMinorIntervalChange_wrapped);
this._actualMinorIntervalChange_wrapped = null;
this._actualMinorIntervalChange = null;
}
this._actualMinorIntervalChange = ev;
this._actualMinorIntervalChange_wrapped = (o, e) => {
let ext = this.actualMinorInterval;
if (this.beforeActualMinorIntervalChange) {
this.beforeActualMinorIntervalChange(this, ext);
}
if (this._actualMinorIntervalChange) {
this._actualMinorIntervalChange(this, ext);
}
};
this.i.propertyChanged = delegateCombine(this.i.propertyChanged, this._actualMinorIntervalChange_wrapped);
}
}