JavaScript - Using My Data In A Chart?! - Please Help
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 Similar TutorialsHey 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 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?
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.
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) is there a ways in javascript to create graphs chart? i can't seem to find a code on the internet
I 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. 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. 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. 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 Hi, I have a div "bigPicture" which contains an image of Thai food. Image can change based on a users onclick of thumbnails. Each image as it passes through div "bigPicture" needs to have the values: price, description and Date,Time associated with it. How do I assign those values and use them later in a Shopping Cart environment. I have tried getelementbyId.innerHTML using alert to see what I can get but it is too much information. website address is http://www.kohchangbookingandinforma.../ATT/index.asp Thanks for your consideration Robby Anyone that can help on this one it would be greatly appreciated... I need to make a form parses a result from column 1 of txt/csv file that has 7 columns. Column 1 is pay, column 2-7 are how many and the associated rows are the answers. In short 1 2 3 4 5 6 700 50 55 62 75 80 99 so if the customer enters i make 700 and i need 2 the result would be 55 as the output. Any idea on how to make that work with javascript? if (pay <=700 && widgets = 2) { document.write(55) elseif (pay <=700 && widgets = 1) document.write(50) is this doable and is it the easiest way to accomplish this? Hi, I am trying to pass data from one page to the next using a search. I have a search engine and im trying to get it to pass the data of the search to the search results page. im using this code
Code: <script type="text/javascript"> window.onload = function (){ try{document.getElementById('q').focus();}catch(e){} } function search() { var search_text = document.getElementById('q').value; window.location = '/search/'+encodeURI(search_text)+'/'; return false; } </script> and I am using this for the search Code: <form action="/search/" method="post" onSubmit="return search();"> <input type="text" id="q" name="q" value="" class="searc" style="width:350px; height:30px; font-size:18px; color:#C19051" /> <input type="submit" style="height:30px;" value="Search" class="submit"/> </form> Can anybody help me with this? Thanks I am still learning HTML, JavaScript and web design, so be patient with and reply in details. I want to be able to send data store in JavaScript variable to my email account. I have tried using mailto: command and for some reason it doesn't work. C Can someone please show me how to in details. Code: rownumber = 2; detailsTable = document.getElementsByName("detailsTable"); detailsRow = detailsTable.getElementsByTagName("tr")[rownumber]; name = detailsRow.getElementsbyTagName("td")[0]; address = detailsRow.getElementsbyTagName("td")[1]; address2 = detailsRow.getElementsbyTagName("td")[2]; phone = detailsRow.getElementsbyTagName("td")[3]; email = detailsRow.getElementsbyTagName("td")[4]; alert(name); I have been told if I want to get the text from each cell I can use: alert(name.firstChild.nodeValue); But I don't understand how to do this for what I am wanting to do. Here is my HTML: Code: <table border="0" name="detailsTable"> <tr> <td>a</td> <td>b</td> <td>c</td> <td>d</td> <td>e</td> </tr> </table> need help.... I need to create a web page that can pull data from sensatronics senturion sensor probe. The unit has a web server that displays temperature, humidity,etc. You can also query it for from telnet or webpage which kicks back xml. My page needs to read the values of the probes. I don't know much about javascript and have been unsuccessful trying to use httprequest. I guess this would be considered cross domain as well? Here is the XML that is generated from the unit. I get this by pulling through a web browser x.x.x.x/xmldata Thanks <?xml version="1.0" encoding="ISO-8859-1"?> <Sensatronics id="S10604" hb="10554"> <Group id="1"> <Probe id="100"><Value>75.2</Value></Probe> </Group> <Group id="2"> </Group> <Group id="3"> </Group> <Group id="4"> </Group> <Group id="5"> </Group> <Group id="6"> </Group> <Group id="7"> </Group> <Group id="8"> </Group> <Group id="9"> <Probe id="99"><Value>1.0</Value></Probe> <Probe id="1"><Value>79.5</Value></Probe> <Probe id="2"><Value>34.3</Value></Probe> <Probe id="3"><Value>35.6</Value></Probe> <Probe id="4"><Value>0.0</Value></Probe> </Group> </Sensatronics> Html Code Code: <div id="itemStockUnit"> Qty <input type="text" size="2" value="1" class="quantity"> <select id="stockUnit" style="width:100%"> <option rel="Window1;7-10;153.00;140.24;">615W x 705H (mm)</option> <option rel="Windows2;7-10;187.00;171.09;">625W x 745H (mm)</option> <b>Delivery:</b> <span id="itemDeliveryTime">7-10</span> days <br> <small><b>RRP:</b> £<span id="itemRRPPrice">153.00</span></small> <br> <b>Our Price: <span id="itemOurPrice">£140.24</span></b> </div> JavaScript Code: <script type="text/javascript"> google.setOnLoadCallback(function() { $("#stockUnit").change(function(){ var data = ($("option:selected",this).attr("rel")).split(";"); $("#itemDeliveryTime").fadeOut().html(data[1]).fadeIn(); $("#itemRRPPrice").fadeOut().html(data[2]).fadeIn(); $("#itemOurPrice").fadeOut().html(data[3]).fadeIn(); }); }); </script> I have set data types to each option however the javascript above doesnt make it change any help? A minor modification to the http://smoothiecharts.org/ example. line2.append(new Date().getTime(), Math.random()); becomes line2.append(new Date().getTime(), updist()); var x = 0; function updist() { x = ("<?PHP phpread() ?>"); return (x); } <?php function phpread() { $t=$x=$y=$z=0; $fd = fopen ("/tmp/seis", "r"); // /tmp/seis is a single line that changes 20/sec $foo = fscanf ($fd, "%s", &$t); fclose($fd); $i = explode (",", $t); echo "$i[2]"; // should go: 2 7 9 4 0 -1 -8 -4 -5 2....... instead I get 2 2 2 2 2 2 2 2 } ?> ---------------- So "line2.append..." calls updist which calls phpread which works fine - once. It's as if the phpread caches the results of the read and never rereads the file. I'm snowed. Thanks Chuck I have a some code that I have been working on but I do not have the greatest understanding of cookies. If someone could help me out with this it would be greatly appreciated. Basically I have a cookie called webvpn and I need the data from the content part of the cookie. Then I need to use that at the beginning of my url. The content looks something like this, 791152394@265814016@1305568856@B762F295B8829D242481C9DD285D0339A719D96C So I need to get the data from content and then use that in the code where it says VARFROMCOOOKIEHERE then basically the rest of the link goes after it. Here is what I have so far: Code: <html> <body> <script language="javascript" type="text/javascript"> if (navigator.appVersion.indexOf("Mac")!=-1){ var str = "Smart-Tunnel Test MACS"; document.write(str.link("https://thenet.cckl.org/+CSCOE+/tunnel_mac.jnlp?app=/Applications/Firefox.app/Contents/MacOS/firefox-bin&url=http%3A%2F%2Fgroups%2Fpsnet%2FDirect.htm")); } else { var str = "Smart-Tunnel Test IE"; document.write(str.link("https://thenet.cckl.org/+CSCOE+/appstatus/VARFROMCOOKIEHERE?method=get&query=startstpage&url=http%3A%2F%2Fgroups%2Fpsnet%2FDirect.htm")); } </script> </body> </html> Hello, Im new to JavaScript and this forum, right now im looking for a simple JS script, that will get the data out from the url and print it on my webpage: http://www.asecurecart.net/server/ca...report=1&xml=1 I think it should looks like this: Mypage.htm Code: < Some JavaScript Code Im looking for> <html> Your shopping cart: <br> Items: <script type="text/JavaScript"><!--document.write(item_total)//--> </script> <br> Order Total: <script type="text/JavaScript"><!--document.write(order_total)//--> </script> </html> Any help would be very appreciated. Thanks. Hi guys, I'm trying to run this sample file that i got from the google docs. I want to write a stock ticker from google finances xml feed and this is a sample they had. Code: <?xml version="1.0" encoding="utf-8"?> <Module> <ModulePrefs title="hellofinance"> <Require feature="finance"/> </ModulePrefs> <Content type="html"> <![CDATA[ Hello world! Here is your portfolio:<br/> GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/> AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/> INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/> <script> var quote = new google.finance.Quote(); quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 'INTC' : '_IG_SYM3' } ); quote.getQuotes(["GOOG", "AAPL", "INTC"]); </script> ]]> </Content> </Module> my problem is i don't know how to execute it so i can see how it works. I tried sticking this code within a php file and it returns an error on the first line for unexpected t-string. So i tried changing the extension to xml and it just displays the code but does not execute. I'm stumped. Any help is appreciated. Thanks P.S. - Yes i do have the zend gdata framework installed and running on my server and is working correctly according to their test. |