473,385 Members | 1,890 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,385 software developers and data experts.

bar graph js widget test

I need a clickable/setable bar graph for a project (an image size editor).
I'd like this to work in modern js enabled browsers.

Here's what I've mocked up (it's rough):

http://thelimit.com/test/test_width.htm

How does that work in your environment? I think Opera will get the first two
wrong, but am not sure.

I would imagine this could be done with flash? Any advantage?

Jeff


Jul 20 '05 #1
5 3942
"Jeff Thies" <no****@nospam.net> wrote in news:uy3zb.1305$Oe5.89
@newsread2.news.atl.earthlink.net:
http://thelimit.com/test/test_width.htm


Opra gets the 1'st and the 2nd right. but the bars don't show up.

In IE6 I find the bars stick ferther out than the marks above them. (width
is wider) Not sure if it's supposed to be?

--
News Updater, No scripts, No Database
http://www.xmlssoftware.com/NUpdater
Jul 20 '05 #2


Jeff Thies wrote:
I need a clickable/setable bar graph for a project (an image size editor).
I'd like this to work in modern js enabled browsers.

Here's what I've mocked up (it's rough):

http://thelimit.com/test/test_width.htm

How does that work in your environment? I think Opera will get the first two
wrong, but am not sure.


Clicking the bars causes script errors with Mozilla/Netscape as
parent_node.childNodes(j)
is not the right way to index childNodes with JavaScript. Use square
brackets
parent_node.childNodes[j]
or use the item method
parent_node.childNodes.item(j)

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
Louis Somers wrote on 02 dec 2003 in comp.lang.javascript:
"Jeff Thies" <no****@nospam.net> wrote in news:uy3zb.1305$Oe5.89
@newsread2.news.atl.earthlink.net:
http://thelimit.com/test/test_width.htm


<script>
function changeBar(x){
var w = window.event.offsetX
if (x.id == 'b1'){
x.style.pixelWidth = w
document.getElementById('b2').style.pixelWidth = 500-w
} else {
w = x.style.pixelWidth -= w
document.getElementById('b1').style.pixelWidth = 500-w
}
}
</script>

<div style="display:inline;width:250px;background-color:red;"
id="b1" onclick="changeBar(this)"></div>
<div style="display:inline;width:250px;background-color:green;"
id="b2" onclick="changeBar(this)"></div>

IE6 tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4
Thanks to all!

I've updated with Martin's fix.

The float: left version works correctly in NS7, as NS7 (rightly,
probably) does not like widths/heights for inline elements.

Evertjan's code below looks like a better alternative. Unsure of the event
handling outside of IE though. Why does event handling follow no standards.

Cheers,
Jeff
<script>
function changeBar(x){
var w = window.event.offsetX
if (x.id == 'b1'){
x.style.pixelWidth = w
document.getElementById('b2').style.pixelWidth = 500-w
} else {
w = x.style.pixelWidth -= w
document.getElementById('b1').style.pixelWidth = 500-w
}
}
</script>

<div style="display:inline;width:250px;background-color:red;"
id="b1" onclick="changeBar(this)"></div>
<div style="display:inline;width:250px;background-color:green;"
id="b2" onclick="changeBar(this)"></div>

IE6 tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 20 '05 #5
Jeff! wrote:
I need a clickable/setable bar graph for a project (an image size
editor). I'd like this to work in modern js enabled browsers. Here's what I've mocked up (it's rough): http://thelimit.com/test/test_width.htm How does that work in your environment? I think Opera will get the first
two wrong, but am not sure. I would imagine this could be done with flash? Any advantage? Jeff


Worked fine for me in IE6. Bar changed a tad length wise when clicked on
though. No big deal.
No way to reset the color to original status.


Jul 20 '05 #6

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

Similar topics

10
by: Oh Kyu Yoon | last post by:
Does anyone know how to implement plots from scipy, chaco, etc into wxPython widget? Thank you
25
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
6
by: William Gill | last post by:
I am trying to get & set the properties of a widget's parent widget. What I have works, but seems like a long way around the block. First I get the widget name using w.winfo_parent(), then i...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
8
by: Jef Driesen | last post by:
I'm working on an image segmentation algorithm. An essential part of the algorithm is a graph to keep track of the connectivity between regions. At the moment I have a working implementation, but...
11
by: Andreas.Burman | last post by:
Hi What is the best way to implement a undirected weighted graph ADT in javascript?
2
by: Al in Dallas | last post by:
I made the mistake of creating an instance of a widget and assigning it to a name I'd already used. Now, if I use root.children or root.slaves(), I can see the "lost" widget, but can I do anything...
4
by: John Henry | last post by:
I am looking for a ready made simple graph package. I found an extensive one in the piana package but when I try to use just the graph portion, it fails to load because of the line: class...
2
by: zakaria2710 | last post by:
Would u help me with this task, I am new in C++ programming, this codes have alot of errors, I have never work with graphs before, I am using Borlard C++ Ver 5.02. I was told u can not run a graph...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.