Flexicharts
Flexicharts provide a powerful and flexible way to make custom charts. Select a built-in chart from the library above, use the “chart creator” tool, or look at the examples and information below to get started. Complete documentation is also available.
One way to think about how this works is that you start with a big collection of data and then massage that into something useful to display. That is, given the summary data of all of your rides, you choose or construct x
and y
values to chart.
Examples
Copy any of these into the prompt above and hit the enter key to show the chart.
The distance for each ride (this sets y-axis to distance, and the x-axis shows the date by default):
chart().distance()
Time spent riding for each week, and training load for each month:
chart().duration().group_by(week).aggregate(sum);
chart().load().group_by(month).aggregate(sum);
A histogram of ride lengths (showing how many 0 to 10km rides, 10 to 20km etc. there are):
chart().distance().group_by(range(10)).aggregate(count)
The five longest rides as a table, and the longest ride for each month as a table:
chart().distance().max(5);
chart().distance().group_by(month).aggregate(max).table();
PWC170 versus 20 minute effective power for the best 20 minute effort of each month, with color indicating the long term stress at the time of the ride:
chart().epower_curve(1200, 'y').group_by(month).aggregate(max).epower_curve(1200, 'x').pwc170(0.5, 'y').day_lts('color').color('blue-gold')
Average power versus average heartrate for all three minute intervals, with the color of each point indicating LTS at the time of the ride:
chart().segment('3:00 interval').segment_power('x').segment_heartrate('y').day_lts('color')
Cheat sheet
Data sources
For ride summary data
chart().total_time([axis])
chart().duration([axis])
chart().moving_time([axis])
chart().distance([axis])
chart().climbing([axis])
chart().work([axis])
chart().epower([axis])
chart().intensity([axis])
chart().variability([axis])
chart().decoupling([axis])
chart().load([axis])
— Using power and heart rate data.chart().trimp([axis])
— Using heart rate data.chart().load_power([axis])
— Using power data.chart().avg_cadence([axis])
chart().avg_speed([axis])
chart().avg_heartrate([axis])
chart().avg_power([axis])
chart().avg_temperature([axis])
chart().max_cadence([axis])
chart().max_speed([axis])
chart().max_heartrate([axis])
chart().max_power([axis])
chart().max_temperature([axis])
chart().min_temperature([axis])
chart().power_curve(seconds, [axis])
chart().epower_curve(seconds, [axis])
chart().pwc130([r2, [axis]])
—r2
, the correlation coefficient, defaults to0.5
.chart().pwc150([r2, [axis]])
chart().pwc170([r2, [axis]])
chart().lrbalance([axis])
chart().power_zone(index, [axis])
chart().hr_zone(index, [axis])
chart().date([axis])
chart().day_lts([axis])
— The LTS value for the day of the ride.chart().day_sts([axis])
chart().day_sb([axis])
axis
can be either 'x'
, 'y'
, or 'color'
for charts, or any string for tables, and defaults to 'y'
if not specified.
For segment data
First use chart().segment(name)
to select the segment.
segment_duration([axis])
segment_distance([axis])
segment_climbing([axis])
segment_speed([axis])
segment_power([axis])
segment_heartrate([axis])
segment_cadence([axis])
segment_epower([axis])
segment_work([axis])
segment_vam([axis])
segment_decoupling([axis])
For training load data
chart().lts()
chart().sts()
chart().sb()
Manipulation functions
type(type)
—'cycling'
,'running'
,'gym'
,'swimming'
etc.group_by(fn)
—day
,week
,month
,year
,all_time
,range(n)
or custom function.aggregate(fn, [fns])
—sum
,average
,max
,min
,max(n)
,min(n)
,count
or custom function.fns
maps custom axes to functions.filter(fn)
—this_year
,this_month
,this_week
,last_year
,last_month
,last_week
,last_n_months(n)
,last_n_weeks(n)
,last_n_days(n)
,date_filter(year, [month, [day]], [year, [month, [day]]])
,on_monday
,on_tuesday
,on_wednesday
,on_thursday
,on_friday
,on_saturday
,on_sunday
, or custom function.map(fn, [axis])
— For custom functions.rebase_dates(year, [month, [day]])
— To force different date ranges to overlap.accumulate()
—y
values are accumulated.trendline([bandwidth])
— Loess trend line.bandwidth
defaults to0.5
.
Charting functions
name(name)
color(scale_name, [alpha])
,color(scale, [alpha])
,color(options)
,color(color)
orcolor(color, fill_color)
x_axis(min, max)
,x_axis(options)
,x_axis('fit')
,y_axis(min, max)
,y_axis(options)
,y_axis('fit')
orcolor_axis(min, max)
line(options)
points(options)
columns(options)
on(chart_number)
inspect()
— Logs the data object to the browser’s developer tools console.
Table functions
table([format_map])
— optional map{axis: {unit: _, round: _, fixed: _}}
, whereunit
can be'miles'
,'feet'
, or'fahrenheit'
,round
is a number,fixed
is a number, and all three are optional.max([count])
min([count])
count()
sort(axis, [ascending])
—ascending
isfalse
by default.reverse()
limit([count])