BigRed1212
Technical User
Hello,
I have these includes:
followed by this function:
This works great and draws a nice pie graph that I want.
is where it is from.
As you can see from the ASP inserted above, I was playing around with using ASP to dynamically write the values that make the size of the pie slices.
What I want to do is put this function on an ASP page that would return data when hit with an AJAX call. (There would other stuff and the data for the graph would come in from a database query.)
My problem is that I don't know how to make the function fire and draw the graph after it is returned by the AJAX request. Obviously onload isn't going to do it. I don't know how to name and call it another way so that it will fire.
I thought about posting this in the AJAX room/forum, but I think this one is higher traffic so I posted here.
Guidance?
I have these includes:
Code:
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.raphael.js" type="text/javascript" charset="utf-8"></script>
<script src="g.pie.js" type="text/javascript" charset="utf-8"></script>
followed by this function:
Code:
<script type="text/javascript" charset="utf-8">
window.onload = function () {
var r = Raphael("holder");
r.g.txtattr.font = "12px Tahoma, Arial, Helvetica, sans-serif";
r.g.text(125, 30, "Racial/Ethnic Percentages").attr({"font-size": 12});
var pie = r.g.piechart(225, 120, 75, [<%=a%>, <%=b%>, <%=c%>, <%=d%>, <%=e%>, <%=f%>], {legend: ["%%.% – White", "%%.% - Black", "%%.% - Hispanic", "%%.% - Asian", "%%.% - Native Amer.", "%%.% - Multi"], legendpos: "west", href: ["[URL unfurl="true"]http://raphaeljs.com",[/URL] "[URL unfurl="true"]http://g.raphaeljs.com"[/URL]]});
pie.hover(function () {
this.sector.stop();
this.sector.scale(1.1, 1.1, this.cx, this.cy);
if (this.label) {
this.label[0].stop();
this.label[0].scale(1.5);
this.label[1].attr({"font-weight": 800});
}
}, function () {
this.sector.animate({scale: [1, 1, this.cx, this.cy]}, 500, "bounce");
if (this.label) {
this.label[0].animate({scale: 1}, 500, "bounce");
this.label[1].attr({"font-weight": 400});
}
});
};
</script>
is where it is from.
As you can see from the ASP inserted above, I was playing around with using ASP to dynamically write the values that make the size of the pie slices.
What I want to do is put this function on an ASP page that would return data when hit with an AJAX call. (There would other stuff and the data for the graph would come in from a database query.)
My problem is that I don't know how to make the function fire and draw the graph after it is returned by the AJAX request. Obviously onload isn't going to do it. I don't know how to name and call it another way so that it will fire.
I thought about posting this in the AJAX room/forum, but I think this one is higher traffic so I posted here.
Guidance?