JavaScript - Create Graphs/chart
is there a ways in javascript to create graphs chart? i can't seem to find a code on the internet
Similar TutorialsI run a christian ministry that mentors kids. One aspect of this is tracking their chores. All of the online sticker charts we have used over the yrs have vanished. Currently we are using one that only puts checkmarks in the squares and the kids are bored with it. So I want to create a clickable table that puts an icon in the cells on click. I know a little html and ive designed websites with a visual editor. If someone could please point me in the right direction where I would even begin to learn how to create the script I described it would be greatly appreciated. In case it is not clear what I would like to create this video shows the most recent site we used.( hopefully including the link is not advertising since the site shown in the video is gone. If it is I apologize) It is no longer up. Hence my wanting to create a similar script that can be added to our church's website. thanks again for any guidance. a bit of an aside please don't just suggest we use an app. I know there are apps out that do what I described and more but, an online version is preferable because the kids don't live with their mentors. Also some of them only have computer access at the library. so it is unreasonable to expect them to have a smart phone or tablet. Reply With Quote 01-10-2015, 10:42 PM #2 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts Well, just to start with, you are going to need "baqkend" code. That is, you will need a database where all the information can be recorded and server-side code to maintain and access that information. The most likely candidate for this would be a MySQL database and PHP code to interface to it and to produce the web pages. You really have no choice but to do it this way: If the child used the exact same computer *AND* had an account on that computer, then you could do it by saving the information on that computer. But with a library-based computer, (a) accounts are anonymous, not assigned [typically] and (b) the child may not be able to use the exact same computer on subsequent days. By doing the bulk of the work on a server, you ensure that any computer (or pad or phone) can access the same information and present the same interface (or perhaps a modified interface for smaller screens). This is *NOT* a trivial task. Never mind the pretty graphics: Just the code behind the scenes is enough that nobody is going to do it in a few days (or at least is not going to get it right in a few days). You have to locate a host ($$ per month/year), get a domain name ($$ per year), create a database, create the tables in that database, write the PHP code to modify the database, write the PHP code to access the database, write the PHP code to create the HTML pages, create the icons and other graphics for the pages, and so on. Hi everyone, I am new to web development. The company I am working for would like to develop a data analysis web interface. This interface would take information from a mySQL database from certain queries and then save the data into an array. After this the data would be exported to Microsoft Excel where a Chart would be created and then uploaded to the web interface. So far I have been able to store the mySQL data into an array but I have been having trouble trying to determine if you can in fact use javascript to tell Excel to create the chart. Any help would be greatly appreciated. Hi, I have been trying to create a google graph from an input combobox but I'm having trouble passing the variable to the query on the spreadsheeet. The graph is able to query the spreadsheet when I don't use a varible, and my combobox is recieveing the variable but I'm having trouble connecting the two. The code I'm trying to use is below and I also attached a text file, so any help would be so fantastic! This is the code I have for it: Code: <!-- try 1 Rivas, try 2 San jose You are free to copy and use this sample in accordance with the terms of the Apache license (http://www.apache.org/licenses/LICENSE-2.0.html) --> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title> Google Visualization API Sample </title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['linechart']}); </script><script src="http://www.google.com/uds/?file=visualization&v=1&packages=linechart" type="text/javascript"></script><script src="http://www.google.com/uds/api/visualization/1.0/3dc85ad905db9d2ce85ec8d8389c32d5/default,browserchart,linechart.I.js" type="text/javascript"></script> <script type="text/javascript"> function storeValue(obj){ if(obj.selectedIndex == 0){return;} var MonthChosen = obj.value; alert('You chose: '+ MonthChosen); } window.onload = function(){ document.getElementsByName('combo1')[0].onchange=function(){storeValue(this);} } var visualization; function drawVisualization() { // To see the data that this visualization uses, browse to // http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ var query = new google.visualization.Query( 'https://spreadsheets.google.com/ccc?key=0Ais9xMj35wQmdDBTMUxHRS1CRHVkcGI4dnZ0c2xLZXc&hl=en'); // Apply query language. query.setQuery('SELECT H WHERE E ="MonthChosen" ORDER BY F'); // Send the query with a callback function. query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); visualization = new google.visualization.LineChart(document.getElementById('visualization')); visualization.draw(data, {legend: 'bottom'}); } google.setOnLoadCallback(drawVisualization); </script> <h2> What month would you like to see the 10 year comparative data from?</h2> <form> <table> <tbody><tr> <td>Combo Box</td> <td> <select id="combo1" name="combo1" onchange="input1.value = combo1.value"> <option value="’1’">January</option> <option value="’2’">February</option> <option value="’3’">March</option> <option value="’4’">April</option> <option value="’5’">May </option> <option value="’6’">June </option> <option value="’7’"> July</option> <option value="’8’">August </option> <option value="’9’">September </option> <option value="’10’">October </option> <option value="’11’">November </option> <option value="’12’">December </option> </select> </td> </tr> <tr> <td>Input Box</td> </tr> </tbody></table> </form> <div id="visualization" style="height: 400px; width: 400px;"></div> Hello here is another one i need suggestions on here is my coding so far <html> <head> <!-- New Perspectives on JavaScript Tutorial 3 Case Problem 2 Congressional Election Results Author: Date: November 14 2010 Filename: election.htm Supporting files: back.jpg, logo.jpg, results.css, votes.js --> <title>Congressional Races</title> <link href="results.css" rel="stylesheet" type="text/css" /> script type="text/javascript" src="votes.js"></script> <script type="text/javascript"> // script element to add the votes.js function totalVotes(votes){ // script element that will calculate the array var total = 0; for (var i = 0; i < votes.length; i++); { total = total + votes[i]; } return total; } function calcPercent(item,sum){ // script element to calculate the percentage which is rounded to the nearest integer var item = Math.round((item/sum))*100); // script element to get the percentage return item; } calcPercent(); function createBar(partyType,percent){ // script element to create blank cells switch(partyType) { case D: <td class='dem'></td> break; case R: <td class='rep'></td> break; case I: <td class='ind'></td> break; case G: <td class='green'></td> break; case L: <td class='lib'></td> break; } var barTxt = partyType; for (i=0; i < percent; i++){ document.write(barText); } } function showResults(race,name,party,votes){ // script element to display the results of a particular race var totalIV = totalVotes(votes); document.write("<h2>race</h2>"); document.write("<table cellspacing='0'>"); document.write("<tr>"); document.write("<th>Candidate</th>"); document.write("<th class ='num'>Votes</th>"); document.write("<th class='num'>%</th>"); document.write("</tr>"); for (var i=0; i < name.length; i++){ document.write("<tr>"); document.write("<td>name(party</td>"); document.write("td class='num'>"votes</td>"); var percent=calcPercent(votes[i], totalV) document.write("<td class='num'>(" + percent +"%)</td>"); createBar(party[i],percent) document.write("</tr>"); } document.write("</table>"); } </script> </head> <body> <div id="intro"> <p><img src="logo.jpg" alt="Election Day Results" /></p> <a href="#">Election Home Page</a> <a href="#">President</a> <a href="#">Senate Races</a> <a href="#">Congressional Races</a> <a href="#">State Senate</a> <a href="#">State House</a> <a href="#">Local Races</a> <a href="#">Judicial</a> <a href="#">Referendums</a> </div> <div id="results"> <h1>Congressional Races</h1> <script type="text/javascript"> showResults(race[0],name1,party1,votes1)... showResults(race[1],name2,party2,votes2)... showResults(race[2],name3,party3,votes3)... showResults(race[3],name4,party4,votes4)... showResults(race[4],name5,party5,votes5)... </script> </div> </body> </html> ______________ What i need to do is make a bar charts of elections people on the assignment, using 2 other files on a folder the names of the other files are votes.js and results.css here is the link of the actual question it is case problem 2 if u scroll down at http://books.google.ca/books?id=aG_T...Cell()&f=false right now i did up my coding and still nothing is working what does seem to be wrong with my coding? any suggestions from anyone? or hints even? thanks I am currently working on a project that requires me to get data from a mySQL database in order to create multiple (bar) graphs. I will then display these graphs in the corresponding location using Google Maps. I am having trouble trying to find out how to implement this. Do you guys have any suggestions. Thanks.
Hi, I was wondering if someone could help me out by providing me with the code which allows the chart to slide on (click on Report a Link , right next to the search box): http://www.watchseries-online.com/20...x9-improv.html I need to imporove the way this functions on my site. Here is how the report a link functions on my site: 1. go to http://tehcake.com/video/Simpsons/6x9 Look right below the video and right above the chatbox " Report Broken Episode/ Problem " if you click on the link, it takes you to another pages where the form is located. I would like to change it so that when a user clicks on " Report Broken Episode/ Problem ", then it simply relveals a sliding down chart that operates like the one found at http://www.watchseries-online.com/20...x9-improv.html (where it says : [!] REPORT A LINK in red text, to the left of the searchbox click on that, then click submit. It is not only better looking but also submits without even leaving the page) Hi, I would like to use the following chart in my webpage http://people.iola.dk/olau/flot/examples/visitors.html the data being used in the chart example above looks like this: [1196722800000, 77], [1196809200000, 3636], [1196895600000, 3575], ... I guess that the long number is the date?! The data I have is: a date that is coming from my database which was added using the date(); object and a numerical figure such as 21.365 or 30.432 or 36.856 here is my code below currently in a list format (HTML): Code: <script type="text/javascript" charset="utf-8"> var html5rocks = {}; html5rocks.webdb = {}; html5rocks.webdb.db = null; html5rocks.webdb.open = function() { var dbSize = 10 * 1024 * 1024; // 10MB html5rocks.webdb.db = openDatabase("Todo", "1.0", "Todo manager", dbSize); } html5rocks.webdb.createTable = function() { var db = html5rocks.webdb.db; db.transaction(function(tx) { tx.executeSql("ALTER TABLE bmical ADD bmires INTEGER"); tx.executeSql("CREATE TABLE IF NOT EXISTS bmical(ID INTEGER PRIMARY KEY ASC, height1 TEXT, weight1 TEXT, bmires TEXT, added_on DATETIME)", []); }); } html5rocks.webdb.addTodo = function(todoText) { var db = html5rocks.webdb.db; db.transaction(function(tx){ var weight1 = document.getElementById("weight1").value; var height2 = todoText / 100 var BMI = weight1 / (height2 * height2) var BMI = BMI; var bmires = BMI.toFixed(3); var addedOn = new Date(); tx.executeSql("INSERT INTO bmical(height1, weight1, bmires, added_on) VALUES (?,?,?,?)", [todoText, weight1, bmires, addedOn], html5rocks.webdb.onSuccess, html5rocks.webdb.onError); }); } html5rocks.webdb.onError = function(tx, e) { alert("There has been an error: " + e.message); } html5rocks.webdb.onSuccess = function(tx, r) { // re-render the data. html5rocks.webdb.getAllTodoItems(loadTodoItems); } html5rocks.webdb.getAllTodoItems = function(renderFunc) { var db = html5rocks.webdb.db; db.transaction(function(tx) { tx.executeSql("SELECT * FROM bmical ORDER BY added_on DESC", [], renderFunc, html5rocks.webdb.onError); }); } html5rocks.webdb.deleteTodo = function(id) { var db = html5rocks.webdb.db; db.transaction(function(tx){ tx.executeSql("DELETE FROM bmical WHERE ID=?", [id], html5rocks.webdb.onSuccess, html5rocks.webdb.onError); }); } function loadTodoItems(tx, rs) { var rowOutput = ""; var todoItems = document.getElementById("todoItems"); for (var i=0; i < rs.rows.length; i++) { rowOutput += renderTodo(rs.rows.item(i)); } todoItems.innerHTML = rowOutput; } function renderTodo(row) { return "<li>On: " + row.added_on + " Height: " + row.height1 + " Weight: " + row.weight1 + " BMI: " + row.bmires + "<a class='delete' href='javascript:void(0);' onclick='html5rocks.webdb.deleteTodo(" + row.ID +");'>Delete</a></li>"; } function init() { html5rocks.webdb.open(); html5rocks.webdb.createTable(); html5rocks.webdb.getAllTodoItems(loadTodoItems); } function addTodo() { var height1 = document.getElementById("height1"); html5rocks.webdb.addTodo(height1.value); height1.value = ""; } </script> the 2 variables I'd like to use a bmires, addedOn Can anyone help me get a start to make a tournament chart that assighs a value to each player and depending on that value it beats a other player.
Hey all i am in need of some help trying to figure out how to pass a string into an array field for a chart. The chart i am using is this [http://www.highcharts.com/] Here is the chart code: Code: function drawChart(theDATA) { var chart = new Highcharts.Chart({ chart: {renderTo: 'container',defaultSeriesType: 'column'}, title: {text: 'March 2010 Confirmed User Visit\'s'}, xAxis: {categories: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']}, yAxis: {min: 0,title: {text: 'User Visit\'s'}}, legend: {layout: 'vertical',backgroundColor: '#FFFFFF',style: {left: '100px',top: '70px',bottom: 'auto'}}, tooltip: {formatter: function() {return this.y;}}, plotOptions: {column: {pointPadding: 0.2,borderWidth: 0}}, series: [{name: 'Confirmed Users Visit\'s', data: theDATA.split(',') }] }); } With the code above, you would think that theDATA would work but it does not display the data within it. Say that theDATA is '2,5,4,7,8,9'. If i had this: Code: data: [2,5,4,7,8,9] Then it would work just fine. But if i use those same numbers... Code: theData = "2,5,4,7,8,9" data: theDATA.split(',') It does nothing on the chart... So what am i doing wrong???? David problems with google line chart. Hi there. I use this line chart and I notice that the more data it reads, the more lines disappears. https://developers.google.com/chart/...lery/linechart We take for example this data ['15 .30 ', 9038], ['', 9.04]; ['', 9.02]; ['', 9.03]; ['', 9.0268], ['', 9.04]; ['', 9.0393], ['', 9:06] ['16 .00 ', 9058], ['', 9.09]; ['', 9075]; ['', 9:08] ['', 9052]; ['', 9.07]; ['', 9:06] ['', 9.0704], ['17 .30 ', 9.07]; Then the row ['16 .00 ', 9058], disappear because it is so much data, and take the most important thing to be able to see a good line chart. The Line chart work well, but I would like to know how to change the code so it becomes mandatory that the program must read the rows that have a number as the first element( example ['element' element]). If the first element does not contain any such number, the program may determine whether to print it or not. To make it a little easier stated, I can say that the row who have the first element, who contains a number, so most the code read it to the screen. Thanks. I am really new to coding and am trying to include a flowchart that I have created on my site. There is a series of 5 questions with 2 possible answers for each question. Can anyone help me with some coding that would let me show only the first question and based on how they answer that, the flow chart would open up to the second question and once they answer the second question, it opens up to the third question and so on?
Hey all, I want to be able to update the line chart of google visualizations. Here is my code in question: http://jsfiddle.net/YCqyG/5/ Click the button called "click" and suddenly chart disappears. thanks for response How can i create an image rotator just like in redtube.com. When mouseenter it changes the img's src. When mouseleave it returns the default src. Ps: sorry abou the website font.hehe Hi all Not sure how to tackle this. I haven't done any DOM manipulation and this is a tag within a tag. Another thing is submit is Ajax and therefore can be hit many times --- so I guess I need to also check if element already exists. The result comes back from PHP and I think wipes out anything in the result area. I want to create this: Code: <span id="loading"><img src="loading.gif" /></span> Code: <div id="results">which should populate here</div> <script type="text/javascript"> function loading(){ ? </script> <input type="button" name="submit" id="submit" onclick="loading();"/> How do I begin this? Help appreciated. LT oh this is my Ajax just in case what i'm trying to do should be done from here. Code: <script type="text/javascript"> $(document).ready(function() { $('#submit').click(function(){ //Get the values var amount = $('#amount').val(); var from = $('#from').val(); var to = $('#to').val(); var params = "amount=" + amount + "&from=" + from + "&to=" + to; $.ajax({ type: "POST", url: "change.php", data: params, success: function(data){ $('#results').html(data).fadeIn("slow"); } }); }); }); </script> hello friends.. I am working on the html code in which i using the List Control The Requirement that among the List element in which I choose the locations there is option in which whenever i select the option None From The List then it should Disply the empty textbox So how the function is declared Please tell me... I have a question, How do you create a slider for a website? I am not familiar with anything but html and css, but I would like to create a simple image slider for my site. How would I go about doing that? Any help is appreciated Thanks I am trying to create a basic javascript that shows milage between severag areas, similar to what you find on the rear road atlas. I have tried and failed to create anything, i just think i am total useless at understanding javascript. The basic concept is this image attached. There would be a drop down box that lists the destinations and another with the same but would be departure. When a person chooses example: Butte >>> Kalipsell it would show 238 and vice versa. it seems a simple thing to do but cant get my head around it all. Could someone create a simple script, say 3 destinations and i will fill the rest in and see if i can understand what i am doing and then ask for additional help if required? Hi I wanted to create multiple check box and once check box is clicked user should able to enter text and submit so i created this but when check box toggle it keep creating text areas. i wanted to create 1 text area per one check box also i need to store each text area value to data base. how can i correct this to achieve my needs PHP Code: <script type="text/javascript"> function validate(chk){ if (chk.checked == 1){ var htmlText = "<textarea name='area' cols='40' rows='5'></textarea>"; var newElement = document.createElement('div'); newElement.id = 'text'; newElement.innerHTML = htmlText; var fieldsArea = document.getElementById('text'); fieldsArea.appendChild(newElement); }else {} } </script> <form> <label>option1 <input type=checkbox name=chk1 onclick="return validate(chk1);"></label> <label>option2 <input type=checkbox name=chk2 onclick="return validate(chk2);"></label> </form> <div id="text"></div> Sorry for the language errors Regards. I have a select with a OnChange Function. I would like to know how to create a different object depending on the selection on the Select. Example: MySelect have Option 1 and Option 2, so If (Myselect.value == Option 1) {Create Object 1} If (Myselect.value == Option 2) {Create Object 2} I'm using the object under <body> and it's working, but when I'm trying to use it under a <script> does not work. This is the object I'm trying to create: (It is a map) so what I'm trying is to change the values or map depending on the selection of the Select. <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="900" height="600" id="zoom_map" align="top"> <param name="movie" value="us_albers.swf?data_file=senate.xml" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="us_albers.swf?data_file=senate.xml" quality="high" bgcolor="#FFFFFF" width="100" height="100" name="Clickable U.S. Map" align="top" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed> </object> Thank you very much Hello, I want to create a page that allows the user to select 2 images as options, when they click one, a new page is dynamically loaded with a list of options they can choose again (like a sublevel of the image they clicked on). From there it will just continue moving down like a hierachy Can someone help me with the basic script forthis to work so i can mess with it and edit it to my needs ^ Thank you in advance |