Skip to content

Commit 0d070b7

Browse files
committed
inherit minor tickwidth and gridwidth from major styles
1 parent 31f86eb commit 0d070b7

23 files changed

+30
-24
lines changed

src/plots/cartesian/layout_attributes.js

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,18 @@ function makeTicklen(minor) {
120120
return obj;
121121
}
122122

123-
var tickwidth = {
124-
valType: 'number',
125-
min: 0,
126-
dflt: 1,
127-
editType: 'ticks',
128-
description: 'Sets the tick width (in px).'
129-
};
123+
function makeTickwidth(minor) {
124+
var obj = {
125+
valType: 'number',
126+
min: 0,
127+
editType: 'ticks',
128+
description: 'Sets the tick width (in px).'
129+
};
130+
131+
if(!minor) obj.dflt = 1;
132+
133+
return obj;
134+
}
130135

131136
var tickcolor = {
132137
valType: 'color',
@@ -142,13 +147,18 @@ var gridcolor = {
142147
description: 'Sets the color of the grid lines.'
143148
};
144149

145-
var gridwidth = {
146-
valType: 'number',
147-
min: 0,
148-
dflt: 1,
149-
editType: 'ticks',
150-
description: 'Sets the width (in px) of the grid lines.'
151-
};
150+
function makeGridwidth(minor) {
151+
var obj = {
152+
valType: 'number',
153+
min: 0,
154+
editType: 'ticks',
155+
description: 'Sets the width (in px) of the grid lines.'
156+
};
157+
158+
if(!minor) obj.dflt = 1;
159+
160+
return obj;
161+
}
152162

153163
var griddash = extendFlat({}, dash, {editType: 'ticks'});
154164

@@ -604,7 +614,7 @@ module.exports = {
604614
].join(' ')
605615
},
606616
ticklen: makeTicklen(),
607-
tickwidth: tickwidth,
617+
tickwidth: makeTickwidth(),
608618
tickcolor: tickcolor,
609619
showticklabels: {
610620
valType: 'boolean',
@@ -827,7 +837,7 @@ module.exports = {
827837
},
828838
showgrid: showgrid,
829839
gridcolor: gridcolor,
830-
gridwidth: gridwidth,
840+
gridwidth: makeGridwidth(),
831841
griddash: griddash,
832842

833843
zeroline: {
@@ -940,11 +950,11 @@ module.exports = {
940950
tickvals: tickvals,
941951
ticks: ticks,
942952
ticklen: makeTicklen('minor'),
943-
tickwidth: tickwidth,
953+
tickwidth: makeTickwidth('minor'),
944954
tickcolor: tickcolor,
945955

946956
gridcolor: gridcolor,
947-
gridwidth: gridwidth,
957+
gridwidth: makeGridwidth('minor'),
948958
griddash: griddash,
949959
showgrid: showgrid,
950960

src/plots/cartesian/line_grid_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module.exports = function handleLineGridDefaults(containerIn, containerOut, coer
5151
if(opts.hasMinor) {
5252
var minorGridColorDflt = colorMix(containerOut.gridcolor, opts.bgColor).toRgbString();
5353
var minorGridColor = coerce2('minor.gridcolor', minorGridColorDflt);
54-
var minorGridWidth = coerce2('minor.gridwidth', (containerOut.gridwidth || 3) * 2 / 3);
54+
var minorGridWidth = coerce2('minor.gridwidth', containerOut.gridwidth || 1);
5555
var minorGridDash = coerce2('minor.griddash', containerOut.griddash || 'solid');
5656
var minorShowGridLines = coerce('minor.showgrid',
5757
!!minorGridColor ||

src/plots/cartesian/tick_mark_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function handleTickMarkDefaults(containerIn, containerOut, coer
1616
var prefix = isMinor ? 'minor.' : '';
1717

1818
var tickLen = Lib.coerce2(cIn, cOut, lAttr, 'ticklen', isMinor ? ((containerOut.ticklen || 5) * 0.6) : undefined);
19-
var tickWidth = Lib.coerce2(cIn, cOut, lAttr, 'tickwidth', isMinor ? (containerOut.tickwidth || 3) * 2 / 3 : undefined);
19+
var tickWidth = Lib.coerce2(cIn, cOut, lAttr, 'tickwidth', isMinor ? (containerOut.tickwidth || 1) : undefined);
2020
var tickColor = Lib.coerce2(cIn, cOut, lAttr, 'tickcolor', (isMinor ? containerOut.tickcolor : undefined) || cOut.color);
2121
var showTicks = coerce(prefix + 'ticks', (
2222
(!isMinor && options.outerTicks) || tickLen || tickWidth || tickColor

test/image/baselines/11.png

-477 Bytes
Loading

test/image/baselines/14.png

-785 Bytes
Loading

test/image/baselines/15.png

-21 Bytes
Loading

test/image/baselines/17.png

171 Bytes
Loading

test/image/baselines/19.png

-648 Bytes
Loading

test/image/baselines/28.png

-209 Bytes
Loading

test/image/baselines/32.png

-97 Bytes
Loading

0 commit comments

Comments
 (0)