Skip to content

Commit d1f7873

Browse files
committed
Fix for colors
1 parent 6893820 commit d1f7873

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

inst/html_output/src/ColorScatterPlotly.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ ColorScatter.prototype.setData = function(object)
108108
var marker = {
109109
size: circle_radius
110110
}
111-
if (unique.length > 10) {
112-
var hue = Math.round(i/unique.length * 360);
111+
if (unique.length > 10) { // Use husl if more than 10 categories
112+
var step = 8
113+
var L = Math.ceil(unique.length/step)*step
114+
var hue = Math.round(
115+
( (i*L/step)%L + Math.floor(i/step) ) / L * 360 // Helps scatter values
116+
);
113117
marker['color'] = hsluv.hsluvToHex([hue, 90, 55])
114118
}
115119

0 commit comments

Comments
 (0)