|
972 | 972 |
|
973 | 973 | JSROOT.TObjectPainter.prototype.createFillPattern = function(attfill, pattern, color) { |
974 | 974 |
|
975 | | - if (pattern == null) pattern = attfill['fFillStyle']; |
976 | | - if (color == null) color = attfill['fFillColor']; |
| 975 | + if ((pattern==null) && attfill) pattern = attfill['fFillStyle']; |
| 976 | + if ((color==null) && attfill) color = attfill['fFillColor']; |
977 | 977 |
|
978 | 978 | var fill = { color: "none" }; |
979 | 979 | fill.SetFill = function(selection) { |
|
983 | 983 | } |
984 | 984 | fill.func = fill.SetFill.bind(fill); |
985 | 985 |
|
986 | | - if ((pattern == 0) || ((pattern >= 4000) && (pattern <= 4100))) return fill; |
987 | | - |
988 | | - fill.color = JSROOT.Painter.root_colors[color]; |
| 986 | + if (typeof attfill == 'string') { |
| 987 | + fill.color = attfill; |
| 988 | + return fill; |
| 989 | + } |
| 990 | + |
| 991 | + |
| 992 | + if ((pattern == 0) || (color==0) || ((pattern >= 4000) && (pattern <= 4100))) return fill; |
989 | 993 |
|
990 | 994 | var svg = this.svg_canvas(true); |
991 | 995 |
|
992 | | - if ((pattern < 3000) || (pattern>3025) || svg.empty()) return fill; |
| 996 | + if ((pattern < 3000) || (pattern>3025) || svg.empty()) { |
| 997 | + fill.color = JSROOT.Painter.root_colors[color]; |
| 998 | + return fill; |
| 999 | + } |
993 | 1000 |
|
994 | 1001 | var id = "pat_" + pattern + "_" + color; |
995 | 1002 |
|
|
1363 | 1370 | h -= (tm + bm); |
1364 | 1371 | } |
1365 | 1372 | if (framecolor == null) |
1366 | | - framecolor = this.createFillPattern(null, 1, 0); |
| 1373 | + framecolor = this.createFillPattern('white'); |
1367 | 1374 |
|
1368 | 1375 | // this is svg:g object - container for every other items belonging to frame |
1369 | 1376 | var frame_g = this.svg_pad(true).select(".root_frame"); |
|
2662 | 2669 | if (this.pad && 'fFillColor' in this.pad) |
2663 | 2670 | fill = this.createFillPattern(this.pad); |
2664 | 2671 | else |
2665 | | - fill = this.createFillPattern(null, 1, 0); |
| 2672 | + fill = this.createFillPattern('white'); |
2666 | 2673 |
|
2667 | 2674 | render_to.css("background-color", fill.color); |
2668 | 2675 |
|
|
2699 | 2706 | var h = Math.round(this.pad['fAbsHNDC'] * height); |
2700 | 2707 | y -= h; |
2701 | 2708 |
|
2702 | | - var fillcolor = JSROOT.Painter.root_colors[this.pad['fFillColor']]; |
2703 | | - if (this.pad['fFillStyle'] > 4000 && this.pad['fFillStyle'] < 4100) |
2704 | | - fillcolor = 'none'; |
| 2709 | + var fill = this.createFillPattern(this.pad); |
2705 | 2710 |
|
2706 | 2711 | var border_width = this.pad['fLineWidth']; |
2707 | 2712 | var border_color = JSROOT.Painter.root_colors[this.pad['fLineColor']]; |
|
2736 | 2741 | .attr("y", 0) |
2737 | 2742 | .attr("width", w) |
2738 | 2743 | .attr("height", h) |
2739 | | - .attr("fill", fillcolor) |
| 2744 | + .call(fill.func) |
2740 | 2745 | .style("stroke-width", border_width) |
2741 | 2746 | .style("stroke", border_color); |
2742 | 2747 | } |
|
5078 | 5083 |
|
5079 | 5084 | var draw_bins = this.CreateDrawBins(width, height); |
5080 | 5085 |
|
5081 | | - if (this.fill.color!='none') { |
| 5086 | + if (this.fill.color != 'none') { |
5082 | 5087 |
|
5083 | 5088 | // histogram filling |
5084 | 5089 | var area = d3.svg.area() |
|
6095 | 6100 | h = (pave['fY2NDC'] - pave['fY1NDC']) * Number(svg.attr("height")); |
6096 | 6101 | } |
6097 | 6102 | y -= h; |
6098 | | - var fillcolor = JSROOT.Painter.root_colors[pave['fFillColor']]; |
6099 | 6103 | var lcolor = JSROOT.Painter.root_colors[pave['fLineColor']]; |
6100 | 6104 | var lwidth = pave['fBorderSize'] ? pave['fBorderSize'] : 0; |
6101 | | - if (pave['fFillStyle'] > 4000 && pave['fFillStyle'] < 4100) |
6102 | | - fillcolor = 'none'; |
| 6105 | + var fill = this.createFillPattern(pave); |
6103 | 6106 |
|
6104 | 6107 | var p = this.draw_g |
6105 | 6108 | .attr("x", x) |
|
6113 | 6116 | .attr("y", 0) |
6114 | 6117 | .attr("width", w) |
6115 | 6118 | .attr("height", h) |
6116 | | - .attr("fill", fillcolor) |
| 6119 | + .call(fill.func) |
6117 | 6120 | .style("stroke-width", lwidth ? 1 : 0) |
6118 | 6121 | .style("stroke", lcolor); |
6119 | 6122 |
|
|
0 commit comments