Skip to content

Commit

Permalink
fix(line): Fix gradient with dataname starting w/no
Browse files Browse the repository at this point in the history
Correct the selector on checking the gradient definition node element.

Fix #936
  • Loading branch information
netil committed Jun 17, 2019
1 parent 04a4dd8 commit fe31102
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion spec/shape/shape.line-spec.js
Expand Up @@ -501,7 +501,8 @@ describe("SHAPE LINE", () => {
data: {
columns: [
["data1", 230, 280, 251, 400, 150, 546, 158],
["hello there", 230, 280, 251, 400, 150, 546, 158]
["hello there", 230, 280, 251, 400, 150, 546, 158],
["123 test", 130, 220, 120, 129, 410, 100, 440]
],
type: "area",
},
Expand Down
6 changes: 3 additions & 3 deletions src/shape/line.js
Expand Up @@ -348,9 +348,9 @@ extend(ChartInternal.prototype, {
const $$ = this;

$$.data.targets.forEach(d => {
const id = $$.getTargetSelectorSuffix(d.id);
const id = `${$$.datetimeId}-areaGradient${$$.getTargetSelectorSuffix(d.id)}`;

if ($$.isAreaType(d) && $$.defs.select(`[id$=${id}]`).empty()) {
if ($$.isAreaType(d) && $$.defs.select(`#${id}`).empty()) {
const color = $$.color(d);
const {
x = [0, 0],
Expand All @@ -359,7 +359,7 @@ extend(ChartInternal.prototype, {
} = $$.config.area_linearGradient;

const linearGradient = $$.defs.append("linearGradient")
.attr("id", `${$$.datetimeId}-areaGradient${id}`)
.attr("id", `${id}`)
.attr("x1", x[0])
.attr("x2", x[1])
.attr("y1", y[0])
Expand Down

0 comments on commit fe31102

Please sign in to comment.