igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
212 lines (209 loc) • 8.16 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { IgcAxisComponent } from './igc-axis-component';
import { toPoint, fromRect, ensureBool, getAllPropertyNames, toSpinal } from "igniteui-webcomponents-core";
/**
* Represents the base class for all IgxDataChartComponent category-based axes.
*/
export let IgcCategoryAxisBaseComponent = /*@__PURE__*/ (() => {
class IgcCategoryAxisBaseComponent extends IgcAxisComponent {
constructor() {
super();
this._chartLevelData = null;
this._dataSource = null;
}
provideData(data) {
this._chartLevelData = data;
this.updateDataSource();
}
updateDataSource() {
if (this._dataSource == null) {
this.i.itemsSource = this._chartLevelData;
}
else {
this.i.itemsSource = this._dataSource;
}
}
set dataSource(value) {
this._dataSource = value;
this.updateDataSource();
//console.log("setting axis data source: " + value)
}
get dataSource() {
if (this._dataSource != null) {
return this._dataSource;
}
return this.i.itemsSource;
}
connectedCallback() {
if (super["connectedCallback"]) {
super["connectedCallback"]();
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
}
disconnectedCallback() {
if (super["disconnectedCallback"]) {
super["disconnectedCallback"]();
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
}
static get observedAttributes() {
if (IgcCategoryAxisBaseComponent._observedAttributesIgcCategoryAxisBaseComponent == null) {
let names = getAllPropertyNames(IgcCategoryAxisBaseComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcCategoryAxisBaseComponent._observedAttributesIgcCategoryAxisBaseComponent = names;
}
return IgcCategoryAxisBaseComponent._observedAttributesIgcCategoryAxisBaseComponent;
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets if the current axis is a continuous rather than a discrete scale
*/
get isContinuous() {
return this.i.cd;
}
/**
* Checks if the axis is of category axis type
*/
get isCategory() {
return this.i.cb;
}
/**
* Gets the number of items in the current category axis items source.
*/
get itemsCount() {
return this.i.lk;
}
set itemsCount(v) {
this.i.lk = +v;
this._a("itemsCount", this.i.lk);
}
/**
* Gets or sets the amount of space between adjacent categories for the current axis object.
* The gap is silently clamped to the range [0, 1] when used.
*
* Use the `Gap` property to configure the spacing between items on a category axis with item spacing.
*
* A `Gap` of 0 allocates no space between items. A `Gap` of 1 allocates a space between items equal to the width of one item.
*
* To set the item spacing to 75% the width of one item, set the `Gap` to 0.75, as in this code:
*/
get gap() {
return this.i.k5;
}
set gap(v) {
this.i.k5 = +v;
this._a("gap", this.i.k5);
}
/**
* Gets or sets the maximum gap value to allow. This defaults to 1.0.
*/
get maximumGap() {
return this.i.lc;
}
set maximumGap(v) {
this.i.lc = +v;
this._a("maximumGap", this.i.lc);
}
/**
* Gets or sets the minimum amount of pixels to use for the gap between categories, if possible.
*/
get minimumGapSize() {
return this.i.ld;
}
set minimumGapSize(v) {
this.i.ld = +v;
this._a("minimumGapSize", this.i.ld);
}
/**
* Gets or sets the amount of overlap between adjacent categories for the current axis object.
* The overlap is silently clamped to the range [-1, 1] when used.
*
* Use the `Overlap` property to configure the spacing between items on a category axis with item spacing and more than one series.
*
* An `Overlap` of 0 places grouped items adjacent to each other. An `Overlap` of 1 places grouped items in the same axis space, completely overlapping. An `Overlap` of -1 places a space between grouped items equal to the width of one item.
*
* To place grouped items with 75% overlap, set the `Overlap` to 0.75, as in this code:
*/
get overlap() {
return this.i.le;
}
set overlap(v) {
this.i.le = +v;
this._a("overlap", this.i.le);
}
/**
* Gets or sets whether the category axis should use clustering display mode even if no series are present that would force clustering mode.
*
* `UseClusteringMode` applies grouping and spacing to a category axis equivalent to the grouping that occurs when grouping series, such as ColumnSeries, are used.
*
* Try setting it on an axis displaying financial series to adjust the spacing on the left and right sides of the axis:
*/
get useClusteringMode() {
return this.i.kz;
}
set useClusteringMode(v) {
this.i.kz = ensureBool(v);
this._a("useClusteringMode", this.i.kz);
}
getFullRange() {
let iv = this.i.ag();
return (iv);
}
getCategoryBoundingBox(point, useInterpolation, singularWidth) {
let iv = this.i.mj(toPoint(point), useInterpolation, singularWidth);
return fromRect(iv);
}
getCategoryBoundingBoxHelper(point, useInterpolation, singularWidth, isVertical) {
let iv = this.i.mk(toPoint(point), useInterpolation, singularWidth, isVertical);
return fromRect(iv);
}
/**
* Unscales a value from screen space into axis space.
* @param unscaledValue * The scaled value in screen coordinates to unscale into axis space.
*/
unscaleValue(unscaledValue) {
let iv = this.i.lg(unscaledValue);
return (iv);
}
notifySetItem(index, oldItem, newItem) {
this.i.l4(index, oldItem, newItem);
}
/**
* Used to manually notify the axis that the data source has reset or cleared its items.
*/
notifyClearItems() {
this.i.l1();
}
notifyInsertItem(index, newItem) {
this.i.l2(index, newItem);
}
notifyRemoveItem(index, oldItem) {
this.i.l3(index, oldItem);
}
}
IgcCategoryAxisBaseComponent._observedAttributesIgcCategoryAxisBaseComponent = null;
return IgcCategoryAxisBaseComponent;
})();