Hello, I was wondering how I could dynamically generate an image via Java/Javascript.

Here is what I need:

There will be a tiny sprite-like image in the middle. What I want is to have a partial circle around the sprite appear. It will have a drop-down with 3 options, each changing the diameter of the circle. Then I want the other input box to accept numbers and that number will decide how complete the circle is, out of 360 Degrees. For instance, if someone typed in 359, then their circle would be almost complete. Does anyone know where to start with this?

Thanks, James

Recommended Answers

All 4 Replies

Thanks for the link. I went with JavaScript Diagram Builder and I am liking it quite a bit. Not the most user friendly, but fairly flexible.

Hello again. I'm having problems with the JS Diagram builder I meantioned earlier.
Here is the JS file that it references: http://www.lutanho.net/diagram/diagram.js

Now here is the diagram code:

<DIV STYLE="position:absolute; top:0"></DIV>
<SCRIPT Language="JavaScript">
var i, x, y, xmin=parent.xmin, xmax=parent.xmax, ymin=parent.ymin, ymax=parent.ymax, rd=parent.rd;
document.open();
var D=new Diagram();
D.SetFrame(60, 45, 460, 445);
D.SetBorder(-200, 200, -200, 200);
D.SetText("Ft.","Ft.", "y=f(x)");
D.Draw("#DDDDDD", "#000000", true, "y="+rd);
document.close();
Draw();
function Draw()
{ 
P=new Array();
document.open();
P[0]=new Pie(D.ScreenX(0),D.ScreenY(0),10,200,0,rd,"#ff6060");


}
</SCRIPT>

Here's my problem: the diagram works perfectly...unless you choose something other than 360 degrees. It still generates then, but the "pie" slice jumps up. Since this is a coverage calculator, it is critical that it is to scale at all times. Does anyone know how to fix this?

Nevermind, Solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.