Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21615 > unrolled thread

Re: Graphics in Javascript

Started bydg <dgurjar@gmail.com>
First post2013-10-15 15:52 -0700
Last post2013-10-16 14:36 +0200
Articles 5 — 5 participants

Back to article view | Back to comp.lang.javascript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Graphics in Javascript dg <dgurjar@gmail.com> - 2013-10-15 15:52 -0700
    Re: Graphics in Javascript "Christopher J. Henrich" <chenrich@monmouth.com> - 2013-10-15 20:35 -0400
      Re: Graphics in Javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-16 03:17 +0200
        Re: Graphics in Javascript John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-16 14:38 +0100
    Re: Graphics in Javascript danca <cyberdanny@tiscalinet.it> - 2013-10-16 14:36 +0200

#21615 — Re: Graphics in Javascript

Fromdg <dgurjar@gmail.com>
Date2013-10-15 15:52 -0700
SubjectRe: Graphics in Javascript
Message-ID<b4be09db-355c-40bb-abe7-02e57a4b8ab4@googlegroups.com>
Do you have any sample example? How this can be done in JS?

On Wednesday, May 21, 1997 3:00:00 AM UTC-4, Stefan Koch wrote:
> In article <3382E0A1.348A@sas.dk>, "Ole B. Hansen" <obh@sas.dk> wrote:
> >I'm new to Javascript. 
> >Is it possible to create and draw graphics (ex charts etc) directly in
> >Javascript?? I haven't seen examples on that.
> >I guess you could create a gif-file in the server proces and reference
> >it from the HTML page, but I would like to find out, if it is possible
> >to do it in the client.
> 
> Hi Ole,
> 
> you can create images on the client side with JavaScript. But it is quite 
> complicated and slow. So there are really few examples out on the net. 
> 
> This explanation sketches the process (I'll think you'll understand that this 
> IS complicated...):
> 
> This works like this: A JavaScript program can output data for different 
> MIME-types. Normally if you call document.write() the MIME-type for the output 
> is text/html - which means that the output results in a HTML-page. With the 
> document.open() method you can set the MIME-type like this: 
> document.open("text/plain") - which means for example that the proceding 
> document.write() calls result in a plain ASCII text. 
> With the help of this you can output any format you like (and which the 
> browser can display). Just choose a image format and write out the binary data 
> with the help of document.write(). Of course you'll have to know the *exact* 
> format of the MIME-type you choose. This is the complicated (or better: 
> annoying) part. This means you'll have to write your routines for the image 
> creation all on your own. 
> All the examples I have seen which use this technique use images in the xbm 
> format. Why xbm? These are black and white images. This image format - and 
> this is the important part - contains just the plain image data unpacked. So 
> it is quite easy to create these images - compared to gif's or even jpeg's. 
> 
> Although it is quite common (in some cases) to write routines for creating 
> different image formats - I wouldn't recommend to do it with JavaScript. 
> JavaScript is a scripting language - and you'll see that the image creation 
> process will be quite slow. So if you want to create images you'll better 
> stick to other techniques. For example CGI - i.e. creating the image on the 
> server with the help of some libraries. Or Java - where you can do direct 
> image manipulation like drawing lines, rectangles and so on.
> 
> I hope this helps,
> Stefan
> 
> -----------------------------------------------
> Stefan Koch   ---   skoch@rumms.uni-mannheim.de
>   http://rummelplatz.uni-mannheim.de/~skoch/
> 
> My JavaScript book:
> http://www.dpunkt.de/javascript/
> 
> Voodoo's Intro to JavaScript:
> http://rummelplatz.uni-mannheim.de/~skoch/js/

[toc] | [next] | [standalone]


#21617

From"Christopher J. Henrich" <chenrich@monmouth.com>
Date2013-10-15 20:35 -0400
Message-ID<151020132035356930%chenrich@monmouth.com>
In reply to#21615
In article <b4be09db-355c-40bb-abe7-02e57a4b8ab4@googlegroups.com>, dg
<dgurjar@gmail.com> wrote:

> Do you have any sample example? How this can be done in JS?
> 
> On Wednesday, May 21, 1997 3:00:00 AM UTC-4, Stefan Koch wrote:
> > In article <3382E0A1.348A@sas.dk>, "Ole B. Hansen" <obh@sas.dk> wrote:
> > >I'm new to Javascript. 
> > >Is it possible to create and draw graphics (ex charts etc) directly in
> > >Javascript?? I haven't seen examples on that.
> > >I guess you could create a gif-file in the server proces and reference
> > >it from the HTML page, but I would like to find out, if it is possible
> > >to do it in the client.
> > 
> > Hi Ole,
> > 
> > you can create images on the client side with JavaScript. But it is quite 
> > complicated and slow. So there are really few examples out on the net. 

Note the date of Stefan Koch's request.

Since that time, HTML 5 has introduced the "Canvas" element, in which
charts and other graphics stuff can be drawn. Wikipedia canget you
started on finding out what you want to know.

-- 
Chris Henrich
http://www.mathinteract.com
You can always delay short-term thinking, but you can never delay long-term
thinking.
--Alan Cooper

[toc] | [prev] | [next] | [standalone]


#21618

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-10-16 03:17 +0200
Message-ID<3579321.SEt1oh2C6K@PointedEars.de>
In reply to#21617
Christopher J. Henrich wrote:

> Note the date of Stefan Koch's request.  [Wednesday, May 21, 1997]
> 
> Since that time, HTML 5 has introduced the "Canvas" element, in which
> charts and other graphics stuff can be drawn. Wikipedia canget you
> started on finding out what you want to know.

It's HTML5 (no space), and the existing Canvas implementations would merely 
be standardized by that Specification, which is currently only a W3C Working 
Draft (Candidate Recommendation).

An even older – but not worse – alternative to that is SVG, which is at 
least equally well documented, a Web standard (W3C Recommendation), and 
mentioned in said English Wikipedia article.  Both Canvas and SVG can be 
used inline without namespace declarations in HTML5 documents; the latter 
can also be used inline in XHTML 1.1, given the proper DOCTYPE and namespace 
declarations.

Your signature exceeds the recommended limit by one line.
 
-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#21624

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2013-10-16 14:38 +0100
Message-ID<hm5t59parj7vsa5k8h0uii476b1sm7333r@4ax.com>
In reply to#21618
On Wed, 16 Oct 2013 03:17:39 +0200, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

  <snip>
>Your signature exceeds the recommended limit by one line.

How petty - complaining about a sig that's much, much shorter than one
of your header lines (~800 bytes shorter). 

  John

[toc] | [prev] | [next] | [standalone]


#21623

Fromdanca <cyberdanny@tiscalinet.it>
Date2013-10-16 14:36 +0200
Message-ID<l3m195$l8q$3@dont-email.me>
In reply to#21615
Il 16/10/2013 00:52, dg ha scritto:
> Do you have any sample example? How this can be done in JS?
>
> On Wednesday, May 21, 1997 3:00:00 AM UTC-4, Stefan Koch wrote:
>> In article <3382E0A1.348A@sas.dk>, "Ole B. Hansen" <obh@sas.dk> wrote:
>>> I'm new to Javascript.
>>> Is it possible to create and draw graphics (ex charts etc) directly in
>>> Javascript?? I haven't seen examples on that.
>>> I guess you could create a gif-file in the server proces and reference
>>> it from the HTML page, but I would like to find out, if it is possible
>>> to do it in the client.
>>
>> Hi Ole,
>>
>> you can create images on the client side with JavaScript. But it is quite
>> complicated and slow. So there are really few examples out on the net.
>>
>> This explanation sketches the process (I'll think you'll understand that this
>> IS complicated...):
>>
>> This works like this: A JavaScript program can output data for different
>> MIME-types. Normally if you call document.write() the MIME-type for the output
>> is text/html - which means that the output results in a HTML-page. With the
>> document.open() method you can set the MIME-type like this:
>> document.open("text/plain") - which means for example that the proceding
>> document.write() calls result in a plain ASCII text.
>> With the help of this you can output any format you like (and which the
>> browser can display). Just choose a image format and write out the binary data
>> with the help of document.write(). Of course you'll have to know the *exact*
>> format of the MIME-type you choose. This is the complicated (or better:
>> annoying) part. This means you'll have to write your routines for the image
>> creation all on your own.
>> All the examples I have seen which use this technique use images in the xbm
>> format. Why xbm? These are black and white images. This image format - and
>> this is the important part - contains just the plain image data unpacked. So
>> it is quite easy to create these images - compared to gif's or even jpeg's.
>>
>> Although it is quite common (in some cases) to write routines for creating
>> different image formats - I wouldn't recommend to do it with JavaScript.
>> JavaScript is a scripting language - and you'll see that the image creation
>> process will be quite slow. So if you want to create images you'll better
>> stick to other techniques. For example CGI - i.e. creating the image on the
>> server with the help of some libraries. Or Java - where you can do direct
>> image manipulation like drawing lines, rectangles and so on.
>>
>> I hope this helps,
>> Stefan
>>
>> -----------------------------------------------
>> Stefan Koch   ---   skoch@rumms.uni-mannheim.de
>>    http://rummelplatz.uni-mannheim.de/~skoch/
>>
>> My JavaScript book:
>> http://www.dpunkt.de/javascript/
>>
>> Voodoo's Intro to JavaScript:
>> http://rummelplatz.uni-mannheim.de/~skoch/js/
>
maybe http://raphaeljs.com can be interesting.
HTH
Dan

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web