cx 23.12.3 → 24.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data.js +8 -5
- package/dist/manifest.js +760 -757
- package/dist/ui.js +97 -45
- package/package.json +1 -1
- package/src/charts/PieLabel.js +71 -71
- package/src/charts/axis/Axis.d.ts +96 -96
- package/src/charts/axis/Axis.js +252 -252
- package/src/data/Expression.js +212 -211
- package/src/data/Expression.spec.js +174 -164
- package/src/data/StringTemplate.spec.js +105 -105
- package/src/svg/Text.d.ts +40 -40
- package/src/ui/Controller.d.ts +182 -182
- package/src/ui/Culture.d.ts +8 -4
- package/src/ui/Culture.js +29 -18
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Format.js +87 -89
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/Restate.d.ts +18 -18
- package/src/ui/Restate.js +160 -160
- package/src/widgets/form/ColorPicker.scss +275 -275
- package/src/widgets/form/ColorPicker.variables.scss +22 -22
- package/src/widgets/form/DateTimeField.d.ts +86 -86
- package/src/widgets/form/DateTimeField.js +572 -572
- package/src/widgets/form/Label.js +88 -88
- package/src/widgets/form/LookupField.d.ts +174 -174
- package/src/widgets/form/LookupField.js +1131 -1131
- package/src/widgets/form/UploadButton.d.ts +34 -34
package/dist/ui.js
CHANGED
|
@@ -847,6 +847,8 @@ var Localization = /*#__PURE__*/ (function () {
|
|
|
847
847
|
})();
|
|
848
848
|
|
|
849
849
|
var culture = "en";
|
|
850
|
+
var numberCulture = null;
|
|
851
|
+
var dateTimeCulture = null;
|
|
850
852
|
var cultureCache = {};
|
|
851
853
|
var defaultCurrency = "USD";
|
|
852
854
|
var dateEncoding = function dateEncoding(date) {
|
|
@@ -860,6 +862,16 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
860
862
|
Localization.setCulture(cultureCode);
|
|
861
863
|
this.invalidateCache();
|
|
862
864
|
};
|
|
865
|
+
Culture.setNumberCulture = function setNumberCulture(cultureCode) {
|
|
866
|
+
numberCulture = cultureCode;
|
|
867
|
+
delete cultureCache.numberCulture;
|
|
868
|
+
this.invalidateCache();
|
|
869
|
+
};
|
|
870
|
+
Culture.setDateTimeCulture = function setDateTimeCulture(cultureCode) {
|
|
871
|
+
dateTimeCulture = cultureCode;
|
|
872
|
+
delete cultureCache.dateTimeCulture;
|
|
873
|
+
this.invalidateCache();
|
|
874
|
+
};
|
|
863
875
|
Culture.setDefaultCurrency = function setDefaultCurrency(currencyCode) {
|
|
864
876
|
defaultCurrency = currencyCode;
|
|
865
877
|
this.invalidateCache();
|
|
@@ -870,12 +882,20 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
870
882
|
invalidateStringTemplateCache();
|
|
871
883
|
};
|
|
872
884
|
Culture.getNumberCulture = function getNumberCulture() {
|
|
873
|
-
|
|
885
|
+
var _numberCulture;
|
|
886
|
+
if (!cultureCache.numberCulture)
|
|
887
|
+
cultureCache.numberCulture = new NumberCulture(
|
|
888
|
+
(_numberCulture = numberCulture) != null ? _numberCulture : culture
|
|
889
|
+
);
|
|
874
890
|
return cultureCache.numberCulture;
|
|
875
891
|
};
|
|
876
892
|
Culture.getDateTimeCulture = function getDateTimeCulture() {
|
|
877
|
-
|
|
878
|
-
|
|
893
|
+
var _dateTimeCulture;
|
|
894
|
+
if (!cultureCache.dateTimeCulture)
|
|
895
|
+
cultureCache.dateTimeCulture = new DateTimeCulture(
|
|
896
|
+
(_dateTimeCulture = dateTimeCulture) != null ? _dateTimeCulture : culture
|
|
897
|
+
);
|
|
898
|
+
return cultureCache.dateTimeCulture;
|
|
879
899
|
};
|
|
880
900
|
Culture.getDefaultDateEncoding = function getDefaultDateEncoding() {
|
|
881
901
|
return dateEncoding;
|
|
@@ -1465,60 +1485,91 @@ var ZIndexManager = /*#__PURE__*/ (function () {
|
|
|
1465
1485
|
|
|
1466
1486
|
var Format = Format$1;
|
|
1467
1487
|
var cultureSensitiveFormatsRegistered = false;
|
|
1488
|
+
function resolveNumberFormattingFlags(flags) {
|
|
1489
|
+
if (!flags) return null;
|
|
1490
|
+
var result = {};
|
|
1491
|
+
if (flags.indexOf("+") >= 0) result.signDisplay = "exceptZero";
|
|
1492
|
+
if (flags.indexOf("c") >= 0) result.notation = "compact";
|
|
1493
|
+
if (flags.indexOf("a") >= 0) result.currencySign = "accounting";
|
|
1494
|
+
return result;
|
|
1495
|
+
}
|
|
1468
1496
|
function enableCultureSensitiveFormatting() {
|
|
1469
1497
|
if (cultureSensitiveFormatsRegistered) return;
|
|
1470
1498
|
cultureSensitiveFormatsRegistered = true;
|
|
1471
|
-
Format$1.registerFactory(["number", "n"], function (format, minimumFractionDigits, maximumFractionDigits) {
|
|
1499
|
+
Format$1.registerFactory(["number", "n"], function (format, minimumFractionDigits, maximumFractionDigits, flags) {
|
|
1472
1500
|
var culture = Culture.getNumberCulture();
|
|
1473
|
-
var formatter = culture.getFormatter(resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits));
|
|
1474
|
-
return function (value) {
|
|
1475
|
-
return formatter.format(value);
|
|
1476
|
-
};
|
|
1477
|
-
});
|
|
1478
|
-
Format$1.registerFactory("currency", function (format, currency, minimumFractionDigits, maximumFractionDigits) {
|
|
1479
|
-
var culture = Culture.getNumberCulture();
|
|
1480
|
-
currency = currency || Culture.defaultCurrency;
|
|
1481
1501
|
var formatter = culture.getFormatter(
|
|
1482
1502
|
_objectSpread2(
|
|
1483
|
-
{
|
|
1484
|
-
|
|
1485
|
-
currency: currency,
|
|
1486
|
-
},
|
|
1487
|
-
resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
|
|
1503
|
+
_objectSpread2({}, resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)),
|
|
1504
|
+
resolveNumberFormattingFlags(flags)
|
|
1488
1505
|
)
|
|
1489
1506
|
);
|
|
1490
1507
|
return function (value) {
|
|
1491
1508
|
return formatter.format(value);
|
|
1492
1509
|
};
|
|
1493
1510
|
});
|
|
1494
|
-
Format$1.registerFactory(
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1511
|
+
Format$1.registerFactory(
|
|
1512
|
+
"currency",
|
|
1513
|
+
function (format, currency, minimumFractionDigits, maximumFractionDigits, flags) {
|
|
1514
|
+
var culture = Culture.getNumberCulture();
|
|
1515
|
+
currency = currency || Culture.defaultCurrency;
|
|
1516
|
+
var formatter = culture.getFormatter(
|
|
1517
|
+
_objectSpread2(
|
|
1518
|
+
_objectSpread2(
|
|
1519
|
+
{
|
|
1520
|
+
style: "currency",
|
|
1521
|
+
currency: currency,
|
|
1522
|
+
},
|
|
1523
|
+
resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
|
|
1524
|
+
),
|
|
1525
|
+
resolveNumberFormattingFlags(flags)
|
|
1526
|
+
)
|
|
1527
|
+
);
|
|
1528
|
+
return function (value) {
|
|
1529
|
+
return formatter.format(value);
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
);
|
|
1533
|
+
Format$1.registerFactory(
|
|
1534
|
+
["percentage", "p", "%"],
|
|
1535
|
+
function (format, minimumFractionDigits, maximumFractionDigits, flags) {
|
|
1536
|
+
var culture = Culture.getNumberCulture();
|
|
1537
|
+
var formatter = culture.getFormatter(
|
|
1538
|
+
_objectSpread2(
|
|
1539
|
+
_objectSpread2(
|
|
1540
|
+
{
|
|
1541
|
+
style: "percent",
|
|
1542
|
+
},
|
|
1543
|
+
resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
|
|
1544
|
+
),
|
|
1545
|
+
resolveNumberFormattingFlags(flags)
|
|
1546
|
+
)
|
|
1547
|
+
);
|
|
1548
|
+
return function (value) {
|
|
1549
|
+
return formatter.format(value);
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
);
|
|
1553
|
+
Format$1.registerFactory(
|
|
1554
|
+
["percentSign", "ps"],
|
|
1555
|
+
function (format, minimumFractionDigits, maximumFractionDigits, flags) {
|
|
1556
|
+
var culture = Culture.getNumberCulture();
|
|
1557
|
+
var formatter = culture.getFormatter(
|
|
1558
|
+
_objectSpread2(
|
|
1559
|
+
_objectSpread2(
|
|
1560
|
+
{
|
|
1561
|
+
style: "percent",
|
|
1562
|
+
},
|
|
1563
|
+
resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
|
|
1564
|
+
),
|
|
1565
|
+
resolveNumberFormattingFlags(flags)
|
|
1566
|
+
)
|
|
1567
|
+
);
|
|
1568
|
+
return function (value) {
|
|
1569
|
+
return formatter.format(value / 100);
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
);
|
|
1522
1573
|
Format$1.registerFactory(["date", "d"], function (fmt, format) {
|
|
1523
1574
|
if (format === void 0) {
|
|
1524
1575
|
format = "yyyyMMdd";
|
|
@@ -4458,6 +4509,7 @@ export {
|
|
|
4458
4509
|
preventFocus,
|
|
4459
4510
|
preventFocusOnTouch,
|
|
4460
4511
|
registerKeyboardShortcut,
|
|
4512
|
+
resolveNumberFormattingFlags,
|
|
4461
4513
|
startAppLoop,
|
|
4462
4514
|
startHotAppLoop,
|
|
4463
4515
|
tpl,
|
package/package.json
CHANGED
package/src/charts/PieLabel.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { VDOM } from "../ui/Widget";
|
|
2
|
-
import { BoundedObject } from "../svg/BoundedObject";
|
|
3
|
-
import { Rect } from "../svg/util/Rect";
|
|
4
|
-
import { parseStyle } from "../util/parseStyle";
|
|
5
|
-
|
|
6
|
-
export class PieLabel extends BoundedObject {
|
|
7
|
-
init() {
|
|
8
|
-
this.lineStyle = parseStyle(this.lineStyle);
|
|
9
|
-
super.init();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declareData(...args) {
|
|
13
|
-
super.declareData(...args, {
|
|
14
|
-
distance: undefined,
|
|
15
|
-
lineStyle: { structured: true },
|
|
16
|
-
lineStroke: undefined,
|
|
17
|
-
lineClass: { structured: true },
|
|
18
|
-
lineColorIndex: undefined,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
calculateBounds(context, instance) {
|
|
23
|
-
var { data } = instance;
|
|
24
|
-
var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
|
|
25
|
-
instance.originalBounds = bounds;
|
|
26
|
-
instance.actualBounds = context.placePieLabel(bounds, data.distance);
|
|
27
|
-
return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
prepare(context, instance) {
|
|
31
|
-
super.prepare(context, instance);
|
|
32
|
-
if (!context.registerPieLabel)
|
|
33
|
-
throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
|
|
34
|
-
let right = instance.parentRect.r > instance.parentRect.l;
|
|
35
|
-
context.push("textDirection", right ? "right" : "left");
|
|
36
|
-
context.registerPieLabel(instance);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
prepareCleanup(context, instance) {
|
|
40
|
-
context.pop("textDirection");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
render(context, instance, key) {
|
|
44
|
-
let { originalBounds, actualBounds, data } = instance;
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<g key={key} className={data.classNames}>
|
|
48
|
-
<line
|
|
49
|
-
className={this.CSS.element(
|
|
50
|
-
this.baseClass,
|
|
51
|
-
"line",
|
|
52
|
-
data.lineColorIndex != null && "color-" + data.lineColorIndex
|
|
53
|
-
)}
|
|
54
|
-
x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
|
|
55
|
-
y1={(actualBounds.t + actualBounds.b) / 2}
|
|
56
|
-
x2={(originalBounds.l + originalBounds.r) / 2}
|
|
57
|
-
y2={(originalBounds.t + originalBounds.b) / 2}
|
|
58
|
-
stroke={data.lineStroke}
|
|
59
|
-
style={data.lineStyle}
|
|
60
|
-
/>
|
|
61
|
-
<g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
|
|
62
|
-
{this.renderChildren(context, instance)}
|
|
63
|
-
</g>
|
|
64
|
-
</g>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
PieLabel.prototype.distance = 100;
|
|
70
|
-
PieLabel.prototype.baseClass = "pielabel";
|
|
71
|
-
PieLabel.prototype.styled = true;
|
|
1
|
+
import { VDOM } from "../ui/Widget";
|
|
2
|
+
import { BoundedObject } from "../svg/BoundedObject";
|
|
3
|
+
import { Rect } from "../svg/util/Rect";
|
|
4
|
+
import { parseStyle } from "../util/parseStyle";
|
|
5
|
+
|
|
6
|
+
export class PieLabel extends BoundedObject {
|
|
7
|
+
init() {
|
|
8
|
+
this.lineStyle = parseStyle(this.lineStyle);
|
|
9
|
+
super.init();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declareData(...args) {
|
|
13
|
+
super.declareData(...args, {
|
|
14
|
+
distance: undefined,
|
|
15
|
+
lineStyle: { structured: true },
|
|
16
|
+
lineStroke: undefined,
|
|
17
|
+
lineClass: { structured: true },
|
|
18
|
+
lineColorIndex: undefined,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
calculateBounds(context, instance) {
|
|
23
|
+
var { data } = instance;
|
|
24
|
+
var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
|
|
25
|
+
instance.originalBounds = bounds;
|
|
26
|
+
instance.actualBounds = context.placePieLabel(bounds, data.distance);
|
|
27
|
+
return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
prepare(context, instance) {
|
|
31
|
+
super.prepare(context, instance);
|
|
32
|
+
if (!context.registerPieLabel)
|
|
33
|
+
throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
|
|
34
|
+
let right = instance.parentRect.r > instance.parentRect.l;
|
|
35
|
+
context.push("textDirection", right ? "right" : "left");
|
|
36
|
+
context.registerPieLabel(instance);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
prepareCleanup(context, instance) {
|
|
40
|
+
context.pop("textDirection");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
render(context, instance, key) {
|
|
44
|
+
let { originalBounds, actualBounds, data } = instance;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<g key={key} className={data.classNames}>
|
|
48
|
+
<line
|
|
49
|
+
className={this.CSS.element(
|
|
50
|
+
this.baseClass,
|
|
51
|
+
"line",
|
|
52
|
+
data.lineColorIndex != null && "color-" + data.lineColorIndex
|
|
53
|
+
)}
|
|
54
|
+
x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
|
|
55
|
+
y1={(actualBounds.t + actualBounds.b) / 2}
|
|
56
|
+
x2={(originalBounds.l + originalBounds.r) / 2}
|
|
57
|
+
y2={(originalBounds.t + originalBounds.b) / 2}
|
|
58
|
+
stroke={data.lineStroke}
|
|
59
|
+
style={data.lineStyle}
|
|
60
|
+
/>
|
|
61
|
+
<g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
|
|
62
|
+
{this.renderChildren(context, instance)}
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
PieLabel.prototype.distance = 100;
|
|
70
|
+
PieLabel.prototype.baseClass = "pielabel";
|
|
71
|
+
PieLabel.prototype.styled = true;
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { Instance } from "./../../ui/Instance.d";
|
|
2
|
-
import * as Cx from "../../core";
|
|
3
|
-
import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
|
|
4
|
-
|
|
5
|
-
export interface AxisProps extends BoundedObjectProps {
|
|
6
|
-
/** Set to `true` for vertical axes. */
|
|
7
|
-
vertical?: boolean;
|
|
8
|
-
|
|
9
|
-
/** Used as a secondary axis. Displayed at the top/right. */
|
|
10
|
-
secondary?: boolean;
|
|
11
|
-
|
|
12
|
-
/** When set to `true`, the values are displayed in descending order. */
|
|
13
|
-
inverted?: Cx.BooleanProp;
|
|
14
|
-
|
|
15
|
-
/** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
|
|
16
|
-
hidden?: boolean;
|
|
17
|
-
|
|
18
|
-
tickSize?: number;
|
|
19
|
-
minTickDistance?: number;
|
|
20
|
-
minLabelDistanceVertical?: number;
|
|
21
|
-
minLabelDistanceHorizontal?: number;
|
|
22
|
-
|
|
23
|
-
/** Distance between labels and the axis. */
|
|
24
|
-
labelOffset?: number | string;
|
|
25
|
-
|
|
26
|
-
/** Label rotation angle in degrees. */
|
|
27
|
-
labelRotation?: Cx.Prop<number | string>;
|
|
28
|
-
|
|
29
|
-
/** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
|
|
30
|
-
labelAnchor?: "start" | "end" | "middle" | "auto";
|
|
31
|
-
|
|
32
|
-
/** Horizontal text offset. */
|
|
33
|
-
labelDx?: number | string;
|
|
34
|
-
|
|
35
|
-
/** Vertical text offset which can be used for vertical alignment. */
|
|
36
|
-
labelDy?: number | string;
|
|
37
|
-
|
|
38
|
-
/** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
|
|
39
|
-
labelWrap?: boolean;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Used for vertical adjustment of multi-line labels. Default value is `auto` which means
|
|
43
|
-
* that value is initialized based on axis configuration. Value `0` means that label will grow towards
|
|
44
|
-
* the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
|
|
45
|
-
* `-0.5` will make labels vertically centered.
|
|
46
|
-
*/
|
|
47
|
-
labelLineCountDyFactor?: number | string;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Used for vertical adjustment of multi-line labels. Default value is 1 which means
|
|
51
|
-
* that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
|
|
52
|
-
*/
|
|
53
|
-
labelLineHeight?: number | string;
|
|
54
|
-
|
|
55
|
-
/** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
|
|
56
|
-
labelMaxLineLength?: number;
|
|
57
|
-
|
|
58
|
-
/** Set to true to hide the axis labels. */
|
|
59
|
-
hideLabels?: boolean;
|
|
60
|
-
|
|
61
|
-
/** Set to true to hide the axis line. */
|
|
62
|
-
hideLine?: boolean;
|
|
63
|
-
|
|
64
|
-
/** Set to true to hide the axis ticks. */
|
|
65
|
-
hideTicks?: boolean;
|
|
66
|
-
|
|
67
|
-
/** Additional CSS style to be applied to the axis line. */
|
|
68
|
-
lineStyle?: Cx.StyleProp;
|
|
69
|
-
|
|
70
|
-
/** Additional CSS style to be applied to the axis ticks. */
|
|
71
|
-
tickStyle?: Cx.StyleProp;
|
|
72
|
-
|
|
73
|
-
/** Additional CSS style to be applied to the axis labels. */
|
|
74
|
-
labelStyle?: Cx.StyleProp;
|
|
75
|
-
|
|
76
|
-
/** Additional CSS class to be applied to the axis line. */
|
|
77
|
-
lineClass?: Cx.ClassProp;
|
|
78
|
-
|
|
79
|
-
/** Additional CSS class to be applied to the axis ticks. */
|
|
80
|
-
tickClass?: Cx.ClassProp;
|
|
81
|
-
|
|
82
|
-
/** Additional CSS class to be applied to the axis labels. */
|
|
83
|
-
labelClass?: Cx.ClassProp;
|
|
84
|
-
|
|
85
|
-
onMeasured?: (info: any, instance: Instance) => void;
|
|
86
|
-
|
|
87
|
-
/** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
|
|
88
|
-
onCreateLabelFormatter?:
|
|
89
|
-
| string
|
|
90
|
-
| ((
|
|
91
|
-
context: any,
|
|
92
|
-
instance: Instance
|
|
93
|
-
) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export class Axis extends BoundedObject {}
|
|
1
|
+
import { Instance } from "./../../ui/Instance.d";
|
|
2
|
+
import * as Cx from "../../core";
|
|
3
|
+
import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
|
|
4
|
+
|
|
5
|
+
export interface AxisProps extends BoundedObjectProps {
|
|
6
|
+
/** Set to `true` for vertical axes. */
|
|
7
|
+
vertical?: boolean;
|
|
8
|
+
|
|
9
|
+
/** Used as a secondary axis. Displayed at the top/right. */
|
|
10
|
+
secondary?: boolean;
|
|
11
|
+
|
|
12
|
+
/** When set to `true`, the values are displayed in descending order. */
|
|
13
|
+
inverted?: Cx.BooleanProp;
|
|
14
|
+
|
|
15
|
+
/** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
|
|
18
|
+
tickSize?: number;
|
|
19
|
+
minTickDistance?: number;
|
|
20
|
+
minLabelDistanceVertical?: number;
|
|
21
|
+
minLabelDistanceHorizontal?: number;
|
|
22
|
+
|
|
23
|
+
/** Distance between labels and the axis. */
|
|
24
|
+
labelOffset?: number | string;
|
|
25
|
+
|
|
26
|
+
/** Label rotation angle in degrees. */
|
|
27
|
+
labelRotation?: Cx.Prop<number | string>;
|
|
28
|
+
|
|
29
|
+
/** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
|
|
30
|
+
labelAnchor?: "start" | "end" | "middle" | "auto";
|
|
31
|
+
|
|
32
|
+
/** Horizontal text offset. */
|
|
33
|
+
labelDx?: number | string;
|
|
34
|
+
|
|
35
|
+
/** Vertical text offset which can be used for vertical alignment. */
|
|
36
|
+
labelDy?: number | string;
|
|
37
|
+
|
|
38
|
+
/** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
|
|
39
|
+
labelWrap?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Used for vertical adjustment of multi-line labels. Default value is `auto` which means
|
|
43
|
+
* that value is initialized based on axis configuration. Value `0` means that label will grow towards
|
|
44
|
+
* the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
|
|
45
|
+
* `-0.5` will make labels vertically centered.
|
|
46
|
+
*/
|
|
47
|
+
labelLineCountDyFactor?: number | string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Used for vertical adjustment of multi-line labels. Default value is 1 which means
|
|
51
|
+
* that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
|
|
52
|
+
*/
|
|
53
|
+
labelLineHeight?: number | string;
|
|
54
|
+
|
|
55
|
+
/** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
|
|
56
|
+
labelMaxLineLength?: number;
|
|
57
|
+
|
|
58
|
+
/** Set to true to hide the axis labels. */
|
|
59
|
+
hideLabels?: boolean;
|
|
60
|
+
|
|
61
|
+
/** Set to true to hide the axis line. */
|
|
62
|
+
hideLine?: boolean;
|
|
63
|
+
|
|
64
|
+
/** Set to true to hide the axis ticks. */
|
|
65
|
+
hideTicks?: boolean;
|
|
66
|
+
|
|
67
|
+
/** Additional CSS style to be applied to the axis line. */
|
|
68
|
+
lineStyle?: Cx.StyleProp;
|
|
69
|
+
|
|
70
|
+
/** Additional CSS style to be applied to the axis ticks. */
|
|
71
|
+
tickStyle?: Cx.StyleProp;
|
|
72
|
+
|
|
73
|
+
/** Additional CSS style to be applied to the axis labels. */
|
|
74
|
+
labelStyle?: Cx.StyleProp;
|
|
75
|
+
|
|
76
|
+
/** Additional CSS class to be applied to the axis line. */
|
|
77
|
+
lineClass?: Cx.ClassProp;
|
|
78
|
+
|
|
79
|
+
/** Additional CSS class to be applied to the axis ticks. */
|
|
80
|
+
tickClass?: Cx.ClassProp;
|
|
81
|
+
|
|
82
|
+
/** Additional CSS class to be applied to the axis labels. */
|
|
83
|
+
labelClass?: Cx.ClassProp;
|
|
84
|
+
|
|
85
|
+
onMeasured?: (info: any, instance: Instance) => void;
|
|
86
|
+
|
|
87
|
+
/** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
|
|
88
|
+
onCreateLabelFormatter?:
|
|
89
|
+
| string
|
|
90
|
+
| ((
|
|
91
|
+
context: any,
|
|
92
|
+
instance: Instance
|
|
93
|
+
) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export class Axis extends BoundedObject {}
|