Skip to content

Commit ddc97b4

Browse files
Sankey: remove deprecated Node title (DevExpress#30106)
1 parent 55c2f23 commit ddc97b4

File tree

7 files changed

+18
-29
lines changed

7 files changed

+18
-29
lines changed

packages/devextreme/js/__internal/viz/core/themes/generic/light/sankey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export default {
2929
width: 2,
3030
color: WHITE,
3131
},
32-
customizeText(info: { title: string }): string {
33-
return info.title;
32+
customizeText(info: { label: string }): string {
33+
return info.label;
3434
},
3535
shadow: {
3636
opacity: 0.2,

packages/devextreme/js/viz/sankey.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,6 @@ export interface dxSankeyNode {
748748
* @public
749749
*/
750750
showTooltip(): void;
751-
/**
752-
* @docid
753-
* @deprecated dxSankeyNode.label
754-
* @public
755-
*/
756-
title?: string;
757751
}
758752

759753
/** @public */

packages/devextreme/js/viz/sankey/node_item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function Node(widget, params) {
5858
that.color = params.color;
5959
that.options = params.options;
6060
that.rect = params.rect;
61-
that.label = that.title = params.rect._name;
61+
that.label = params.rect._name;
6262
that.coords = {
6363
x: params.rect.x + params.rect.width / 2 + widgetOffset.left,
6464
y: params.rect.y + params.rect.height / 2 + widgetOffset.top

packages/devextreme/testing/tests/DevExpress.viz.sankey/sankey.base.tests.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ QUnit.test('Returning correct nodes[].linksIn and nodes[].linksOut data in getAl
468468

469469
assert.equal(nodes.length, 5);
470470
['A', 'B', 'C', 'M', 'Y'].forEach(function(nodeName) {
471-
const node = find(nodes, function(node) { return node.title === nodeName; });
471+
const node = find(nodes, function(node) { return node.label === nodeName; });
472472
assert.equal(node.linksIn.length, expected[nodeName][0]);
473473
assert.equal(node.linksOut.length, expected[nodeName][1]);
474474
});
@@ -630,7 +630,7 @@ QUnit.test('Largest cascade occupies full chart height', function(assert) {
630630
let cascadeHeight = 0;
631631

632632
['A', 'B', 'C'].forEach(function(nodeName) {
633-
const node = find(nodes, function(node) { return node.title === nodeName; });
633+
const node = find(nodes, function(node) { return node.label === nodeName; });
634634
cascadeHeight += node.rect.height + (nodeName !== 'C' ? 30 : 0);
635635
});
636636

@@ -645,7 +645,7 @@ QUnit.test('Default align option', function(assert) {
645645
const nodes = sankey.getAllNodes();
646646

647647
['M', 'Y'].forEach(function(nodeName) {
648-
const node = find(nodes, function(node) { return node.title === nodeName; });
648+
const node = find(nodes, function(node) { return node.label === nodeName; });
649649
assert.equal(node.rect.y + node.rect.height / 2, size.height / 2, nodeName + ' aligned to middle');
650650
});
651651
});
@@ -659,7 +659,7 @@ QUnit.test('Align option as <String>', function(assert) {
659659
const nodes = sankey.getAllNodes();
660660

661661
['C', 'M', 'Y'].forEach(function(nodeName) {
662-
const node = find(nodes, function(node) { return node.title === nodeName; });
662+
const node = find(nodes, function(node) { return node.label === nodeName; });
663663
assert.equal(node.rect.y + node.rect.height, size.height, nodeName + ' aligned to bottom');
664664
});
665665
});
@@ -672,7 +672,7 @@ QUnit.test('Align option as <Array>', function(assert) {
672672
const nodes = sankey.getAllNodes();
673673

674674
['A', 'M', 'Y'].forEach(function(nodeName) {
675-
const node = find(nodes, function(node) { return node.title === nodeName; });
675+
const node = find(nodes, function(node) { return node.label === nodeName; });
676676
assert.equal(node.rect.y, 0, nodeName + ' aligned to top');
677677
});
678678

@@ -687,7 +687,7 @@ QUnit.test('Default alignment value for cascade which is not mentioned in option
687687
alignment: ['top']
688688
});
689689
const nodes = sankey.getAllNodes();
690-
const node = find(nodes, function(node) { return node.title === 'Z'; });
690+
const node = find(nodes, function(node) { return node.label === 'Z'; });
691691

692692
// 'Z' is expected to be centered
693693
assert.equal(node.rect.y, 15, 'Z aligned to center');
@@ -786,8 +786,8 @@ QUnit.test('SortData option', function(assert) {
786786
sankey.option({ sortData: { A: 2, B: 1 } });
787787
const nodesSorted = sankey.getAllNodes();
788788

789-
assert.equal(nodesSorted[0].title, 'B');
790-
assert.equal(nodesSorted[1].title, 'A');
789+
assert.equal(nodesSorted[0].label, 'B');
790+
assert.equal(nodesSorted[1].label, 'A');
791791
});
792792

793793
QUnit.test('Align option updated as <String>', function(assert) {
@@ -801,7 +801,7 @@ QUnit.test('Align option updated as <String>', function(assert) {
801801
const nodes = sankey.getAllNodes();
802802

803803
['C', 'M', 'Y'].forEach(function(nodeName) {
804-
const node = find(nodes, function(node) { return node.title === nodeName; });
804+
const node = find(nodes, function(node) { return node.label === nodeName; });
805805
assert.equal(node.rect.y + node.rect.height, size.height, 'aligned to bottom');
806806
});
807807
});
@@ -816,7 +816,7 @@ QUnit.test('Align option updated as <Array>', function(assert) {
816816
const nodes = sankey.getAllNodes();
817817

818818
['A', 'M', 'Y'].forEach(function(nodeName) {
819-
const node = find(nodes, function(node) { return node.title === nodeName; });
819+
const node = find(nodes, function(node) { return node.label === nodeName; });
820820
assert.equal(node.rect.y, 0, 'aligned to top');
821821
});
822822
});

packages/devextreme/testing/tests/DevExpress.viz.sankey/sankey.items.node.tests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ QUnit.test('Creation', function(assert) {
2424
});
2525
const nodes = sankey.getAllNodes();
2626

27-
assert.equal(nodes[0].title, 'A');
27+
assert.equal(nodes[0].label, 'A');
2828
assert.equal(nodes[0].linksIn.length, 0);
2929
assert.equal(nodes[0].linksOut.length, 1);
3030
assert.equal(nodes[0].linksOut[0].weight, 1);
3131
assert.equal(nodes[0].linksOut[0].node, 'Z');
3232

33-
assert.equal(nodes[1].title, 'B');
33+
assert.equal(nodes[1].label, 'B');
3434
assert.equal(nodes[1].linksIn.length, 0);
3535
assert.equal(nodes[1].linksOut.length, 1);
3636
assert.equal(nodes[1].linksOut[0].weight, 1);
3737
assert.equal(nodes[1].linksOut[0].node, 'Z');
3838

39-
assert.equal(nodes[2].title, 'Z');
39+
assert.equal(nodes[2].label, 'Z');
4040
assert.equal(nodes[2].linksIn.length, 2);
4141
assert.equal(nodes[2].linksIn[0].weight, 1);
4242
assert.equal(nodes[2].linksIn[0].node, 'A');
@@ -53,7 +53,7 @@ QUnit.test('Passing nodes[].rect coordinates to SVG', function(assert) {
5353
const nodesSVG = this.nodes();
5454

5555
['A', 'B', 'Z'].forEach(function(nodeName) {
56-
const nodeItem = find(nodes, function(n) { return n.title === nodeName; });
56+
const nodeItem = find(nodes, function(n) { return n.label === nodeName; });
5757
const nodeSVG = find(nodesSVG, function(node) { return node.attr.firstCall.args[0]._name === nodeName; });
5858
assert.deepEqual(nodeSVG.attr.firstCall.args[0], nodeItem.rect, 'Node ' + nodeName + ': rectangles match');
5959
});

packages/devextreme/testing/tests/DevExpress.viz.sankey/sankey.label.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ QUnit.test('Label color if useNodeColors set to true', function(assert) {
149149
QUnit.test('Labels customize text', function(assert) {
150150

151151
const customizeText = function(node) {
152-
return 'test text ' + node.title;
152+
return 'test text ' + node.label;
153153
};
154154

155155
createSankey({

packages/devextreme/ts/dx.all.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43601,11 +43601,6 @@ declare module DevExpress.viz {
4360143601
* [descr:dxSankeyNode.showTooltip()]
4360243602
*/
4360343603
showTooltip(): void;
43604-
/**
43605-
* [descr:dxSankeyNode.title]
43606-
* @deprecated [depNote:dxSankeyNode.title]
43607-
*/
43608-
title?: string;
4360943604
}
4361043605
/**
4361143606
* [descr:dxSankeyOptions]

0 commit comments

Comments
 (0)