Having a working knowledge of XHTML and CSS when developing applications
is a big help in knowing what can be done client-side and what should be
generated server-side.

Recently we’ve had to tackle some interesting visualizations which we coded in XHTML and CSS. The method we used, while fairly simple, was a big help to the engineer and created a very flexible and inexpensive solution. We thought we would share our solution and code in case anyone else ran against similar situations.

Update

I posted a live example page with everything in tact. So far I’ve only been able to test in Firefox 1.0.7, Firefox 1.5, IE 6, Safari 1.3.3, and Opera 9(TP1). You can view it here.

Basic CSS Bar Graph

This is a simple bar graph we developed for a tool we’re releasing shortly for our client. The concept is simple, utilize the percentage width abilities of CSS to accurately portray a percentage bar graph.

<style>
dl {
margin:;
padding:;
}
dt {
position: relative; /* IE is dumb */
clear: both;
display: block;
float: left;
width: 104px;
height: 20px;
line-height: 20px;
margin-right: 17px;
font-size: .75em;
text-align: right;
}
dd {
position: relative; /* IE is dumb */
display: block;
float: left;
width: 197px;
height: 20px;
margin: 0 0 15px;
background: url("g_colorbar.jpg");
}
* html dd { float: none; }
/* IE is dumb; Quick IE hack, apply favorite filter methods for
wider browser compatibility */ dd div {
position: relative;
background: url("g_colorbar2.jpg");
height: 20px;
width: 75%;
text-align:right;
}
dd div strong {
position: absolute;
right: -5px;
top: -2px;
display: block;
background: url("g_marker.gif");
height: 24px;
width: 9px;
text-align: left;
text-indent: -9999px;
overflow: hidden;
}
</style>
<dl>
<dt>Love Life</dt>
<dd>
<div style="width:25%;"><strong>25%</strong></div>
</dd>
<dt>Education</dt>
<dd>
<div style="width:55%;"><strong>55%</strong></div>
</dd>
<dt>War Craft 3 Rank</dt>
<dd>
<div style="width:75%;"><strong>75%</strong></div>
</dd>
</dl>

Vertical CSS Bar Graph

In this third example, we utilize the same principle vertically and reproduce it multiple times to create a more complex graph. This particular solution was a relief the to client and engineer as all they had to do was calculate percentages, and the look of the graph was much better than their stock graphing component.

<style>
#vertgraph {
width: 378px;
height: 207px;
position: relative;
background: url("g_backbar.gif") no-repeat;
}
#vertgraph ul {
width: 378px;
height: 207px;
margin:;
padding:;
}
#vertgraph ul li {
position: absolute;
width: 28px;
height: 160px;
bottom: 34px;
padding: 0 !important;
margin: 0 !important;
background: url("g_colorbar3.jpg") no-repeat !important;
text-align: center;
font-weight: bold;
color: white;
line-height: 2.5em;
} #vertgraph li.critical { left: 24px; background-position: 0px bottom !important; }
#vertgraph li.high { left: 101px; background-position: -28px bottom !important; }
#vertgraph li.medium { left: 176px; background-position: -56px bottom !important; }
#vertgraph li.low { left: 251px; background-position: -84px bottom !important; }
#vertgraph li.info { left: 327px; background-position: -112px bottom !important; }
</style>
<div id="vertgraph">
<ul>
<li class="critical" style="height: 150px;">22</li>
<li class="high" style="height: 80px;">7</li>
<li class="medium" style="height: 50px;">3</li>
<li class="low" style="height: 90px;">8</li>
<li class="info" style="height: 40px;">2</li>
</ul>
</div>

We hope you enjoyed our examples and find new uses and variations for
the concept. Drop us a line if you have any other interesting
visualizations using XHTML and CSS and we’ll post them here.

CSS For Bar Graphs(maybe old)的更多相关文章

  1. 图表|Line graphs|Bar graphs|Pie graphs|Scatter graphs|标目|标值|图解|图题|标值|

    科研论文写作-图表 图像的特点是直观性高效,可用于描述非线性关系,将文字难以描述的内容表达出来. Line graphs中有自变量和因变量,用于表示变化趋势.为了清晰简洁和易于辨认,所以其中的线条最好 ...

  2. R Graphics Cookbook 第3章 – Bar Graphs

    3.1 基本条形图 library(ggplot2) library(gcookbook) pg_mean   #这是用到的数据   group weight 1  ctrl  5.032 2  tr ...

  3. [转]一些实用的图表Chart制作工具

    最近工作过程中需要用到前端一些JS框架,看到一篇博文就转过来备份使用,后续会再完善一些材料.   Flot   Flot一个纯javascript绘画库,基于jQuery开发.它能够在客户端根据任何数 ...

  4. 关于 CSS 反射倒影的研究思考

    原文地址:https://css-tricks.com/state-css-reflections 译者:nzbin 友情提示:由于演示 demo 的兼容性,推荐火狐浏览.该文章篇幅较长,内容庞杂,有 ...

  5. Safari HTML5 Canvas Guide: Creating Charts and Graphs

    Safari HTML5 Canvas Guide: Creating Charts and Graphs Bar graphs are similar to data plots, but each ...

  6. HTML5+CSS+JQuery 实现简单的进度条功能

    样式: <style type="text/css"> .processcontainer2{ width:450px; border:1px solid #6C9C2 ...

  7. 数据可视化(4)--jqplot

    本来打算继续研究Google Charts,但上头下了指示让看jqplot,无奈,只好先将Google Charts放一放,不过真心觉得Google Charts不错,现在先开始jqplot. jqP ...

  8. github上所有大于800 star OC框架

    https://github.com/XCGit/awesome-objc-frameworks#awesome-objc-frameworks awesome-objc-frameworks ID ...

  9. 25个免费的jQuery/ JavaScript的图表和图形库

    1.  JS Charts Features Prepare your chart data in XML, JSON or JavaScript Array Create charts in dif ...

随机推荐

  1. C#winform中ListView及ContextMenuStrip的使用

    1.新建一个Windows窗体应用程序 2.添加文件夹及图片资源 文件夹图片(folder.png),文件图片(file.png) 3.在设计模式下添加控件 即:1个ListView(lvwData) ...

  2. selenium测试套件

    1.测试套件测试套件,简单理解就是讲多个用例,装在一个容器里来同时执行完成. 2.测试套件分析 #coding=utf-8 import unittestimport BaiDuSearch,BaiD ...

  3. 自定义UserProvider,更改验证方法

    新建UserProvider,如果继承EloquentUserProvider,注入model是必须的,或者去继承interface,自己实现一些方法 use Illuminate\Auth\Eloq ...

  4. Delphi结构体数组指针的问题

    //这段代码在Delphi 2007和delphi 7下是可以执行的,所以正确使用结构体数组和指针应该是这样的,已验证 unit Unit1; interface uses Windows, Mess ...

  5. 三种查看SqlServer中数据物理pge页的方法

    1.根据数据记录查看当前记录所在的文件编号.page页.以及在页中的插槽. 示例如下: SELECT top %%physloc%%, sys.fn_physlocFormatter (%%physl ...

  6. Bulk Insert & BCP执行效率对比(续)

    上回由于磁盘空间(约70G)不足,导致Bulk Insert和BCP导入中途失败:今次统一一些操作,以得到Bulk insert与BCP分别执行效率: 1. 15435390笔数据,21.7G csv ...

  7. MongoDB常用操作总结

    ====================================MGDB的操作====================================== 0.创建数据库时使用(use 数据库 ...

  8. SQLAlchemy 一对多

    下述範例描述了電影同導演的多對一關係.範例中說明了從用戶定義的Python類建立數據表的方法,雙方關係例項的建立方法,以及最終查詢數據的方法:包括延遲載入和預先載入兩種自動生成的SQL查詢. 結構定義 ...

  9. python入门 2014-3-21

    刚吃完饭,写一会python 准备去上课,哇咔咔! 1.python是动态类型语言,也就是说 不需要预先声明变量的类型. 不支持 自增++ , 自减--

  10. Ubuntu 14.04安装OpenCV 3.1

    从OpenCV官网上下载OpenCV官网上下载OpenCV的未编译源代码: 点击这里 国内很多网络打开OpenCV官网速度缓慢,可以点击如下地址直接从GitHub上下载OpenCV 3.1的源代码 下 ...