Skip to content

Commit a779205

Browse files
committed
Support to sort series in legend naturally. (alphabetical reverted)
1 parent 4a56f5c commit a779205

8 files changed

Lines changed: 19 additions & 14 deletions

File tree

CHANGELOG_ION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# plotly.js ION changelog
22

3+
## [1.33.1-ion39] -- 2020-06-04
4+
5+
### Support to sort series in legend naturally. (alphabetical reverted)
6+
7+
38
## [1.33.1-ion38] -- 2020-06-03
49

510
### Support to sort series in legend alphabetically.

dist_ion/plotly-ion.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24748,7 +24748,7 @@ module.exports = {
2474824748
},
2474924749
traceorder: {
2475024750
valType: 'flaglist',
24751-
flags: ['reversed', 'grouped', 'alphabetical'],
24751+
flags: ['reversed', 'grouped', 'natural', 'normal'],
2475224752
extras: ['normal'],
2475324753

2475424754
editType: 'legend',
@@ -25772,13 +25772,13 @@ module.exports = function getLegendData(calcdata, opts) {
2577225772
// needed in repositionLegend
2577325773
opts._lgroupsLength = lgroupsLength;
2577425774

25775-
if (opts.traceorder === "alphabetical") {
25775+
if (opts.traceorder === "natural") {
2577625776
legendData[0].sort((a, b) => {
2577725777
if (a[0] && a[0].label) {
25778-
return a[0].label.localeCompare(b[0].label);
25778+
return a[0].label.localeCompare(b[0].label, undefined, {numeric: true});
2577925779
} else {
2578025780
if (a[0] && a[0].trace && a[0].trace.name) {
25781-
return a[0].trace.name.localeCompare(b[0].trace.name);
25781+
return a[0].trace.name.localeCompare(b[0].trace.name, undefined, {numeric: true});
2578225782
}
2578325783
}
2578425784
});
@@ -32823,7 +32823,7 @@ exports.svgAttrs = {
3282332823
var Plotly = require('./plotly');
3282432824

3282532825
// package version injected by `npm run preprocess`
32826-
exports.version = '1.33.1-ion38';
32826+
exports.version = '1.33.1-ion39';
3282732827

3282832828
// inject promise polyfill
3282932829
require('es6-promise').polyfill();
@@ -54825,7 +54825,7 @@ module.exports = overrideAll({
5482554825
valType: 'color',
5482654826

5482754827
dflt: constants.waterColor,
54828-
54828+
description: 'Sets color of the rivers.'
5482954829
},
5483054830
riverwidth: {
5483154831
valType: 'number',

dist_ion/plotly-ion.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plotly.js",
3-
"version": "1.33.1-ion38",
3+
"version": "1.33.1-ion39",
44
"description": "The open source javascript graphing library that powers plotly",
55
"license": "MIT",
66
"main": "./lib/index.js",

src/assets/geo_assets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ var saneTopojson = require('sane-topojson');
1212

1313

1414
// package version injected by `npm run preprocess`
15-
exports.version = '1.33.1-ion38';exports.topojson = saneTopojson;
15+
exports.version = '1.33.1-ion39';exports.topojson = saneTopojson;

src/components/legend/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
},
4949
traceorder: {
5050
valType: 'flaglist',
51-
flags: ['reversed', 'grouped', 'alphabetical'],
51+
flags: ['reversed', 'grouped', 'natural', 'normal'],
5252
extras: ['normal'],
5353
role: 'style',
5454
editType: 'legend',

src/components/legend/get_legend_data.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ module.exports = function getLegendData(calcdata, opts) {
9898
// needed in repositionLegend
9999
opts._lgroupsLength = lgroupsLength;
100100

101-
if (opts.traceorder === "alphabetical") {
101+
if (opts.traceorder === "natural") {
102102
legendData[0].sort((a, b) => {
103103
if (a[0] && a[0].label) {
104-
return a[0].label.localeCompare(b[0].label);
104+
return a[0].label.localeCompare(b[0].label, undefined, {numeric: true});
105105
} else {
106106
if (a[0] && a[0].trace && a[0].trace.name) {
107-
return a[0].trace.name.localeCompare(b[0].trace.name);
107+
return a[0].trace.name.localeCompare(b[0].trace.name, undefined, {numeric: true});
108108
}
109109
}
110110
});

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var Plotly = require('./plotly');
1616

1717
// package version injected by `npm run preprocess`
18-
exports.version = '1.33.1-ion38';
18+
exports.version = '1.33.1-ion39';
1919

2020
// inject promise polyfill
2121
require('es6-promise').polyfill();

0 commit comments

Comments
 (0)