Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

javascript simple horizontal bar graph

Posted on 2011-02-24
2
Medium Priority
?
698 Views
Last Modified: 2012-05-11
Hi,
I have a grid table with data.
I want to add a column that shows horizontal bar graphs as in the picture.
I don't want a large library (I am already using "FusionChartsFree" for graphs).
I supose it can be dont with a simple script.
ScreenShot-4776.jpg
0
Comment
Question by:VapiSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 34976838
something like this?
you can change the color if you want to:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<script>
		function showGraph()
		{
			var innerDiv = document.getElementById("div1").getElementsByTagName("div")[0];
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.width = innerDiv.innerHTML + "px";
			innerDiv.innerHTML = innerDiv.innerHTML + "%"


			var innerDiv = document.getElementById("div2").getElementsByTagName("div")[0];
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.width = innerDiv.innerHTML + "px";
			innerDiv.innerHTML = innerDiv.innerHTML + "%"


			var innerDiv = document.getElementById("div3").getElementsByTagName("div")[0];
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.width = innerDiv.innerHTML + "px";
			innerDiv.innerHTML = innerDiv.innerHTML + "%"


			var innerDiv = document.getElementById("div4").getElementsByTagName("div")[0];
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.backgroundColor = "pink";
			innerDiv.style.width = innerDiv.innerHTML + "px";
			innerDiv.innerHTML = innerDiv.innerHTML + "%"



		}
	</script>
	<style>
		body div
		{
			width:100px;
			height:30px;
			background-color:#fff;
			border:1px solid black;
		}
		div div
		{
			border:1px none black;
			border-right:1px solid black;
			height:100%;
		}

	</style>
</HEAD>

<BODY onload="showGraph()">
	<div id="div1"><div>60</div></div>
	<div id="div2"><div>40</div></div>
	<div id="div3"><div>60</div></div>
	<div id="div4"><div>80</div></div>
</BODY>
</HTML>

Open in new window

0
 

Author Closing Comment

by:VapiSoft
ID: 34976887
Exactly.
Thank you very much.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question