Skip to content

Commit 5d809b6

Browse files
piePattern : rework the index of legend items
- take the index from the point in the styleOne function, instead of setting it before in the data structure - zz-pie_pattern : height 500
1 parent 8cd2c97 commit 5d809b6

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

src/components/drawing/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,20 +619,22 @@ drawing.getPatternAttr = function(mp, i, dflt) {
619619
return mp;
620620
};
621621

622-
drawing.pointStyle = function(s, trace, gd) {
622+
drawing.pointStyle = function(s, trace, gd, pt) {
623623
if(!s.size()) return;
624624

625625
var fns = drawing.makePointStyleFns(trace);
626626

627627
s.each(function(d) {
628-
drawing.singlePointStyle(d, d3.select(this), trace, fns, gd);
628+
drawing.singlePointStyle(d, d3.select(this), trace, fns, gd, pt);
629629
});
630630
};
631631

632-
drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
632+
drawing.singlePointStyle = function(d, sel, trace, fns, gd, pt) {
633633
var marker = trace.marker;
634634
var markerLine = marker.line;
635635

636+
if( pt && pt.i>=0 && d.i === undefined) d.i = pt.i;
637+
636638
sel.style('opacity',
637639
fns.selectedOpacityFn ? fns.selectedOpacityFn(d) :
638640
(d.mo === undefined ? marker.opacity : d.mo)

src/traces/pie/style_one.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,18 @@ module.exports = function styleOne(s, pt, trace, gd) {
99
var lineColor = castOption(line.color, pt.pts) || Color.defaultLine;
1010
var lineWidth = castOption(line.width, pt.pts) || 0;
1111

12-
// some temporary console statements, for later debugging, needs to be removed once the assembler below gets clean
13-
// console.log('styleOne - s0', s[0], s[0][0], '__data__', s[0][0].__data__);
14-
// console.log( 's0 iiiiiiiii pie : ', (s[0][0].__data__.i !== undefined ? s[0][0].__data__.i : 'nope'));
15-
// console.log( 's0 iiiiiiiii legend : ', (s[0][0].__data__[0] !== undefined ? s[0][0].__data__[0].i : 'nope'));
16-
// console.log( 'pie style_one: s', s, 'trace', trace, 'gd', gd);
17-
18-
// to do: rework this assembler code in a next iteration.
19-
var gibberish = s[0][0].__data__;
20-
if(gibberish.i === undefined) {
21-
// coming from a legend
22-
gibberish.i = gibberish[0].i;
23-
}
24-
// console.log( 's0 - i : ', s[0][0].__data__['i'], 'pt.color', pt.color, 'trace', trace);
25-
2612
// enforce the point color, when colors (with s) & the pattern shape are missing.
2713
// 'abuse' the color attribute, used in the Drawing component for bar trace type.
28-
// alternative could be to pass the point color as an extra parameter in pointStyle
14+
// alternative: could be to pass the point color as an extra parameter in pointStyle
15+
// alternative: could be to activate pattern also for funnelarea
2916
var marker = trace.marker;
3017
if(marker.pattern) {
3118
if(!marker.colors || !marker.pattern.shape) marker.color = pt.color;
3219
} else {
3320
marker.color = pt.color;
3421
}
3522

36-
Drawing.pointStyle(s, trace, gd);
23+
Drawing.pointStyle(s, trace, gd, pt);
3724
// to do : push into s.style d3 logic
3825

3926
s.style('stroke-width', lineWidth)
6.43 KB
Loading

0 commit comments

Comments
 (0)