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

Liquid layout with resizable sparkline graphs

I need to include some simple (sparkline style) graphs in a web page
that will have a liquid layout. Some viewers will be changing the font
size to suit their display (sizes range from 320 to 2560 pixels). I want
the graphs to change size proportional to the font enlargement viewers
use.

I did this sort of thing once before at
http://cyclonestudios.com.au/aboutus/projects.html
where the little colour patches under each project show which design and
building stages were handled, and the approximate project cost. This was
just done with divs sized using em.

e.g.
<dt>1997 Proserpine Hospital</dt>
<dd>Major Redevelopment in association with Peddle Thorp.
<!--
$7.5m
All stages
-->
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #d6ba1c #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #75fb78 #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #faba75 #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #54a4db #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #6cf0de #444;"></div>
</dd>

Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?

--
http://www.ericlindsay.com
Jun 27 '08 #1
15 2390
Eric Lindsay wrote:
I need to include some simple (sparkline style) graphs in a web page
that will have a liquid layout. Some viewers will be changing the font
size to suit their display (sizes range from 320 to 2560 pixels). I want
the graphs to change size proportional to the font enlargement viewers
use.

I did this sort of thing once before at
http://cyclonestudios.com.au/aboutus/projects.html
where the little colour patches under each project show which design and
building stages were handled, and the approximate project cost. This was
just done with divs sized using em.

e.g.
<dt>1997 Proserpine Hospital</dt>
<dd>Major Redevelopment in association with Peddle Thorp.
<!--
$7.5m
All stages
-->
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #d6ba1c #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #75fb78 #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #faba75 #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #54a4db #444;"></div>
<div style="width: 7.5em; border-style: solid; border-width: 0 0 0.3em
0; border-color: #444 #444 #6cf0de #444;"></div>
</dd>

Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #2
In article
<NO***********************************@freenews.ii net.net.au>,
Eric Lindsay <NO*************@ericlindsay.comwrote:
I need to include some simple (sparkline style) graphs in a web page
that will have a liquid layout. Some viewers will be changing the font
size to suit their display (sizes range from 320 to 2560 pixels). I want
the graphs to change size proportional to the font enlargement viewers
use.

I did this sort of thing once before at
http://cyclonestudios.com.au/aboutus/projects.html
where the little colour patches under each project show which design and
building stages were handled, and the approximate project cost. This was
just done with divs sized using em.

Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
You forgot to say what *you* found unsatisfactory about this approach.
Is that not something relevant? I have some ideas that will give you a
better result if you are concerned abut some particular problems. What
are the problems that concern you?

--
dorayme
Jun 27 '08 #3
In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...
OP's question was not about the particular example.

--
dorayme
Jun 27 '08 #4
dorayme wrote:
In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
>>Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...

OP's question was not about the particular example.
My point is what is wrong with what is simple and works. A bar graph is
a graphic, why not use a graphic? More options and can be very bandwidth
friendly...just don't like the use of empty DIVs...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #5
dorayme wrote:
In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
>>Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...

OP's question was not about the particular example.

Hmm, the OP did ask about a different method. Personally I prefer the
non image style as you can change the color with CSS, the image method
doesn't.

Now, I don't know much about styling lists cross browser, but this could
certainly be done with a list:

<style type="text/css">
ul{margin-left: 0;padding-left: 0;}
li{
background-color: black;
line-height: .5em;
list-style: none;
margin-top: .5em;
}
</style>

<ul>
<li style="width: 4em;background-color: #faba75">&nbsp;</li>
<li style="width: 6em;background-color: #54a4db">&nbsp;</li>
<li style="width: 0.25em">&nbsp;</li>
</ul>

I'd like it if someone would follow up and clean that up. Moz needs
the list to contain something (HENCE THE &NBSP;). Spacing is different
between Moz and IE.

Perhaps a definition list would be the semantically correct way. I
don't have a problem with divs as they have no inherent meaning.

Jeff
Jun 27 '08 #6
Jeff wrote:
dorayme wrote:
>In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
>>>Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?

I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...

OP's question was not about the particular example.


Hmm, the OP did ask about a different method. Personally I prefer the
non image style as you can change the color with CSS, the image method
doesn't.

Now, I don't know much about styling lists cross browser, but this could
certainly be done with a list:

<style type="text/css">
ul{margin-left: 0;padding-left: 0;}
li{
background-color: black;
line-height: .5em;
list-style: none;
margin-top: .5em;
}
</style>

<ul>
<li style="width: 4em;background-color: #faba75">&nbsp;</li>
<li style="width: 6em;background-color: #54a4db">&nbsp;</li>
<li style="width: 0.25em">&nbsp;</li>
</ul>

I'd like it if someone would follow up and clean that up. Moz needs
the list to contain something (HENCE THE &NBSP;). Spacing is different
between Moz and IE.

Perhaps a definition list would be the semantically correct way. I
don't have a problem with divs as they have no inherent meaning.
Ah but now print it and see what you get! Oops no bar graph! Remember,
backgrounds are just decoration not content...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #7
In article <c7***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
dorayme wrote:
In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:
>Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?

I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...
OP's question was not about the particular example.

My point is what is wrong with what is simple and works. A bar graph is
a graphic, why not use a graphic? More options and can be very bandwidth
friendly...just don't like the use of empty DIVs...
It did not seem to me that the OP's question was about *bar graphs* and
certainly not bar graphs in isolation from text...

--
dorayme
Jun 27 '08 #8
Jonathan N. Little wrote:
Jeff wrote:
>dorayme wrote:
>>In article <73***************************@NAXS.COM>,
"Jonathan N. Little" <lw*****@central.netwrote:

Is anyone familiar with a better approach to simple resizable
graphs than just styling divs (or spans probably in the new graphs)
with em sizes?
>
I would use 1-color images that stretch to whatever you need

<img src="bar.gif" height="10" width="50" alt="50%">
<img src="bar.gif" height="10" width="23" alt="23%">...

OP's question was not about the particular example.


Hmm, the OP did ask about a different method. Personally I prefer
the non image style as you can change the color with CSS, the image
method doesn't.

Now, I don't know much about styling lists cross browser, but this
could certainly be done with a list:

<style type="text/css">
ul{margin-left: 0;padding-left: 0;}
li{
background-color: black;
line-height: .5em;
list-style: none;
margin-top: .5em;
}
</style>

<ul>
<li style="width: 4em;background-color: #faba75">&nbsp;</li>
<li style="width: 6em;background-color: #54a4db">&nbsp;</li>
<li style="width: 0.25em">&nbsp;</li>
</ul>

I'd like it if someone would follow up and clean that up. Moz needs
the list to contain something (HENCE THE &NBSP;). Spacing is different
between Moz and IE.

Perhaps a definition list would be the semantically correct way. I
don't have a problem with divs as they have no inherent meaning.

Ah but now print it and see what you get! Oops no bar graph! Remember,
backgrounds are just decoration not content...
Well, you've got a good point there. That leaves you with either
images and a limited palette, or setting a border color on something.

Jeff
Jun 27 '08 #9
Jeff wrote:
>
Well, you've got a good point there. That leaves you with either
images and a limited palette, or setting a border color on something.
Well since an image is employing stretching a single-pixel or
single-pixel-column (if you want to shade your bars) images are very,
very small (a few bytes) so it does not load the page to have many
different images to "expand the palette" of your options.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #10
In article <do**********************************@web.aioe.org >,
dorayme <do************@optusnet.com.auwrote:
In article
<NO***********************************@freenews.ii net.net.au>,
Eric Lindsay <NO*************@ericlindsay.comwrote:
I need to include some simple (sparkline style) graphs in a web page
that will have a liquid layout. Some viewers will be changing the font
size to suit their display (sizes range from 320 to 2560 pixels). I want
the graphs to change size proportional to the font enlargement viewers
use.

I did this sort of thing once before at
http://cyclonestudios.com.au/aboutus/projects.html
where the little colour patches under each project show which design and
building stages were handled, and the approximate project cost. This was
just done with divs sized using em.

Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?

You forgot to say what *you* found unsatisfactory about this approach.
Is that not something relevant? I have some ideas that will give you a
better result if you are concerned abut some particular problems. What
are the problems that concern you?
The approach I used worked fine in the context of the example I gave.
However it worries me because I can find relatively few examples done in
a similar manner. To me, this indicates that perhaps I have simply
failed to understand the problem adequately.

One obvious point is that in Opera when you magnify a page, the entire
contents get magnified. In Firefox and Safari you magnify the fonts, and
other elements styled in ems or as a percentage. In an iPod Touch, there
is no option to magnify fonts alone. Maybe the ability to magnify fonts
alone will disappear from browers.

Google provide their Charts api, that as far as I can see does not
provide any facility to let you magnify a graph after it is generated.
Who am I to say a smart outfit like Google have it wrong?
e.g.
<img border="0"
src="http://chart.apis.google.com/chart?cht=bvs&amp;chd=s:FLRABGLKJLLOH&a
mp;chf=bg,s,ffffde&amp;chco=0000ff&amp;chs=200x124 &amp;chbh=10&amp;chxt=y
&amp;chxr=0,0,62&amp;chtt=Cassettes each day" alt="cassette bar chart">

There is a set of sparkline code in PHP that is widely used. As far as I
can tell, it does not allow you to magnify the resulting sparkline. On
the other hand, I gather there is a variation of it for Wordpress that
does allow the end user to magnify the resulting graph.

Then there is the question of SVG. I have never found it much (well,
any) use, but the very title seems to address the problem I have -
making scalable graphics.

Basically I am worried that I am off somewhere at the end of a limb, and
a bunch of people are busy with saw and axe.

--
http://www.ericlindsay.com
Jun 27 '08 #11
Jonathan N. Little wrote:
Jeff wrote:
>>
Well, you've got a good point there. That leaves you with either
images and a limited palette, or setting a border color on something.

Well since an image is employing stretching a single-pixel or
single-pixel-column (if you want to shade your bars) images are very,
very small (a few bytes) so it does not load the page to have many
different images to "expand the palette" of your options.
Agreed.

But neither one of us really knows what the OP wants, and there are
2^24 colors.

Jeff
Jun 27 '08 #12
Jeff wrote:
Jonathan N. Little wrote:
>Jeff wrote:
>>>
Well, you've got a good point there. That leaves you with either
images and a limited palette, or setting a border color on something.

Well since an image is employing stretching a single-pixel or
single-pixel-column (if you want to shade your bars) images are very,
very small (a few bytes) so it does not load the page to have many
different images to "expand the palette" of your options.
Agreed.

But neither one of us really knows what the OP wants, and there are
2^24 colors.
I can kinda of guess by his example, and I double that he would need all
2^24 colors.
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #13
Jeff wrote:
Jonathan N. Little wrote:
>Jeff wrote:
>>>
Well, you've got a good point there. That leaves you with either
images and a limited palette, or setting a border color on something.

Well since an image is employing stretching a single-pixel or
single-pixel-column (if you want to shade your bars) images are very,
very small (a few bytes) so it does not load the page to have many
different images to "expand the palette" of your options.
Agreed.

But neither one of us really knows what the OP wants, and there are
2^24 colors.
BTW if is he is using PHP, he could generate the image on the fly is he
wished, with all 2^24 colors....

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #14
In article
<NO***********************************@freenews.ii net.net.au>,
Eric Lindsay <NO*************@ericlindsay.comwrote:
In article <do**********************************@web.aioe.org >,
dorayme <do************@optusnet.com.auwrote:
In article
<NO***********************************@freenews.ii net.net.au>,
Eric Lindsay <NO*************@ericlindsay.comwrote:
I need to include some simple (sparkline style) graphs in a web page
that will have a liquid layout. Some viewers will be changing the font
size to suit their display (sizes range from 320 to 2560 pixels). I want
the graphs to change size proportional to the font enlargement viewers
use.
>
I did this sort of thing once before at
http://cyclonestudios.com.au/aboutus/projects.html
where the little colour patches under each project show which design and
building stages were handled, and the approximate project cost. This was
just done with divs sized using em.
>
Is anyone familiar with a better approach to simple resizable graphs
than just styling divs (or spans probably in the new graphs) with em
sizes?
You forgot to say what *you* found unsatisfactory about this approach.
Is that not something relevant? I have some ideas that will give you a
better result if you are concerned abut some particular problems. What
are the problems that concern you?

The approach I used worked fine in the context of the example I gave.
However it worries me because I can find relatively few examples done in
a similar manner. To me, this indicates that perhaps I have simply
failed to understand the problem adequately.
OK, I will ask you another question, I have snipped all your other
worries for the moment because they touch on too much for a simple
martian like me! The question is this:

What have *you* found unsatisfactory about the approach you mention that
worked fine. Find something you want to do that is a reasonable thing to
want where you are *not* happy with this approach regarding images. And
we can discuss it. At the *very least*, we can commiserate together and
say stuff like: "Geez, pity it is no good, lets have a double bourbon..."

--
dorayme
Jun 27 '08 #15
Jeff wrote:
>
Personally I prefer the
non image style as you can change the color with CSS, the image method
doesn't.
Don't forget that CSS is supposed to be optional. What happens with your
method when CSS is disabled?

--
Berg
Jun 27 '08 #16

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

Similar topics

5
by: Charles Blaquière | last post by:
As part of my explorations in liquid design, I'm exploring ways to use the overflow: hidden property -- when browser windows become too narrow, I want (some) images to get cropped rather than have...
8
by: oj | last post by:
Please, bare with me. I'm new to CSS and would like to ask for some advice on my current project. I have an existing table based layout that serves as the main template for a .Net application I've...
3
by: SebiF | last post by:
Hello, It might have been asked before but since I could not find a reference here's my qustion: I want a liquid layout similar to this one:...
1
by: Durabo | last post by:
Hi, i must divide the page of my situated Internet in 3 lines and would want to make in way to have a layout liquid (would have to be adapted therefore to whichever dimension of the window). ...
1
by: billsahiker | last post by:
I learned how to make a page layout liquid so it fills the screen regardless of resolution, but I do not see how to do that with a project that uses master page. Is there a way? My understanding...
4
by: ge5talt | last post by:
Longtime reader, 1st time poster :) I am in the process of overhauling a website and replacing an old table-based quirksmode layout with a standards-mode tableless one. I am currently working on...
9
by: Eric Lindsay | last post by:
How do you provide a consistent gradient fill as a background in a liquid layout? If I make a gradient fill image say 1000 pixels wide (and repeat it down the page) to suit a typical computer...
1
by: hansBKK | last post by:
Here's a (new?) variation on using negative margins to get a three- column layout - I've used the example HTML from A List Apart's article by Alan Pearce: ...
5
by: lorlarz | last post by:
Sparkline Graphs no longer work in Firefox. I am pissed. Does anyone care? Here is what used to run in FireFox 1.5 and 2, but no longer works in Firefox 3 (not on PC or Linux anyway). Anyone...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.