Flexicharts improvements and other little things

5 March, 2014 by David Johnstone

In addition to the new training load chart, there have been an assortment of updates and improvements recently. Flexicharts now have access to training load data and a bunch of date based filters, which makes it possible to create a variety of new charts (and tables). But firstly, here’s a handful of other assorted updates:

  • The default values of crank length and FTP cadence for the force vs. cadence chart can now be set on the profile settings page.
  • Aerobic decoupling is now shown for selections on the main ride chart.
  • Syncmetrics supports Cycling Analytics as one of the sites it synchronises sport and fitness data with.
  • There is a suggestion for CopyMySports to support Cycling Analytics. Go there and upvote it if you want to see this done.
  • The zoom level is kept constant when changing the zones chart between using heart rate and power data.
  • Error codes have been added to the API for failed uploads.

The rest of this is about Flexicharts, so you can stop reading now if you don’t use them. To start with, here is an approximate recreation of the new training load chart, using Flexicharts:

The commands used are as follows (note that the y-axis limits have to be set manually):

rides.lts().line({yAxis: {min: -70, max: 100}, color: '#69b6fe'})
rides.sts().line({color: '#f49a7b'}).on(-1)
rides.sb().line({color: '#b0b0b0', fillColor: 'rgba(226,226,226,0.35)'}).on(-1)
rides.load().group_by(day).aggregate(sum).columns({yAxis: {min: 0, max: 1200}, color: '#dddddd', fillColor: 'rgba(226,226,226,0.7)'}).on(-1)

There are now the following built-in filters for use with filter: this_year, this_month, this_week, last_year, last_month, last_week, date_filter(year, [month, [day]], [year, [month, [day]]]), on_monday, on_tuesday, on_wednesday, on_thursday, on_friday, on_saturday, on_sunday. It’s now possible to do things like, to show the total training load for each month for last year:

rides.filter(last_year).load().group_by(month).aggregate(sum)

A table with the five longest rides you’ve ever done on a Tuesday:

rides.filter(on_tuesday).distance().max(5)

How much time you spent on your bike last financial year (from the start of July 2012 to the end of June 2013):

rides.filter(date_filter(2012, 7, 2013, 6)).duration().group_by(all_time).aggregate(sum).table()

Here’s a couple of extra technical details about Flexicharts.

If you use a browser that supports ECMAScript 6’s arrow function notation (at the moment, that’s Firefox), you can do:

rides.filter(ride => ride.has.power && ride.has.heartrate)
     .map(ride => ride.summary.epower / ride.summary.avg_heartrate)
     .group_by(month)
     .aggregate(average);

Instead of:

rides.filter(function(ride) { return ride.has.power && ride.has.heartrate; })
     .map(function(ride) { return ride.summary.epower / ride.summary.avg_heartrate; })
     .group_by(month)
     .aggregate(average);

Also, chroma.js is available for creating colours, which makes it possible to specify colours like:

rides.lts().line(color: chroma.lch(72, 43, -94).css())

Instead of:

rides.lts().line({color: '#69b6fe'})

It’s useful for anybody who likes working with exotic colour spaces. (Don’t worry, I didn’t spend any time making this possible, I merely realised it was already possible.)

This is the blog of Cycling Analytics, which aims be the most insightful, most powerful and most user friendly tool for analysing ride data and managing training. You might be interested in creating an account, or following via Facebook or Twitter.

blog comments powered by Disqus