Skip to content

Commit 19a48a7

Browse files
committed
Fix - use axis color when drawing grids lines (#150)
1 parent dc8ee06 commit 19a48a7

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

scripts/JSRootPainter.v6.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,8 +1248,7 @@
12481248
var pad = this.root_pad(),
12491249
h = this.frame_height(),
12501250
w = this.frame_width(),
1251-
grid, grid_style = JSROOT.gStyle.fGridStyle,
1252-
grid_color = (JSROOT.gStyle.fGridColor > 0) ? this.get_color(JSROOT.gStyle.fGridColor) : "black";
1251+
grid, grid_style = JSROOT.gStyle.fGridStyle;
12531252

12541253
if ((grid_style < 0) || (grid_style >= JSROOT.Painter.root_line_styles.length)) grid_style = 11;
12551254

@@ -1262,12 +1261,15 @@
12621261
else
12631262
grid += "M"+this.x_handle.ticks[n]+",0v"+h;
12641263

1264+
var colid = (JSROOT.gStyle.fGridColor > 0) ? JSROOT.gStyle.fGridColor : (this.GetAxis("x") ? this.GetAxis("x").fAxisColor : 1),
1265+
grid_color = this.get_color(colid) || "black";
1266+
12651267
if (grid.length > 0)
1266-
layer.append("svg:path")
1267-
.attr("class", "xgrid")
1268-
.attr("d", grid)
1269-
.style('stroke',grid_color).style("stroke-width",JSROOT.gStyle.fGridWidth)
1270-
.style("stroke-dasharray", JSROOT.Painter.root_line_styles[grid_style]);
1268+
layer.append("svg:path")
1269+
.attr("class", "xgrid")
1270+
.attr("d", grid)
1271+
.style('stroke',grid_color).style("stroke-width",JSROOT.gStyle.fGridWidth)
1272+
.style("stroke-dasharray", JSROOT.Painter.root_line_styles[grid_style]);
12711273
}
12721274

12731275
// add a grid on y axis, if the option is set
@@ -1279,12 +1281,15 @@
12791281
else
12801282
grid += "M0,"+this.y_handle.ticks[n]+"h"+w;
12811283

1284+
var colid = (JSROOT.gStyle.fGridColor > 0) ? JSROOT.gStyle.fGridColor : (this.GetAxis("y") ? this.GetAxis("y").fAxisColor : 1),
1285+
grid_color = this.get_color(colid) || "black";
1286+
12821287
if (grid.length > 0)
1283-
layer.append("svg:path")
1284-
.attr("class", "ygrid")
1285-
.attr("d", grid)
1286-
.style('stroke',grid_color).style("stroke-width",JSROOT.gStyle.fGridWidth)
1287-
.style("stroke-dasharray", JSROOT.Painter.root_line_styles[grid_style]);
1288+
layer.append("svg:path")
1289+
.attr("class", "ygrid")
1290+
.attr("d", grid)
1291+
.style('stroke',grid_color).style("stroke-width",JSROOT.gStyle.fGridWidth)
1292+
.style("stroke-dasharray", JSROOT.Painter.root_line_styles[grid_style]);
12881293
}
12891294
}
12901295

0 commit comments

Comments
 (0)