Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple drawing in HTML

Status
Not open for further replies.

DaveC426913

Programmer
Jul 28, 2003
274
CA
Is there a way of drawing lines (using DHTML)? vert/horiz lines are easy of course by just creating a thin box, but diagonals won't work. I'd like to supply a set of coordinates to have the browser draw a line from x1,y1 to x2,y2.

Dave
 
I don't think there is. You can, however, do it with ActiveX or a JavaApplet.

The downside is, that these two can be - and often are - disabled in the browser for security reasons. Hence, they will not be guaranteed visible in any browser.

Have a look at SVG, which is a XML standard for Scalable Vector Graphics here ...


Good luck §;O)


Jakob
 
If you mean an on-the-fly drawing application, you're almost certainly going to be using a Java applet, or maybe something in SVG (as Jakob mentioned) or VRML (I wouldn't really know where to start with that other than
If you just need something to display graphics, or to do a calculation and then display a graphical result, this little hack-job might help you: faq216-3516

This conversation might help: thread216-608580

There was another more-recent thread regarding graphics, but I can't find it.

Cheers,


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
The supplied link _FAQ216-3516_ simply goes to the forum homepage. The supplied thread also contains that link, which also goes nowhere useful.

However, the thread was useful.

I could theoretically use the Javascript graph except my chart is large, and has many lines on it all over the place. (It's not actually a chart, it's a geogrpahical map with coordinates and lines. You'll see it here
The SVG seems to work nicely - I am quite shocked to discover that I already have the tech in my browser to do it - though I assume not everyone will.


Thanks. Dave
 
P.S. Could you direct me to where I could get more info on this?

1] A reference of params
2] An idea of how compatible it's going to be for users.

Dave
 
Well, the FAQ216-3516 link works for me. Could it be that you have Javascript switched off? Try getting there from this one instead: . Since it's a javascript-based solution, it won't work for all browsers (like the FAQ links don't).

What is it you're actually trying to do with those lines? Maybe there's a more reliable server-side way of doing it.

-- Chris Hunt
 
Chris is right. A server side solution is much better and doesen't have the same compatability issues as the other solutions discussed in this thread.

In PHP you can render graphics -server side. I've not tried it yet, but read a lot about it and it seems fairly straight forward. If you know a little JavaScript or C, then you're well off, starting with PHP.

There is also an excellent forum for PHP programming in here : forum434 or direct link : forum434 luck §;O)


Jakob
 
DaveC426913: The supplied link FAQ216-3516 simply goes to the forum homepage. The supplied thread also contains that link, which also goes nowhere useful.

Well, pretend it's entirely possible that there is an FAQ of that name. [lol] You'll find it in the JavaScript forum, under the "FAQ" tab.

It allows you to build, using exclusively client-side JavaScript, a bitmap image. The pixels can be of any color, so basically, you can draw anything you like. This is the more primitive-level tool, so it won't do things such as shapes, shading, etc., but you're obviously already using something that's producing the chart data, so all you have to do is populate the array-of-arrays and then feed it to the function.

Cheers,


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top