Jump to content

jay0316

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by jay0316

  1. No problem Marty. Glad I could help!
  2. Hey Marty, The first example works because you're passing numbers for all your data and all your columns have 'number' types assigned to them. The second example doesn't work because this date line is a string: echo date('d M',strtotime($levelresults->timestamp) +18000); // output example: 26 Dec Since it's a string, you'll need to add quotes around it: echo "'".date('d M',strtotime($levelresults->timestamp) +18000)."'"; Then you'll need to change the column to 'string'. Give this a whirl: google.load('visualization', '1.0', {'packages':['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', ''); data.addColumn('number', 'Time of Reading'); data.addColumn('number', 'Blood Glucose Reading'); data.addRows([ <?php $level=DB::getInstance()->query("SELECT * FROM tabbyhealth WHERE reading!=0"); foreach ($level->results() as $levelresults) { echo "["; echo "'".date('d M',strtotime($levelresults->timestamp) +18000)."'"; echo ","; echo date('H',strtotime($levelresults->timestamp) +18000); echo ","; echo $levelresults->reading; echo "],"; } ?> ]); var options = { title:'Blood Glucose Monitoring', curveType: 'function', legend: { position: 'bottom' }, width:600, height:300, hAxis: { title: 'Date' }, vAxis: { title: 'Reading and Time' } }; var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data, options); } Here is a fiddle: http://jsfiddle.net/jay0316/pxcozvep/4/
  3. Hey Marty, I had typed a larger response, but unfortunately had an issue with my browser and lost it. So, I'm going to give you an abbreviated answer. Here is a working example using your test data: http://jsfiddle.net/jay0316/pxcozvep/1/ Your data types ("string" and "number") for your columns as well as the number of columns need to match the data you are passing in data.addRows. When you use the test data you gave as an example, you are only defining 2 columns in the js, but the there are 3 pieces of data in each array that is in the data.addRows function. You would need a third column to make that work (as you can see in the fiddle link above). In the php coded version you are passing both the timestamp and glucose as "string" (because of the single quotes you are using around the <?php ?> tags, but the columns in the js code are defined as "string" and "number". These will need to match the data you're passing. Also, I'd test your php $timestamp variable by printing it out to make sure you're getting what you expect. Finally, I normally like to include the brackets with my foreach loops so it's clear where it starts and ends. There are a couple ways of doing it. One way might be creating a js variable above your google chart js code you have like so (not tested) : var rowData = [ <?php $level=DB::getInstance()->query("SELECT * FROM tabbyhealth WHERE reading!=0"); foreach ($level->results() as $levelresults) { $glucose = $levelresults->reading; $timestamp = date('d M Y h.i A',strtotime($levelresults->timestamp) +18000); echo "['".$timestamp."',".$glucose."],"; } ?> ]; and then pass the js variable to data.addRows like so: data.addRows(rowData); Hope this helps set you in the right direction. Happy Holidays!
  4. I've placed an htacess file with the code below into my folder with a bunch of artfiles. I wanted to use it so that when I create an anchor tag and link to one of those files it will download the file. It works like I wanted it to (files download when I click the link); however, I have a page that I created to display some of those files on. When the htaccess file is in the folder they do not display on this page. I'm using an img tag or object tag (for swf files). On this page the files don't show or download. Is there a line of code that will use this for anchor tags only? Why does this affect the img and object tag? If not, is there a better way to do what I'm trying to do (this seemed so easy)? <FilesMatch "\.(?i:jpg|gif|png|jpeg|tif|tiff|swf|pdf)$"> Header set Content-Disposition attachment </FilesMatch>
  5. jay0316

    power outage

    I will check out the backup generator and what our DNS Service Provider has as far as maintenance page options. The power is going to be out from 7:30am to 5:00pm. So, I don't think the UPS is going to help. Thanks for the feedback guys.
  6. jay0316

    power outage

    We have our website hosted on our own internal ubuntu server. The power is going to be shutdown this weekend because the power company will be working on our power lines. What is the best way to serve up a down for maintenance page or something to our customers so that it doesn't just look like our site disappeared? The only option I've thought of so far is an external hosting account that we store some maitenance pages on and redirect our company websites to those for the weekend. Is there a better way? Thanks.
  7. We are uploading product videos to youtube. On our site we have our product info stored in a database. There are a couple products that have more than one video. I'm wondering if I should store them in the record with the item. Or if they should be stored in a separate table with the item id and video id. We may eventually have some training videos etc. that could apply to several items. Any suggestions?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.