Create custom charts with Flexicharts

19 July, 2013 by David Johnstone

A number of people have asked for various charts and other bits of information to be displayed. I’ve been reluctant to add most of these, because they would make the interface more cluttered with things that most people don’t use. However, at the same time, these requests have been for things that are reasonable for some to want to see, so I never wanted to say “no” and leave it at that. Therefore, today’s new feature is a way to easily make custom charts, called Flexicharts.

Flexicharts can be accessed via the link in the analysis section of the sidebar on the left, right underneath “Zones”. Going to that page brings up a prompt which can be given commands to create charts, and some explanatory text.

To create a simple chart that shows the distance of each ride, enter rides.distance() into the prompt and hit enter. This will result in a chart like the following being created:

Instead of distance, many other aspects of the rides can be charted, including duration, average heart rate, training load and maximum power (there’s a complete list of these at the bottom of the Flexicharts page). Note that, at the moment, the units displayed are always metric, so the distance is displayed in kilometres, even if you’ve set the site to display US units. This will be fixed.

Flexicharts can display a lot more than simple summary data of rides. Rides can be grouped together and some aspect of that grouping can be charted. For example, you can group rides by the month they were ridden in, and then display the total riding time for each month:

(Somebody hasn’t been doing much riding this year.)

Rides can be grouped by date by day, week, month or year, or by a range, so, for example, rides.distance().group_by(range(10)).aggregate(count) shows a histogram showing how many 0—-10km, 10—-20km etc. rides there are. The groups can be aggregated to show the average, sum, maximum, minimum or count.

More advanced charts can be created using map and filter functions, or by giving custom JavaScript functions to the group_by and aggregate functions. Extensive documentation is available.

The goal of Flexicharts is to create custom charts easily, although “easily” is a relative term. I aimed to make it at roughly the same level as Excel, so if you can use Excel, you can also use Flexicharts — not that they work in the same way, but if you can figure out how to use one, you can also work out how to use the other.

There is still more work to do Flexicharts. Things to be worked on include:

  • Show multiple things on the one chart.
  • Save charts so that you don’t need to reenter the command each time you visit the page.
  • Use US units where necessary.
  • Access to more data about rides (such as power curves and short- and long-term stress).

Because this is new and a bit complicated, I am especially eager to hear feedback on this. Does it make sense? Could it be improved? Could the documentation be improved? Do you have an idea of something you want to chart but can’t work out how to do it? Anything else? Let me know.

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