Skip to content

Commit 3c5ed7c

Browse files
author
Andrey
committed
add knockout bindings for markers
1 parent 4ad76ba commit 3c5ed7c

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/idd/idd.ko.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ if(ko) { //add Knockout bindings. Requires that IDD loaded after Knockout
3737
var strokeBinding = allBindings.get('iddStroke');
3838
stroke = ko.unwrap(strokeBinding);
3939
}
40+
var shape = undefined;
41+
if (allBindings.has('iddShape')) {
42+
var shapeBinding = allBindings.get('iddShape');
43+
shape = ko.unwrap(shapeBinding);
44+
}
45+
var color = undefined;
46+
if (allBindings.has('iddColor')) {
47+
var colorBinding = allBindings.get('iddColor');
48+
color = ko.unwrap(colorBinding);
49+
}
4050
var unwrappedX = ko.unwrap(xBindings);
4151
var plotAttr = element.getAttribute("data-idd-plot");
4252
if (plotAttr != null) {
@@ -56,10 +66,10 @@ if(ko) { //add Knockout bindings. Requires that IDD loaded after Knockout
5666
}
5767
element.innerHTML = csvDataToDraw;
5868

59-
if (typeof stroke != 'undefined') {
6069
//saving stroke color in the data-idd-style attribute: will be picked up by initialization
61-
element.setAttribute("data-idd-style", "stroke: " + stroke + "; thickness: " + lineThickness);
62-
}
70+
element.setAttribute("data-idd-style", (stroke ? "stroke: " + stroke + "; thickness: " + lineThickness + ";": "") +
71+
(shape ? "shape: " + shape + ";" : "") +
72+
(color ? "color: " + color + ";" : ""));
6373
}
6474
}
6575
}

0 commit comments

Comments
 (0)