Tag: Weight

31 Days of Weight Loss

July 30, 2010 » Life

Thirty-one days ago I decided to lose some weight.

I haven’t made any huge changes in my diet, just cutting down on how much I eat, when I eat it and what it is. Soda is nearly gone, as are sweet coffee drinks. I no longer graze, and if I do need a snack I lean towards something healthier. For example I started keeping trail mix at work instead of hitting up the vending machine for a candy bar or something.

A month later I’m down about six pounds. It’s not a super smooth curve, but it’s gradual and it’s easy. I’ll keep on trucking, and I need to add some exercise in there, so we’ll see what the next few months hold.

Charting Weight Change With Google Visualizations

July 5, 2010 » Consume, Geek, Life

I started trying to lose weight a while back, since we both know I’m a bit heavy and sitting in front of a computer isn’t going to lose the weight for me.

Naturally, it’s important that I incorporate technology into my weight loss somehow, right? So I decided to give the Google Visualizations API a spin.

I worked up a quick data format and a method to pop the data out. Nothing fancy, just a fixed width flat file. This doesn’t deserve a database.

2010-06-30 235.4
2010-06-29 236.8

Easy to read, easy to edit, and easy to consume. Every morning I just hop on the server, add the day’s weight and log off.

Now I just needed to represent it. The API is very object oriented and easy to work with. I wish there was a less verbose way of presenting the data, but you can't have everything.

Actually, there may be a better way, I just didn't come across it while speed reading the docs.

function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn( 'string', 'Date' );
  data.addColumn( 'number', 'Weight' );

  data.addRows(  );

  var chart_div = document.getElementById( 'chart_div' );
  var chart = new google.visualization.LineChart( chart_div );
      width: 800,
      height: 600,
      title: 'Weight Over Time'

And there you have it, fancy charting in no time.

Example Chart

See it in action at http://static.velvetcache.org/weight.php

Get the full source at http://gist.github.com/459148.