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


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

Function to create SVG "guage" graphics.

Started byMike Duffy <Use_guestbook_page@website.in.sig>
First post2012-07-22 02:55 +0000
Last post2012-07-26 19:30 +0100
Articles 11 — 6 participants

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


Contents

  Function to create SVG "guage" graphics. Mike Duffy <Use_guestbook_page@website.in.sig> - 2012-07-22 02:55 +0000
    Re: Function to create SVG "guage" graphics. "Mel Smith" <med_cutout_syntel@aol.com> - 2012-07-21 22:23 -0600
    Re: Function to create SVG "guage" graphics. Dr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid> - 2012-07-23 19:34 +0100
      Re: Function to create SVG "guage" graphics. Mike Duffy <Use_guestbook_page@website.in.sig> - 2012-07-24 00:46 +0000
        Re: Function to create SVG "guage" graphics. Tim Slattery <Slattery_T@bls.gov> - 2012-07-24 08:50 -0400
          Re: Function to create SVG "guage" graphics. Mike Duffy <Use_guestbook_page@website.in.sig> - 2012-07-24 21:53 +0000
            Re: Function to create SVG "guage" graphics. Gene Wirchenko <genew@ocis.net> - 2012-07-24 16:40 -0700
            Re: Function to create SVG "guage" graphics. "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-07-24 21:45 -0430
            Re: Function to create SVG "guage" graphics. Tim Slattery <Slattery_T@bls.gov> - 2012-07-25 09:08 -0400
        Re: Function to create SVG "guage" graphics. Dr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid> - 2012-07-25 19:25 +0100
    Re: Function to create SVG "guage" graphics. Dr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid> - 2012-07-26 19:30 +0100

#15131 — Function to create SVG "guage" graphics.

FromMike Duffy <Use_guestbook_page@website.in.sig>
Date2012-07-22 02:55 +0000
SubjectFunction to create SVG "guage" graphics.
Message-ID<XnsA097E92DFF469invalidcom@94.75.214.39>
First, here is some background info. I wanted to develop a script to 
generate graphical "guages" similar to those found at: 

https://google-
developers.appspot.com/chart/interactive/docs/gallery/gauge

I decided not to use the Google app itself because in the past they have 
dropped support for their apps. (Translate API a few years back, and 
Google chart API during the coming year.) Also, I really do not like the 
idea of using apps with no source or obfuscated source.

I did consider putting effort into improving one of the various public 
javascript "libraries", but I do not really like their generalistic 
approach. I just wanted a simple self-contained function with no external 
dependencies.

Thus, I have written my own guage function. You can see sample (SVG) 
outputs here:

http://pages.videotron.com/duffym/guagedemo.htm

It is not really intended as a demo of all capabilities. It is instead a 
tool to test the various execution paths within the function.


My questions are:

1) I do not feel good about using javacript object notation to define the 
argument list. (On the above page, you can see the source code for the 
argument object.) Is there a better way?

2) Is there anyone at all who is interested in using this? If so, I will 
make it easier to download, explicitly designate it as GPL, and perhaps 
add some internal comments.

3) Is there a need for further complicating the colors? Does anyone feel 
that it would be useful (for example), to say that you want 10 to 20 in 
red, 20 to 40 in red graduating to yellow, etc. ?

BTW, I have re-done my astronomy page to use SVG instead of the Google 
Chart API.

-- 
http://pages.videotron.ca/duffym/index.htm

[toc] | [next] | [standalone]


#15132

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2012-07-21 22:23 -0600
Message-ID<a71disFb70U1@mid.individual.net>
In reply to#15131
"Mike Duffy" <Use_guestbook_page@website.in.sig> wrote in message 
news:XnsA097E92DFF469invalidcom@94.75.214.39...
> First, here is some background info. I wanted to develop a script to
> generate graphical "guages" similar to those found at:


Whatsa 'gooahhj'  :)  (or did you mean a 'gayyyj)

-Mel

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


#15164

FromDr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid>
Date2012-07-23 19:34 +0100
Message-ID<CZb$P0IYkZDQFwzl@invalid.uk.co.demon.merlyn.invalid>
In reply to#15131
In comp.lang.javascript message <XnsA097E92DFF469invalidcom@94.75.214.39
>, Sun, 22 Jul 2012 02:55:11, Mike Duffy <Use_guestbook_page@website.in.
sig> posted:

>First, here is some background info. I wanted to develop a script to
>generate graphical "guages" similar to those found at:
>
>https://google-
>developers.appspot.com/chart/interactive/docs/gallery/gauge

Did you ever wonder why Google spells it "gauge" ?

Coloured on black is nasty to read.

>BTW, I have re-done my astronomy page to use SVG instead of the Google
>Chart API.

<http://pages.videotron.com/duffym/astro.htm> - see sig line 3.

Coloured on black is nasty to read. Have an "is" for Note 3 sentence 2
word 2.  "Kg" should be "kg".  Fonts are often too small.


-- 
 (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk  Turnpike v6.05  MIME.
  Web  <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms and links;
  Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.

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


#15166

FromMike Duffy <Use_guestbook_page@website.in.sig>
Date2012-07-24 00:46 +0000
Message-ID<XnsA099D3659CB3Binvalidcom@94.75.214.39>
In reply to#15164
Dr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid> wrote in
news:CZb$P0IYkZDQFwzl@invalid.uk.co.demon.merlyn.invalid: 

> 
> Did you ever wonder why Google spells it "gauge" ?

Hmmm. I'm never actually been diagnosed as dyslexic, but I really did
not notice. Thanks for pointing it out. I will, however, let it stand
for a few weeks considering that it is an "orphan" web page intended to
be accessed solely from here. 


> Coloured on black is nasty to read.

I avoid using dark text colours. I have never noticed any problem except
when using fully-saturated blue, green, or violet on a black background. 

But perhaps I am putting too much stock in my own judgement. (See the
response below to your last point.) 


> ... Have an "is" for Note 3 sentence 2 word 2.  "Kg" should be "kg".

Corrected. Corrected. (Thanks).


> Fonts are often too small.

I will adjust the defaults to be larger. (I often get this sort of
comment from people at work after I have set up their computer.) 

Are you speaking here about the entire web-site, or just the astronomy
page? Upon reflection, the orrery does use a font size much too small. 

Leaving aside the fonts and colours, do you have any opinion on the
"guages" themselves? 

-- 
http://pages.videotron.ca/duffym/index.htm

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


#15170

FromTim Slattery <Slattery_T@bls.gov>
Date2012-07-24 08:50 -0400
Message-ID<ob6t0816oj5ba21pkgo3vchfsg8226il4q@4ax.com>
In reply to#15166
Mike Duffy <Use_guestbook_page@website.in.sig> wrote:


>I avoid using dark text colours. I have never noticed any problem except
>when using fully-saturated blue, green, or violet on a black background. 

Red text on black background is unreadable. 

Yes I'm (red-green) color-blind, as are 10% or so of males (the
malfunctioning gene is on the Y chromosome, so women have a far better
chance of getting a good one.) Red on gray is even worse. 

-- 
Tim Slattery
Slattery_T@bls.gov

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


#15182

FromMike Duffy <Use_guestbook_page@website.in.sig>
Date2012-07-24 21:53 +0000
Message-ID<XnsA09AB606F4FA6invalidcom@94.75.214.39>
In reply to#15170
Tim Slattery <Slattery_T@bls.gov> wrote in
news:ob6t0816oj5ba21pkgo3vchfsg8226il4q@4ax.com: 


> Yes I'm (red-green) color-blind, as are 10% or so of males (the
> malfunctioning gene is on the Y chromosome, so women have a far better
> chance of getting a good one.) Red on gray is even worse. 

I must admit that did not consider that. Again, (as with font sizes), I
have been guilty of using my own judgement when upon reflection is not a
good idea. (In high school, I was able to read micro-fiche without using
the viewer.) 

It should be easy to modify the web-site to address the issues you & Dr.
S. raised because I use a master CSS to style everything. 

I am sure that if I look around, I can find some guidelines regarding a
good choice of colours to accomodate people with this condition. 

BTW, the gene coding for the most common form of colour-blindness is on
the X chromosome. Women have the condition too, but at a much smaller
incidence rate. 

http://en.wikipedia.org/wiki/Color_blindness

-- 
http://pages.videotron.ca/duffym/index.htm

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


#15184

FromGene Wirchenko <genew@ocis.net>
Date2012-07-24 16:40 -0700
Message-ID<6ccu0810scvjb3121tievu2dl00tcph4ab@4ax.com>
In reply to#15182
On Tue, 24 Jul 2012 21:53:30 +0000 (UTC), Mike Duffy
<Use_guestbook_page@website.in.sig> wrote:

>Tim Slattery <Slattery_T@bls.gov> wrote in
>news:ob6t0816oj5ba21pkgo3vchfsg8226il4q@4ax.com: 
>
>
>> Yes I'm (red-green) color-blind, as are 10% or so of males (the
>> malfunctioning gene is on the Y chromosome, so women have a far better
>> chance of getting a good one.) Red on gray is even worse. 
>
>I must admit that did not consider that. Again, (as with font sizes), I
>have been guilty of using my own judgement when upon reflection is not a
>good idea. (In high school, I was able to read micro-fiche without using
>the viewer.) 

     One place where I have seen it violated nastily is resumes.  You
are young and the world is your oyster unless the older guy trying to
read your resume can not read it.  I suggest 12 point, 11 at lowest.

>It should be easy to modify the web-site to address the issues you & Dr.
>S. raised because I use a master CSS to style everything. 
>
>I am sure that if I look around, I can find some guidelines regarding a
>good choice of colours to accomodate people with this condition. 
>
>BTW, the gene coding for the most common form of colour-blindness is on
>the X chromosome. Women have the condition too, but at a much smaller
>incidence rate. 
>
>http://en.wikipedia.org/wiki/Color_blindness

     It is recessive.  Females have to get two colour-blindness genes
to have the condition express.  With males, if you have one, you have
it.

Sincerely,

Gene Wirchenko

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


#15185

From"Leonardo Azpurua" <leonardo@exmvps.org>
Date2012-07-24 21:45 -0430
Message-ID<junkl8$4dr$1@dont-email.me>
In reply to#15182
"Mike Duffy" <Use_guestbook_page@website.in.sig> escribió en el mensaje 
news:XnsA09AB606F4FA6invalidcom@94.75.214.39...

> I am sure that if I look around, I can find some guidelines regarding a
> good choice of colours to accomodate people with this condition.

In case of doubt, use black on white.

--

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


#15186

FromTim Slattery <Slattery_T@bls.gov>
Date2012-07-25 09:08 -0400
Message-ID<uqrv085miponotmf219fd1h7ujjcp7aqpj@4ax.com>
In reply to#15182
Mike Duffy <Use_guestbook_page@website.in.sig> wrote:


>BTW, the gene coding for the most common form of colour-blindness is on
>the X chromosome. Women have the condition too, but at a much smaller
>incidence rate. 

Right, I grabbed the wrong letter. Women have two X's, therefore have
two chances to get a working copy of the gene. men have only one shot
at it, no backup.

That's the same reason that women carry hemophilia but men get it.
It's the X chromosome.

-- 
Tim Slattery
Slattery_T@bls.gov

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


#15188

FromDr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid>
Date2012-07-25 19:25 +0100
Message-ID<mgSmRWGioDEQFwsL@invalid.uk.co.demon.merlyn.invalid>
In reply to#15166
In comp.lang.javascript message <XnsA099D3659CB3Binvalidcom@94.75.214.39
>, Tue, 24 Jul 2012 00:46:49, Mike Duffy <Use_guestbook_page@website.in.
sig> posted:

>Dr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid> wrote in
>news:CZb$P0IYkZDQFwzl@invalid.uk.co.demon.merlyn.invalid:
>
>>
>> Did you ever wonder why Google spells it "gauge" ?
>
>Hmmm. I'm never actually been diagnosed as dyslexic, but I really did
>not notice. Thanks for pointing it out. I will, however, let it stand
>for a few weeks considering that it is an "orphan" web page intended to
>be accessed solely from here.

It's a word I always have to think about in crosswords.

>> Coloured on black is nasty to read.
>
>I avoid using dark text colours. I have never noticed any problem except
>when using fully-saturated blue, green, or violet on a black background.
>
>But perhaps I am putting too much stock in my own judgement. (See the
>response below to your last point.)

For the ordinary informative  text on a site, you should leave the font
face and size as the user has, or ought to have, chosen it.  I
personally assume that the users will be happy with black text on a
near-white background.

For non-bulk text, I see no objection to the 120% that you may be using.


>Are you speaking here about the entire web-site, or just the astronomy
>page? Upon reflection, the orrery does use a font size much too small.
>
>Leaving aside the fonts and colours, do you have any opinion on the
>"guages" themselves?

I have no need for them.  If I had, I would use something simpler -
generally a horizontal thermometer, which needs much less code.

        I remember seeing gauges something like yours in Kapitsa's lab
        in Moscow.  One could tell which were important because those
        had add-on labelling in Russian - the gauges themselves were
        all British, like the whole set-up.


-- 
 (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk  Turnpike 6.05  WinXP.
 Web  <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
 Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
 DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.

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


#15193

FromDr J R Stockton <reply1230@merlyn.demon.co.uk.not.invalid>
Date2012-07-26 19:30 +0100
Message-ID<KLedbJFRzYEQFw7p@invalid.uk.co.demon.merlyn.invalid>
In reply to#15131
In comp.lang.javascript message <XnsA097E92DFF469invalidcom@94.75.214.39
>, Sun, 22 Jul 2012 02:55:11, Mike Duffy <Use_guestbook_page@website.in.
sig> posted:

>
>http://pages.videotron.com/duffym/guagedemo.htm
>

Another thing to think seriously about is the possible effects of the
very useful Zoom Text Only in Firefox and Safari.

I almost always, when reading, use a few steps of ZTO, since I'm more
interested in the text than in the images.  Your gauges do not then
zoom, being classed as images.  But they contain important numeric text.

If an image is sized by CSS in ex or em units, it zooms like text with
ZTO.  Perhaps you can give your code the choice.

<http://www.merlyn.demon.co.uk/www-use1.htm#ZTO> refers.

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

[toc] | [prev] | [standalone]


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


csiph-web