473,326 Members | 2,126 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,326 software developers and data experts.

draw grid lines over an image in Javascript

Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian

Aug 3 '06 #1
10 10298
ka******@hotmail.com wrote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian
I don't think javascript will be able to do the job, but seems possible
with css.
Aug 3 '06 #2

ka******@hotmail.com wrote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian
Here's a 'proof of concept' type page - firefox tested only
http://em.hopto.org/code/test/javascript/grid.html

Aug 3 '06 #3

ka******@hotmail.com wrote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian
Now that I think of it: best to create a table and overlay it on the
image. You get a nice grid pattern, and it would be easier to work with
if you want to start manipulating the grids or filling them in with
colors. Hope that gives you some ideas.

Aug 3 '06 #4
Thank you very much for the feedback and example.

The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.

Christian
bobzimuta wrote:
ka******@hotmail.com wrote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.

Thanks,

Christian

Now that I think of it: best to create a table and overlay it on the
image. You get a nice grid pattern, and it would be easier to work with
if you want to start manipulating the grids or filling them in with
colors. Hope that gives you some ideas.
Aug 3 '06 #5

kaczm...@hotmail.com wrote:
Thank you very much for the feedback and example.

The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.
Will you be 'snapping' the objects to the grid? i.e. once an object is
dragged within a couple pixels of a gridline, it is brought up against
it. That would be pretty cool.

Aug 3 '06 #6
Not sure yet :) My immediate task is to come up with a proof of
concept implementation just involving the grid, but that sounds like a
really good idea. Omly two requirements so far: show/hide the grid,
and adjust the spacing of the grid lines.

bobzimuta wrote:
kaczm...@hotmail.com wrote:
Thank you very much for the feedback and example.

The grid will be used so that users can align objects correctly on the
underlying image, so two requirements would be to turn the grid "on"
and "off", and set the spacing between the lines. Width and color of
the lines in the grid will stay constant.

Will you be 'snapping' the objects to the grid? i.e. once an object is
dragged within a couple pixels of a gridline, it is brought up against
it. That would be pretty cool.
Aug 3 '06 #7
On Thursday 03 August 2006 22:02, ka******@hotmail.com
[ka******@hotmail.com] wrote in message
<11*********************@s13g2000cwa.googlegroups. com>
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay
A table with thin cell borders over the top? Or maybe just use <div>
elements to form a grid?

There might be something[1] server-side which you could install that would
render an on-the-fly overlay grid as a transparent GIF/PNG image.
Is there a way I can leverage some functionality...<snip>
<big smiley for the following>

I *hate* that use of "leverage". What's wrong with "use"
"Is there a way I can use some functionality..."
or
"Is there some function to give me greater leverage..."

but I would have written the second paragraph like this:
"Is there a built-in javascript function to do this?"

See? Simple, quick, clear.
[1] I have speel chucking switchd om nd ths wurd wasnnt higligted when the
'h' was omited. Odd!
Aug 3 '06 #8

PDannyD wrote:
There might be something[1] server-side which you could install that would
render an on-the-fly overlay grid as a transparent GIF/PNG image.
Negates the abillity to move the gridlines around

Aug 3 '06 #9
On Friday 04 August 2006 00:37, bobzimuta [ej******@gmail.com] wrote in
message <11**********************@m73g2000cwd.googlegroups .com>
>
PDannyD wrote:
>There might be something[1] server-side which you could install that
would render an on-the-fly overlay grid as a transparent GIF/PNG image.

Negates the abillity to move the gridlines around
And missed the bit about not wanting to use anything server-side. Doh!
Aug 4 '06 #10

ka******@hotmail.com wrote:
Hey there,

I have a large image in a browser window, and I would like a way to
overlay grid lines on top of the image, so a user can show the grid or
hide the grid lines. The grid would cover 100% of the image, and all I
would need is a set of horizontal and vertical lines over the image to
create a grid overlay

Is there a way I can leverage some functionality in Javascript to do
this? I can't use any server side 3rd party components, and I would
rather not do this using something on the server side like GDI+ through
ASP.NET.
It is quite possible to draw both vertical and horizontal lines using
script to write the necessary CSS. Then the divisions, each with a
unique id, holding the lines can be turned on or off using visibility
as visible or hidden. I have an example that writes extremely fine
lines that can be so controlled, but it is much more elaborate than
what you likely need. Anyway, you can see the page and look at the
source at http://www.cwdjr.info/dhtml/7veilsDance3.html . My lines are
automatically being turned on and off in a sequence to simulate a
curtain pull. You would need to use a button to turn lines on and off
by controlling visibility instead.

Aug 4 '06 #11

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

Similar topics

6
by: R | last post by:
Hello everybody! I'm newbie to JavaScript and I have a basic question. I have X and Y coordinates of A and B points. How can I draw a line connecting A and B? thanks in advance cheers
21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
11
by: srinivas | last post by:
Hi all, I have one requirement.Is there any way to create a line graph using javascript.If it is please send me the sample code.But the thing is it should work in all browsers. Thanks,...
8
by: Frank | last post by:
Hello, I have a form in which I draw a grid in the paint event. Works fine, except when using the scrollbars. Autoscroll is switched on, I use doublebuffering and userpaint and...
3
by: kaczmar2 | last post by:
Hey there, I have a large image in a browser window, and I would like a way to overlay grid lines on top of the image, so a user can show the grid or hide the grid lines. The grid would cover...
1
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If...
4
by: sagar | last post by:
Hello Friends, I am working on a web application in which I have a map loaded on the page and I am required to dynamically draw points, lines, curves on the map to show a location, road etc. ...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
5
by: gaya3 | last post by:
Hi, can anyone find error in the following example <%@ include file="JspBean.jsp" %> <%@ page import="java.util.*"%> <html> <head> <%
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.