Drawing Graphs on Your Browser? 201
Pieroxy queries: "I recently had a look at various ways to draw a graph (lines, bar chart, pie chart...) for a web-based enterprise application. As we need some interactivity, the GIF image generated on the server-side is not an option. Here is the list of technologies I can think of: Flash is probably over kill and a closed technology. Java is very flexible but slow (to start and run). SVG (discussed here) still requires a plugin. VML is supported only on IE5+, but it is natively supported. Which one of these technologies is the more flexible and interactive? Is it reasonable to require a plugin from the end users of our enterprise application? Is IE5+ a wide enough target for an enterprise application?"
Do you need all chart types, or just one? (Score:5, Insightful)
perl GD module (Score:3, Informative)
Of course, you'd need to write your own server side to generate the chart you want, but these tools put you easily along that path.
Re:Do you need all chart types, or just one? (Score:2)
Doesn't PHP have features for image generation on the fly? I bet with a combination of javascript, preloading, and PHP you could give the illusion of interactivity without resorting to dumb hacks.
Re:Do you need all chart types, or just one? (Score:2)
Re:Do you need all chart types, or just one? (Score:2)
IE5...not quite (Score:5, Insightful)
Internet Explorer 5 and above are very widely-used. However, they are still flawed browsers and, due to the announcement that these browsers will no longer be updated as standalone applications, many people may switch to another browser. Also, those using a Unix-based platform (read: GNU/Linux) no longer have any viable way of using Internet Explorer. If it is not easy to change back and forth, the already limited audience VML will reach even less as time goes on.
As an opinion only, if SVG is an option, it may be best in the long run. Assuming it is not easy to acrobatically jump from one option to the next (if that was possible, you could serve VML to IE 5.5+ and SVG to Mozilla, and some raster format for any other browsers), SVG holds the best promise. SVG is already supported as a plug-in (much like flash). It is about to be tested as a native part of the Mozilla browser. Over time, compatibility will actually improve--not something Java or VML can say easily. Also, as compatibility improves, simple scripting can make the charts interactive or real-time (or other neat fancy stuff).
Re:IE5...not quite (Score:2, Insightful)
You sir, are incapable of consistant thought.
You monkey.
Re: (Score:2, Insightful)
Re:IE5...not quite (Score:2)
I hate applets, but if you need alot of client side interactivity, I would say Java is the way to go.
Re:IE5...not quite (Score:3, Insightful)
To Clear the Air! (Score:2)
First of all, seeing all of these flamebaits means one thing, and one thing only.
I wasn't clear enough earlier. Sorry everyone!
Okay, here's take 2:
Re:IE5...not quite (Score:4)
Re:IE5...not quite (Score:3, Funny)
Agony of Expectation (Score:3, Insightful)
SVG to Mozilla
A solid reliable freely-redistributable implementation of SVG, and in Mozilla, would be one of the finest things, IMNHO.
A really good SVG implementation could make give web documents the elevated precision of presentation, akin to PDF, but in a W3C standard.
With extensions such as MathML and dynamic SVG, the format could form the basis of not just web documents, but paper documents (eg, stuff that currently is done in Word, Quark, Framemaker, TeX), as well as dynamic presentations (eg, Po
SVG demo page -- including charts (Score:3, Informative)
I think this may be a good example of what you're looking for.
In terms of support, if you plan on having this application around for a while, SVG is only going to get more popular.
Re:SVG demo page -- including charts (Score:2)
Re:IE5...not quite (Score:2)
I agree with the Linux part, but do you think Linux is any threat on the short term to Windows on the Desktop of enterprise networks ? I'm not so sure.
I can answer the last two (Score:4, Informative)
2) No. If it doesn't work on (at least) Netscape/Mozilla then you're excluding too many people (unless you know something about your target audience that I don't).
Surely you can do something with DHTML/Javascript to dynamically resize bar charts...
Important Phrase - Enterprise Application (Score:2)
I'd agree with the above post for an external website. About the only two plug-ins that you can reasonably count on people having are Flash and Acrobat Reader. And IE 5+ would limit you to about 90% of the browsing public - you don't want to turn away 10% of your potential customer base.
However, if the application is internal to your company, requiring a plug-in is very
Re:I can answer the last two (Score:2)
Especially since Netscape *invented* JavaScript...
Just because other systems now include a similar language (with another name!!!) doesn't mean that Netscape does not understand it.
ImageMagick (Score:2)
Re:ImageMagick (Score:2)
Re:ImageMagick (Score:2)
Re:ImageMagick (Score:2)
Re:ImageMagick (Score:2)
He didn't actually say what sort of interactivity he wanted, but if it's anything more complex than that can be delivered using JavaScript, then he'll most probably be going back to a server for data, which makes his requirement for no server-side a bit meaningless.
JPGraph and PHP (Score:5, Informative)
We have larges amounts of data which is very hard to interperate by a human in something like a spreadsheet. The only really feasable way to do it was graphs. Of course with the amount of data we had transmitting it to the client to do client side rendering (ie Java) is also out of the question.
In the end we settled on JPGraph [aditus.nu] with an interactive interface built using PHP. So a wizard style interface to choose the type of graph, what data to graph, how to group the data, and finally the outputted graph with the option to change all the settings.
With good indexed data making PHP generated graphs with JPGraph interactive is quite painless and very powerful.
Just one suggestion, make sure you have a way for people to save the settings of the graphs they make so they can pull em later, keeps the PHBs happy
Client-side or server-side interactivity? (Score:3, Interesting)
For serverside interactivity, a generated image (PNG,JPG,GIF) is more than suitable...
You can even make it an imagemap, if you need image-based feedback...
Just a thought...
Re:Client-side or server-side interactivity? (Score:2, Interesting)
One option might be to find a server-side SVG renderer. Assuming you believe SVG will become an implemented standard (practically speaking, that means something that IE will eventually support) you could generate graphs in SVG, server-side render them for the time being, and have a relatively easy way of stepping forward to a SVG + JavaScript/D
Why not an imagemap? (Score:3, Insightful)
Surely an image with an onClick and some Javascript will do what you ask of it?
Re:Why not an imagemap? (Score:2, Interesting)
By fetching another image when a change is requested, perhaps? This is easy enough to do without a page reload.
Re:Why not an imagemap? (Score:2, Insightful)
Sir, you surely jest. Have you even considered the latency issues of a dynamic interface that requires an HTTP request every time something needs to be redrawn? Even on a gigabit network, with less than 6' of cable physically separating your client from the server it would be intolerable.
You may as well say that Javascript should never be used as it can't do anything that can't be accomplished server-side.
Re:Why not an imagemap? (Score:2)
For example, you are basically limited to drawing a rectangle. You could specialise this to only allowing a horizontal line, or a vertical line, but ultimately that's all you can get without running back into the ver
Re:Why not an imagemap? (Score:2)
If it's meant to be this interactive.. (Score:5, Insightful)
Re:If it's meant to be this interactive.. (Score:2)
Some apps are just better off as applications than webapps.
Consider whether the webapp route is really worthwhile in this case. If it is, then you may have to sacrifice interactivity (a little). If it isn't, then use a conventional application, and deploy it...
Just my $0.02
Re:If it's meant to be this interactive.. (Score:2)
Re:If it's meant to be this interactive.. (Score:2)
Anyways, I'll try to explain the problematic of the web-based applications: No deployment.
Cost of developping an HTML page running on Linux/Mac/Windows/IE/NS/Opera: 1 day
Cost of developping a proprietary app running on all that (only showing the page in question, with let's say a little form): 2 weeks
Don't forget the Cost of development includ QA.
See, native programs are not always the answer.
Re:If it's meant to be this interactive.. (Score:2)
If you're an enterprise, you already have a remote deployment solution (Ghost images, Ghost packages, Microsoft's SMS packages) or you should do - how do you deploy fresh installations and updates to local applications like your office suite, web browser, email program etc?
How closed is SWF really? (Score:4, Informative)
The MING library can generate SWF from PHP et. al.
Re:How closed is SWF really? (Score:2)
"OpenSWF.org is the source for information on the Flash File Format. Here you will find file format specifications, sample code, links to 3rd party tools and more.
SWF is the file format used by Macromedia Flash to deliver graphics, animation and sound over the Internet. Almost 95% of web users can view SWF content without having to install a new plug-in, and over 300 million people have downloaded the Flash player. Macromedia published the specifications for SWF in April 1998. This site has re
Flash isn't as bad as it used to be (Score:4, Insightful)
The only problem is that the tutorials and manuals are aimed purely at designers, not at programmers, so the concept of a variable is given a 20 page explanation whereas the syntax of the more complex commands is glossed over in a 'do this and it works, you probably don't need to mess with it' manner.
Have you considered TABLE (Score:3, Informative)
Re:Have you considered TABLE (Score:2)
Histograms works the way you describe, that is true, but other things needs to cooperate on the same graph as well...
Point taken: DHTML might be a reasonnable fallback.
Java might be faster than you think (Score:3, Informative)
Look at lightweight graphical libraries like lwvcl (commercial) [zaval.org] or thinlet (LGPL) [mycgiserver.com] for the controls. The zaval people [zaval.org] even have a charting library for their lwvcl system. (I have never used the lwvcl library, it just looks cool - try their online demo [zaval.org]. Thinlet packs amazing capabilities into a very small package.)
If you need to display 15 graphs at a time with limited interaction, then this may not be the way to go, but if you need to display one at a time with very rich interaction, this might be the ticket.
dhk
Re:Java might be faster than you think (Score:2)
Plus, the first time I clicked on the links, it froze my browser. Granted, some other applets running might have been introducing some crappy threads in there, but welcome to the real world. If we use Java, we share the same JVM with any other Applets our end-user is viewing, and if one gets a dead-lock with the GUI thread, we're also dead.
Java (Score:2)
A while back I created a small Java applet that did some minor client-side image mangling. There was a delay of a fraction of a second bringing up the image. Not "slow" by any means. Most of that delay was probably the time it took to download the image from the server.
The real problem is that you have to stick to what is available to the 1.1 runtime. Yes, that's "1.1" from the previous century, because that's what most Windows users have.
We use Corda (Score:5, Informative)
Corda [corda.com] might do what you need. It will output the images in Flash, JPG, PNG, GIF, SVG and others. I believe it uses XML files to generate the graphs. I'm sure I'm missing a lot of the other things that it can do, but it's worth taking a look. Oh, and unfortunately it's not free, but it might be worth it if it does what you need.
Note: I do not work for this company. I have seen the results of using their product. We use it where I work and everyone seems to like what it can do.
Expensive (Score:2)
Re:We use Corda (Score:2)
Every single time you click anything, the screen reloads and it takes 3-4 seconds to get the new graph. The user experience behind this kind of figures is really bad, as I don't keep in my mind an idea of a nice graph even though the graph was nicely drawn, beautifully anti-aliased. But barely usable.
Try out VML if you're not concerned by IE5 only limitations, and experience t
Javascript (Score:4, Interesting)
The idea was simple: I created a table with every cell one pixel large, and set the colors accordingly to the input for the frame. It started out as a simple line graph, but in the end it could do bar and pies too.
This should be doable crossbrowser now that JS has stabilized enough between IE and Moz. If implemented right, it can really do with much lower bandwidth than pictures (which was the main requirement then): the
Same problem (Score:4, Insightful)
There were a few options that I rejected:
At the risk of posting flamebait, do you really have to worry about the possibility of end users running a non-MS operating system? Almost certainly not. Even the few that use Macs can presumably view VML. So go with VML and mandate the use of IE.
Unless, of course, you do wish to use Flash and have the expertise - although I still think you'll run into issues of people not having installed the plugin.
Re:Same problem (Score:3, Insightful)
FYI, IE for Mac is a discontinued product.
There's really little point in writing a Windows-only web site. I mean, if you're not going to be multi-platform, why hobble yourself with the web in the first place? A real Win32 app will be much easier for everybody.
That he wants a web-based product is a good hint he wants multi-platform.
To add some signal to the noise, I'm facing the same issue, and generating Flas
Re:Same problem (Score:2)
And there is sense in writing web apps for specific environments. First, if you're providing it as a service for hundreds or thousands of people, then you have the ultimate thin client - zero rollout, just a URL. Also, no need to worry about server security or reconfiguring firewalls, as everything runs on Apache and port 80. Also, as with a similar project I'm doing, if you're mostly interested in showing a load of data, then a web browser is an ideal platform to do it in;
Re:Same problem (Score:2)
Flash is on more computers than you may think. The Flash Player ActiveX Control is bundled with IE and Windows.
Microsoft's DLL Help Database [microsoft.com] will tell you which versions of which DLLs shipped with which Microsoft products. Search for "swflash.ocx". Very helpful!
Re:Same problem (Score:2)
Re:Same problem (Score:2)
The filename of Flash Player 1-5 was "swflash.ocx". Flash Player 6 was renamed to simply "flash.ocx" because Windows XP's file protection prevented the bundled Flash Player 5 swflash.dll from being overwritten by the Flash Player 6 downloaded from Macromedia.
I found a much more helpful guide on Macromedia.com. Macromedia has more information about Flash Player bundling here: Macromedia Flash Player and Browser Matrix - bundling reference guide
Basically:
Flash Player 6 is bundled with Netscape 7 and A
Re:Same problem (Score:2)
As for W3C ratification, I think you're being optimistic. Yes, it's nice to future proof things. However, SVG has been around for a couple of years, and is still not natively supported by IE. VML, however, is, and has been for some time. Even if (when) IE starts supporting SVG, there will be a significant
How about HTML and CSS? (Score:3, Informative)
http://ostermiller.org/bargraph.html [ostermiller.org]
It is done using only HTML with CSS. There was some reason that the bars come down from the top rather than up from the bottom, but I don't remember what it is right now...
Re:How about HTML and CSS? (Score:3, Interesting)
Re:How about HTML and CSS? (Score:4, Interesting)
I wonder how quickly a browser could re-flow a document that included an 800X600 cell table...My guess is "painfully", but it's almost worth writing the concept code to find out - time to write some PHP (I'm buggered if I'm going to write it by hand)
Re:How about HTML and CSS? (Score:2)
Re:How about HTML and CSS? (Score:3, Interesting)
My PC is approx. 1GHz.
320x20 (yes, 320x20 not 320x200) pixels takes approx 1 minute to be built through DHTML. (Using a table and a TD for every cell). Giving that 320x5 takes 4 seconds, it is not linear and we can deduce that a 320x200 matrix would be built in a couple of days.
Hmm, we'll need more than Hyperthreading.
Re:How about HTML and CSS? (Score:2)
Well, I'm glad you tried it out as otherwise I'd have been compelled to write the code myself. But your results do confirm my suspicions of the people who claimed that they'd done this before. I can only assume that they meant the idea had occurred to them before, but wanted to sound "cool" by claiming they'd implemented it. Whatever.
My suggestion of VML stands.
Is PDF even viable? (Score:2)
In considering possible solutions, I would take a crack at PDF. I've never done PostScript programming, but as I understand it, you can create vectors, arcs, and splines pretty well. Actually, since I don't have a good graph-generating package myself, I may just look into this ... hmm.
For my own use I would also look into CAD software formats ... what was it, DXF? I gather that's pretty simple for vector stuff, but it's not readily supported in browsers.
"Enterprise" (Score:2)
I think it depends what you mean by "Enterprise application".
If you mean this is for a company intranet or something where you can control the browser they're using, then having to install a plugin for SVG or Flash wouldn't seem to be a problem. Neither would dictating IE5+, although you might find that limits the companies options later.
If you mean it to be "professional looking" for as many customers as you can, then obviously going IE only is about as short sighted as you can get (remember Mac users ar
Accept: image/foobar (Score:2)
Ploticus (Score:2, Informative)
Re:Ploticus (Score:2)
Re:Ploticus (Score:2)
Deciding that I want to add a specific data set to my graph or that I want to see a histogram instead of a line plot has another dimension when you can actually do it instantly. The server-side roudtrip add an unnecessary perceived heavyweightness (should I say bloatiness) to the web app, even though architecturally, moving things to the client side is probably heavier.
Server side java…. (Score:2)
Re:Server side java…. (Score:2)
an unusable application.
IE5? I'd say so (Score:2)
Re:damn lies... (Score:2)
Consider Java *and* SVG (Score:2)
I would use java (Score:2)
exactly what does it mean?
as far as I can tell, its supposed to mean high end software with every feature possible and a much lower than average bug count.
but that dosen't tell you if ie5 is a large enough target market, and itdoesn't tell you if a plugin is acceptable to use.
If you have 100% control over the machines you will be installing on then yes ie5 is an aceptable taget.
it is always acceptable to expepect the user to intall a
plugin if
1. your softw
You've been FUDed (Score:2)
Tell me again that Java applets are too slow.
Try to reimplement those applets in Flash, then tell me
again.
Re:You've been FUDed (Score:2)
Re:You've been FUDed (Score:2)
javascript vector graphics (Score:2, Informative)
haven't used it, but the demo is fast and interactive.
Java whiteboard applet (Score:2)
Flash once, data many (Score:3, Informative)
Write a generalized interactive graphing tool in Flash. Then have it fetch a simple data file (delimited text or XML) via HTTP.
You can update the data dynamically and transmit the results with extremely low overhead.
Flash kicks Java's butt when it comes to availability, reliability, predictability and performance. Flash on Linux is absolutely the same as Flash on Windows or the Mac. It just works.
We have used Flash's ability to fetch dynamic data via HTTP to build "live" traffic and weather maps and perform other integration of constantly changing information.
Not sure about what you really need... (Score:2)
JFreeChart (http://www.jfree.org/jfreechart/index.html), which is totally serverside generated. Not sure what you mean when you say you need interactive charting - we let the user spec some params and toss them a graph.
On the other side of the spectrum we also use
SpotFire (http://www.spotfire.com/) which is not at all free, but which is REALLY powerful. Scientists and statisticians seem to love it...
What is a "closed technology" (Score:2)
If so, we might as well say that Linux is a "closed technology" because of the GPL.
If we have to have FUD, can we at least keep it off the main page?
Um, pay attention. (Score:2)
Flash isn't overkill at all. Except for sound. This is essentially the sort of thing it's designed for: to quickly render vector graphics. Notably, it's got a far larger deployment than SVG, Java/Javascript, or VML. Also, because the viewer is closed, it's both compliant with its own standard, and relatively stable. Moreover, it's ubiquitous; it ships with pretty much everything, and can be downloaded in a form appropriate to nearly every major web
So in summary... (Score:3, Informative)
SVG: lots of potential; the ideal solution if the plugin is installed or easily installable; XML based
Flash: the pragmatic choice; installed nearly everywhere; works reliably on all platforms; can be driven via XML
VML: good fit for IE 5+ browsers, since it's supported in a default install; unsupported in Mozilla; deprecated technology; XML based
Java applet: slow to startup; JFreeChart looks very powerful provided startup times are acceptable and browser support is available
In case you can't tell, I'm facing the same problem as the original poster. I also can't deploy server-side solutions, so PHP, Perl GD, etc are all out.
Based on this, I'm inclined to build a generic XML solution, then rely on plugin detection and XSLT to deliver either SVG or VML as appropriate. That covers me for IE 5.5+ and anything with SVG support. The largest group that I don't have covered is Mac users and people with older browsers, and I could probably come up with a different XSLT to cope with them if the demand made it worth doing.
Re:Hijack Excel (Score:2)
1. That bounds us to IE since the "Save As" feature generates a very IE oriented output (even though it might work ugly on Netscape)
2. Then, why not using VML ? More flexible, lightweight, it's even a w3c standard
Re:Hijack Excel (Score:2)
2. Irrelevant, given 1.
Re:Hijack Excel (Score:2)
Re:Hijack Excel (Score:2)
Re:Hijack Excel (Score:2)
I agree with you about the "big pig singlethreaded" thing, but that doesn't *actually* mean it won't work: provided you have a beefy enough server, I'm not aware of any reason why Excel can't run on it.
Even so, personally I would use this technique for pages that are updated periodically rather than on the fly.
Re:DHTML/CSS (Score:2)
EG: create a style sheet that creates a div with a border. Change the height on this and add in absolute positioning and you now have a bar graph. Data could be sent to the client in a a set of JavaScript arrays (one for X, one for Y or 2 d array). Create a few funct
Re:DHTML/CSS (Score:2)
Re:DHTML/CSS (Score:2)
At that point the question becomes a matter of algorythms.
Re:DHTML/CSS (Score:2)
function drawCircle(r, x, y) {
maxx = (2 * r) + x;
maxy = (2 * r) + y;
for (j = x-r; j<(2*r)+x;j++ ) {
s = Math.round(100*Math.sin(j)) + x;
c = Math.round(100*Math.cos(j)) + y;
document.write('<div style=border:solid;border-width:1px;border-color: b lack;position:absolute;width:1px;height:1px;top:')
document.write(s);
document.write(';left:');
document.write(c);
document.write(';></div>'
Re:DHTML/CSS (Score:2)
First of all, here is an implementation that works with most browsers:
function drawCircle(r, x, y) {
for (j = 0; j < (2*Math.PI);j+=1/r ) {
s = Math.round(r*Math.sin(j)) + x;
c = Math.round(r*Math.cos(j)) + y;
var elem = document.createElement("DIV");
elem.style.borderWidth = "0px";
elem.style.backgroundColor = "black";
elem.style.position = "absolute";
elem.s
Re:DHTML/CSS (Score:2)
Re:Why not... (Score:2)
Then VML would be the solution: Native support, no signing, no binary, lightweight XML-like language, JavaScript controlled through the DOM. Why in the world would we use anything else ?
Re:dumb question (Score:2)
Re:gnuplot + perl (Score:2)
I need a tech to draw a graph on the client-side
Re:Don't use div/span tags and css (Score:2)
The DIVs doesn't have to be generated on the server side, but on the client side through DHTML.