Skip to content

Commit 7e44755

Browse files
committed
added ticktext
1 parent e8aba8c commit 7e44755

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

src/traces/parcoords/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ module.exports = {
6868
description: 'The shown name of the dimension.'
6969
},
7070
tickvals: axesAttrs.tickvals,
71+
ticktext: axesAttrs.ticktext,
7172
visible: {
7273
valType: 'boolean',
7374
dflt: true,

src/traces/parcoords/calc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module.exports = function calc(gd, trace) {
3737
range: vals[i].range,
3838
constraintrange: vals[i].constraintrange,
3939
tickvals: vals[i].tickvals,
40+
ticktext: vals[i].ticktext,
4041
visible: vals[i].visible,
4142
label: vals[i].label,
4243
values: vals[i].values

src/traces/parcoords/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function dimensionsDefaults(traceIn, traceOut) {
4949
coerce('id');
5050
coerce('label');
5151
coerce('tickvals');
52+
coerce('ticktext');
5253
coerce('visible');
5354
coerce('range');
5455
coerce('constraintrange');

src/traces/parcoords/parcoords.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function viewModel(model) {
151151
key: dimension.id || dimension.label,
152152
label: dimension.label,
153153
tickvals: dimension.tickvals || false,
154+
ticktext: dimension.ticktext || false,
154155
ordinal: !!dimension.tickvals,
155156
scatter: dimension.scatter,
156157
xIndex: i,
@@ -379,14 +380,17 @@ module.exports = function(root, styledData, layout, callbacks) {
379380
var wantedTickCount = d.model.height / d.model.tickDistance;
380381
var scale = d.domainScale;
381382
var dom = scale.domain();
383+
var texts = d.ticktext;
382384
d3.select(this)
383385
.call(d3.svg.axis()
384386
.orient('left')
385387
.tickSize(4)
386388
.outerTickSize(2)
387389
.ticks(wantedTickCount, '3s') // works for continuous scales only...
388390
.tickValues(d.ordinal ? // and this works for ordinal scales
389-
dom.filter(function(d, i) {return !(i % Math.round((dom.length / wantedTickCount)));}) :
391+
dom
392+
.filter(function(d, i) {return !(i % Math.round((dom.length / wantedTickCount)));})
393+
.map(function(d, i) {return texts && texts[i] || d}):
390394
null)
391395
.scale(scale));
392396
});

test/jasmine/tests/parcoords_test.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)