Skip to content

Commit a8b1382

Browse files
committed
minorloglabels
1 parent 0faf4d3 commit a8b1382

File tree

5 files changed

+64
-54
lines changed

5 files changed

+64
-54
lines changed

src/plots/cartesian/axes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,11 @@ function formatLog(ax, out, hover, extraPrecision, hideexp) {
19181918
}
19191919
}
19201920
} else if(dtChar0 === 'D') {
1921-
out.text = String(Math.round(Math.pow(10, Lib.mod(x, 1))));
1921+
out.text =
1922+
ax.minorloglabels === 'show exp' ? Math.pow(10, x).toExponential(0) :
1923+
ax.minorloglabels === 'full value' ? Lib.numberFormat('0.1s')(Math.pow(10, x)) :
1924+
/* ax.minorloglabels === 'small digits' */ String(Math.round(Math.pow(10, Lib.mod(x, 1))));
1925+
19221926
out.fontSize *= 0.75;
19231927
} else throw 'unrecognized dtick ' + String(dtick);
19241928

@@ -3770,7 +3774,7 @@ axes.drawLabels = function(gd, ax, opts) {
37703774

37713775
var sel;
37723776
if(e.K === ZERO_PATH.K) {
3773-
var zerolineLayer = zerolineIsAbove ? mainPlotinfo.zerolinelayerAbove : mainPlotinfo.zerolinelayer;
3777+
var zerolineLayer = zerolineIsAbove ? mainPlotinfo.zerolinelayerAbove : mainPlotinfo.zerolinelayer;
37743778
sel = zerolineLayer.selectAll('.' + ax._id + 'zl');
37753779
} else if(e.K === MINORGRID_PATH.K) sel = mainPlotinfo.minorGridlayer.selectAll('.' + ax._id);
37763780
else if(e.K === GRID_PATH.K) sel = mainPlotinfo.gridlayer.selectAll('.' + ax._id);

src/plots/cartesian/layout_attributes.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -768,17 +768,6 @@ module.exports = {
768768
'and values (if desired) can include html-like tags or MathJax.'
769769
].join(' ')
770770
},
771-
loglabels: {
772-
valType: 'enumerated',
773-
values: ['small digits', 'full value'],
774-
dflt: 'small digits',
775-
editType: 'calc',
776-
description: [
777-
'Determines how minor log labels are displayed.',
778-
'If *small digits*, small digits are displayed for minor ticks.',
779-
'If *full value*, full values are displayed for minor ticks.',
780-
].join(' ')
781-
},
782771
automargin: {
783772
valType: 'flaglist',
784773
flags: ['height', 'width', 'left', 'right', 'top', 'bottom'],
@@ -1147,6 +1136,19 @@ module.exports = {
11471136
editType: 'ticks'
11481137
},
11491138

1139+
minorloglabels: {
1140+
valType: 'enumerated',
1141+
values: ['small digits', 'show exp', 'full value'],
1142+
dflt: 'small digits',
1143+
editType: 'calc',
1144+
description: [
1145+
'Determines how minor log labels are displayed.',
1146+
'If *small digits*, small digits are displayed.',
1147+
'If *show exp*, scientific notation is applied.',
1148+
'If *full value*, full values are displayed.',
1149+
].join(' ')
1150+
},
1151+
11501152
layer: {
11511153
valType: 'enumerated',
11521154
values: ['above traces', 'below traces'],

src/plots/cartesian/tick_label_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
7272
}
7373

7474
if(!options.noLoglabels && axType === 'log') {
75-
coerce('loglabels');
75+
coerce('minorloglabels');
7676
}
7777
}
7878
};

src/plots/polar/layout_attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var axisTickAttrs = overrideAll({
3636
ticklabelstep: axesAttrs.ticklabelstep,
3737
showticklabels: axesAttrs.showticklabels,
3838
labelalias: axesAttrs.labelalias,
39-
loglabels: axesAttrs.loglabels,
39+
minorloglabels: axesAttrs.minorloglabels,
4040
showtickprefix: axesAttrs.showtickprefix,
4141
tickprefix: axesAttrs.tickprefix,
4242
showticksuffix: axesAttrs.showticksuffix,

test/plot-schema.json

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5188,23 +5188,24 @@
51885188
"min": 0,
51895189
"valType": "number"
51905190
},
5191-
"loglabels": {
5192-
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed for minor ticks. If *full value*, full values are displayed for minor ticks.",
5191+
"minexponent": {
5192+
"description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*.",
5193+
"dflt": 3,
5194+
"editType": "plot",
5195+
"min": 0,
5196+
"valType": "number"
5197+
},
5198+
"minorloglabels": {
5199+
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed. If *show exp*, scientific notation is applied. If *full value*, full values are displayed.",
51935200
"dflt": "small digits",
51945201
"editType": "plot",
51955202
"valType": "enumerated",
51965203
"values": [
51975204
"small digits",
5205+
"show exp",
51985206
"full value"
51995207
]
52005208
},
5201-
"minexponent": {
5202-
"description": "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*.",
5203-
"dflt": 3,
5204-
"editType": "plot",
5205-
"min": 0,
5206-
"valType": "number"
5207-
},
52085209
"nticks": {
52095210
"description": "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.",
52105211
"dflt": 0,
@@ -5879,16 +5880,6 @@
58795880
"min": 0,
58805881
"valType": "number"
58815882
},
5882-
"loglabels": {
5883-
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed for minor ticks. If *full value*, full values are displayed for minor ticks.",
5884-
"dflt": "small digits",
5885-
"editType": "plot",
5886-
"valType": "enumerated",
5887-
"values": [
5888-
"small digits",
5889-
"full value"
5890-
]
5891-
},
58925883
"maxallowed": {
58935884
"description": "Determines the maximum range of this axis.",
58945885
"editType": "plot",
@@ -5912,6 +5903,17 @@
59125903
"min": 0,
59135904
"valType": "number"
59145905
},
5906+
"minorloglabels": {
5907+
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed. If *show exp*, scientific notation is applied. If *full value*, full values are displayed.",
5908+
"dflt": "small digits",
5909+
"editType": "plot",
5910+
"valType": "enumerated",
5911+
"values": [
5912+
"small digits",
5913+
"show exp",
5914+
"full value"
5915+
]
5916+
},
59155917
"nticks": {
59165918
"description": "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.",
59175919
"dflt": 0,
@@ -13786,16 +13788,6 @@
1378613788
"min": 0,
1378713789
"valType": "number"
1378813790
},
13789-
"loglabels": {
13790-
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed for minor ticks. If *full value*, full values are displayed for minor ticks.",
13791-
"dflt": "small digits",
13792-
"editType": "calc",
13793-
"valType": "enumerated",
13794-
"values": [
13795-
"small digits",
13796-
"full value"
13797-
]
13798-
},
1379913791
"matches": {
1380013792
"description": "If set to another axis id (e.g. `x2`, `y`), the range of this axis will match the range of the corresponding axis in data-coordinates space. Moreover, matching axes share auto-range values, category lists and histogram auto-bins. Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint is currently forbidden. Moreover, note that matching axes must have the same `type`.",
1380113793
"editType": "calc",
@@ -13935,6 +13927,17 @@
1393513927
"valType": "number"
1393613928
}
1393713929
},
13930+
"minorloglabels": {
13931+
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed. If *show exp*, scientific notation is applied. If *full value*, full values are displayed.",
13932+
"dflt": "small digits",
13933+
"editType": "calc",
13934+
"valType": "enumerated",
13935+
"values": [
13936+
"small digits",
13937+
"show exp",
13938+
"full value"
13939+
]
13940+
},
1393813941
"mirror": {
1393913942
"description": "Determines if the axis lines or/and ticks are mirrored to the opposite side of the plotting area. If *true*, the axis lines are mirrored. If *ticks*, the axis lines and ticks are mirrored. If *false*, mirroring is disable. If *all*, axis lines are mirrored on all shared-axes subplots. If *allticks*, axis lines and ticks are mirrored on all shared-axes subplots.",
1394013943
"dflt": false,
@@ -15357,16 +15360,6 @@
1535715360
"min": 0,
1535815361
"valType": "number"
1535915362
},
15360-
"loglabels": {
15361-
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed for minor ticks. If *full value*, full values are displayed for minor ticks.",
15362-
"dflt": "small digits",
15363-
"editType": "calc",
15364-
"valType": "enumerated",
15365-
"values": [
15366-
"small digits",
15367-
"full value"
15368-
]
15369-
},
1537015363
"matches": {
1537115364
"description": "If set to another axis id (e.g. `x2`, `y`), the range of this axis will match the range of the corresponding axis in data-coordinates space. Moreover, matching axes share auto-range values, category lists and histogram auto-bins. Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint is currently forbidden. Moreover, note that matching axes must have the same `type`.",
1537215365
"editType": "calc",
@@ -15506,6 +15499,17 @@
1550615499
"valType": "number"
1550715500
}
1550815501
},
15502+
"minorloglabels": {
15503+
"description": "Determines how minor log labels are displayed. If *small digits*, small digits are displayed. If *show exp*, scientific notation is applied. If *full value*, full values are displayed.",
15504+
"dflt": "small digits",
15505+
"editType": "calc",
15506+
"valType": "enumerated",
15507+
"values": [
15508+
"small digits",
15509+
"show exp",
15510+
"full value"
15511+
]
15512+
},
1550915513
"mirror": {
1551015514
"description": "Determines if the axis lines or/and ticks are mirrored to the opposite side of the plotting area. If *true*, the axis lines are mirrored. If *ticks*, the axis lines and ticks are mirrored. If *false*, mirroring is disable. If *all*, axis lines are mirrored on all shared-axes subplots. If *allticks*, axis lines and ticks are mirrored on all shared-axes subplots.",
1551115515
"dflt": false,

0 commit comments

Comments
 (0)