I am making a dynamic map, with AngularJS and RaphaelJS.
My whole SVG object is created into a directive ; and I would like to give colors to each area of the map.
For some regions, I would like to do stripes ; and I have been looking for long how to do, it looks like :
background-color: orange;
background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,1) 5px, rgba(0,0,0,1) 10px);
I would also make this pattern change on hover (black and red stripes), and to come back to black and orange stripes on mouse out.
However I realized that there is no equivalent of "repeating-linear-gradient" in RaphaelJS (right ?) and I don't really know how to do.
I am at least trying to do it with gradients, but it's not working (the result with on mouse over is not the one expected. Why ?)
here is my code into the directive :
var paper = new Raphael(element[0], 600, 600);
var attr = {
fill: "#f5f5f5",
stroke: "#222",
"stroke-width": 1,
"stroke-linejoin": "round"
};
var fr = {};
fr.area1 = paper.path("...").attr(attr).attr({href: "#"});
fr.area1 = paper.path("...").attr(attr).attr({href: "#"});
fr.area1 = paper.path("...").attr(attr).attr({href: "#"});
[...]
var state = area 3;
attr = {
fill: '45-' + color1 + '-' + color2,
stroke: "#222"};
fr[state].attr(attr);
(function(state) {
var area = fr[state];
area[0].style.cursor = "pointer";
area[0].onmouseover = function() {
area.animate({
fill: '45-' + color3 + '-' + color2,
stroke: "#222"
}, 10);
area.toFront();
};
area[0].onmouseout = function() {
area.animate({
fill: '45-' + color1 + '-' + color2,
stroke: "#222"
}, 300);
area.toFront();
};
})(state);
Thank you,