Skip to content

Commit ff5d81b

Browse files
committed
Calculate colorscale properly for histogram
1 parent 86eb77b commit ff5d81b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/traces/histogram/calc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ var isNumeric = require('fast-isnumeric');
55
var Lib = require('../../lib');
66
var Registry = require('../../registry');
77
var Axes = require('../../plots/cartesian/axes');
8+
const { hasColorscale } = require('../../components/colorscale/helpers');
9+
const colorscaleCalc = require('../../components/colorscale/calc');
10+
811

912
var arraysToCalcdata = require('../bar/arrays_to_calcdata');
1013
var binFunctions = require('./bin_functions');
@@ -202,6 +205,22 @@ function calc(gd, trace) {
202205
cd[0].width1 = Axes.tickIncrement(cd[0].p, binSpec.size, false, calendar) - cd[0].p;
203206
}
204207

208+
// auto-z and autocolorscale if applicable
209+
if(hasColorscale(trace, 'marker')) {
210+
colorscaleCalc(gd, trace, {
211+
vals: trace.marker.color,
212+
containerStr: 'marker',
213+
cLetter: 'c'
214+
});
215+
}
216+
if(hasColorscale(trace, 'marker.line')) {
217+
colorscaleCalc(gd, trace, {
218+
vals: trace.marker.line.color,
219+
containerStr: 'marker.line',
220+
cLetter: 'c'
221+
});
222+
}
223+
205224
arraysToCalcdata(cd, trace);
206225

207226
if(Lib.isArrayOrTypedArray(trace.selectedpoints)) {

0 commit comments

Comments
 (0)