473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

make a bar chart?

hello,

Is it possible to present values gained via Javascript as a bar chart?

If, yes, wouild appreciate a pointer to how to do this or to some
sample code.

Cheers,

Geoff
Jul 23 '08 #1
10 2807
Geoff Cox wrote:
Is it possible to present values gained via Javascript as a bar chart?
If, yes, wouild appreciate a pointer to how to do this or to some
sample code.
Maybe something like this could get you started:

var data = [ ['jan', 104], ['feb', 99], ['mar', 111] ];
document.write('<table border="0"><tr>');
for (var i=0; i<data.length; ++i)
document.write('<td align="center" valign="bottom">'
+ data[i][1]
+ '<div style="background:red;width:20px;height:'
+ data[i][1] + 'px">&nbsp;</div>'
+ data[i][0]+'</td>');
document.write('</tr></table>');

--
Bart
Jul 23 '08 #2
On Wed, 23 Jul 2008 01:56:28 -0700 (PDT), Bart Van der Donck
<ba**@nijlen.comwrote:
>Geoff Cox wrote:
>Is it possible to present values gained via Javascript as a bar chart?
If, yes, wouild appreciate a pointer to how to do this or to some
sample code.

Maybe something like this could get you started:

var data = [ ['jan', 104], ['feb', 99], ['mar', 111] ];
document.write('<table border="0"><tr>');
for (var i=0; i<data.length; ++i)
document.write('<td align="center" valign="bottom">'
+ data[i][1]
+ '<div style="background:red;width:20px;height:'
+ data[i][1] + 'px">&nbsp;</div>'
+ data[i][0]+'</td>');
document.write('</tr></table>');
Many thanks Bart!

Cheers

Geoff
Jul 23 '08 #3
In comp.lang.javascript message <69rd84pl98c2ooijmnveubgr15a0gtlhqd@4ax.
com>, Wed, 23 Jul 2008 09:36:35, Geoff Cox <gc**@freeuk.notcomposted:
>Is it possible to present values gained via Javascript as a bar chart?

If, yes, wouild appreciate a pointer to how to do this or to some
sample code.
<URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>. It uses sized
DIVs, so works with the resolution of the screen. It works in IE,
Safari, Opera, and Firefox; but in Firefox it needs a little adjustment.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Jul 23 '08 #4
Dr J R Stockton wrote on 23 jul 2008 in comp.lang.javascript:
In comp.lang.javascript message <69rd84pl98c2ooijmnveubgr15a0gtlhqd@4ax.
com>, Wed, 23 Jul 2008 09:36:35, Geoff Cox <gc**@freeuk.notcomposted:
>>Is it possible to present values gained via Javascript as a bar chart?

If, yes, wouild appreciate a pointer to how to do this or to some
sample code.

<URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>. It uses sized
DIVs, so works with the resolution of the screen. It works in IE,
Safari, Opera, and Firefox; but in Firefox it needs a little adjustment.
or try:

http://devrijehuisarts.org/test/jsgraph.asp

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 24 '08 #5
Evertjan. a écrit :
Dr J R Stockton wrote on 23 jul 2008 in comp.lang.javascript:
>In comp.lang.javascript message <69rd84pl98c2ooijmnveubgr15a0gtlhqd@4ax.
com>, Wed, 23 Jul 2008 09:36:35, Geoff Cox <gc**@freeuk.notcomposted:
>>Is it possible to present values gained via Javascript as a bar chart?

If, yes, wouild appreciate a pointer to how to do this or to some
sample code.
<URL:http://www.merlyn.demon.co.uk/js-misc1.htm#BC>. It uses sized
DIVs, so works with the resolution of the screen. It works in IE,
Safari, Opera, and Firefox; but in Firefox it needs a little adjustment.

or try:

http://devrijehuisarts.org/test/jsgraph.asp
Is JS really indispensable to render charts ?

I use the google chart API when I need chart, JS (with XHR usually) is
only used to populate the datas.
http://code.google.com/apis/chart/

--
laurent
Jul 24 '08 #6
SAM
Laurent vilday a écrit :
>
I use the google chart API when I need chart, JS (with XHR usually) is
only used to populate the datas.
http://code.google.com/apis/chart/
Ha ! oui ! super !
works very fine !
<http://chart.apis.google.com/chart?chtt=Chantier+DURAND&cht=p3&chd=t:7,40,20,13 ,20&chs=386x200&chl=Electtricit%C3%A9%7CMa%C3%A7on nerie|Menuiserie|Plomberie|Divers>
Hop! et encore un truc dans la boite à malices :-)

And there is somewhere a form to fix, arrange, the url ?

--
sm
Jul 24 '08 #7
Laurent vilday wrote on 24 jul 2008 in comp.lang.javascript:
>http://devrijehuisarts.org/test/jsgraph.asp
btw, this was coded in 2003.
Is JS really indispensable to render charts ?
That was not the Q, as I saw it,
but if it can be done with clienside js.

Ofcourse there are miriads of other ways to make a chart,
like scanning the one handdrawn by a neighbouring wizkid,
but that is OT.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 24 '08 #8
In comp.lang.javascript message <Xn********************@194.109.133.242>
, Thu, 24 Jul 2008 07:23:51, Evertjan. <ex**************@interxnl.net>
posted:
>
or try:

http://devrijehuisarts.org/test/jsgraph.asp
At first sight, it appears that the points on the waves are GIFs. Could
they be small sized DIVs instead?

--
(c) John Stockton, nr London UK. ??@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
In MS OE, choose Tools, Options, Send; select Plain Text for News and E-mail.
Don't quote more than is needed, and respond after each quoted part.
Jul 24 '08 #9
Laurent vilday wrote:
I use the google chart API when I need chart, JS (with XHR usually) is
only used to populate the datas. http://code.google.com/apis/chart/
Now THAT is a wonderful tool. Thanks for the link!

--
Bart
Jul 25 '08 #10
There are several ways.

A horizontal line such as
<hr id="red" style="height: .8em; background-color: red; color: red;
margin-left: 0; text-align: left" />
and then use:
document.getElementById("red").width= <computed width in px or %>

N.B.: A width set in the style is not changeable!
An solid image (previously defined)
<img src="blu.gif" height="12" alt="blue" id="blu" />
and then use:
document.getElementById("blu").width= <computed width in px>
Both seem to work in FF3, IE7, Opera9 and Safari(windows). Other units may
work.

Using a <pfails in all of them and <tablein FF.

Percent is nice because it scales with the user's display. Unfortunately
'em' does not always work. It would be prudent to initialize the width
'onload'.

HTH
Jul 26 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brian Shade | last post by:
Hi all. I am having a bit of a problem with my Perl script and the creation of a chart. I can create the chart and create a new SeriesCollection. I then specify the XValues and the Values parameter...
22
by: PeteCresswell | last post by:
I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp, but still don't have a clue. For example, I've got a chart object namde...
1
by: Robert | last post by:
Vb.Net Make dll that contain one function. Help Please. I would like to call a function from different applications. I think i have to make a dll. I have Visual Basic.net 2003 Standard...
1
by: Scott H. | last post by:
Hello: I am trying to use Crystal Reports from VS.NET 2003 to produce a simple line chart, where the x axis represents the number of measurements taken and the y axis represents the range of...
1
by: Saintor | last post by:
This is for A97 in runtime or MDE mode. My intent was to define a temporary query using the recordsetclone property / filter / orderby. The controlsource of my chart would be based on a grouped...
3
by: Widge | last post by:
Hi, I've made a piece of VBA that uses a combination of combolists and listboxes to run a query. I just can't think of a way to make this query generate a chart based on its results. Here is my...
2
by: shwetamodi | last post by:
is it possible to make graphics (chart, pie chart...), which could be done dynamicly on the server.... ??
0
by: maxx429 | last post by:
Hi all, I am posting this question for a co-worker. She knows very little about Access but has been asked to create some reports. One the requirements is that the report contain a Pie Chart...
1
by: cubekid | last post by:
I am using OWC 11 in my new web application for displaying charts. Is it possible in OWC 11 to combine and display a column and a line graph (Looking like they overlap each other)? I tried it using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.