
It is no secret that among IT people there are many who love physical activity. Perhaps this is due to the sedentary nature of the work and the desire to take care of their health. Or maybe it’s just bikes, running and swimming. In any case, some of those who love physical activity, engage in amateur sports or exercise regularly.
Lyrical digressionIf you didn’t play any cyclical sport in your childhood, then your passion for sports can start by buying a bicycle. The bike, of course, is selected after studying a lot of reviews and recommendations and reading a velomania, and not necessarily an “ashanbike” (see the recent joke on the Internet for a joke about how infuriating about everything). Then it turns out that it’s not very interesting to ride a steep mountain bike bought in the park and around the city, and you are looking for like-minded people, you begin to regularly participate in pokatushki a local cycling club and you probably get to your first amateur race KK. It suddenly turns out that your physical form allows you to take a place of honor only somewhere at the end of the list. After that, if you don’t say “well, these races,” and start learning the same cycle, but on the subject of training, read the Cyclist’s Bible, register on the Strava (http // strava.com), start training regularly and keep a diary of training - that's when the sport begins, albeit amateur.
Another thing that IT people love is a variety of statistics and numbers. Regular sports services do not allow to somehow play with statistics, providing only standard types of reports, such as mileage counters or time by week and day of the week and types of activity. It so happens that the author of these lines at the same time and trains, and participates in the development of the DevExpress Dashboard. And of course, I wanted to make a deshbord myself (and show everyone how easy it is) according to my training diary.
I keep a diary simply in the form of a Google doc table. Keeping a diary is simple: for each workout, it is necessary to record by type of occupation, the resulting time, distance, average / maximum speed, pulse data. Usually I transfer data from Strava or from movescount.com to my diary (since I record my workouts with the suunto ambit 3 watch). The most difficult thing is not to forget to measure your pulse at rest in the morning, which is an indicator of general fatigue and overtraining if it suddenly arises. The diary looks like this:
')

Starting from version 15.2, our deshboards allow you to import data from Excel, so to use it you just need to save it to a file in xls format.
Of course, to build a dashboard, the data had to be “combed” a little. I put down the correct formats (numeric or time) for the cells, deleted incorrect values, and also added the “Type of Activity” column so that it can be aggregated. It can take one of the following values ​​- "Road bike", "MTB", "Exercise Bike", "Pool", "Running" and "Gym", which I stamped with my hands for each workout.
What I would like to see on my dashboard:
- standard statistics on mileage by type of activity - general numbers of mileage, time and set of heights by type of activities, as well as their time charts,
- training history by day, about how it looks in Strava,
- any data on the pulse, such as the correlation between the average pulse in training and the average speed,
- and of course, the dashboard must be alive, that is, not just be a static picture. It must have a maximum of interactivity so that you can select a particular data slice and look at them "more closely."
Now you can run the designer (and to make a designer, you just need to create a new WinForms application, add a DashboardDesigner to the form and generate a ribbon for it), create a new dashboard (or a dashboard, as written in Russian localization). Let's start by adding a data source from Excel to it:

Next, add cards to the dashboard, put the "type of activity" field in the data series (Series), and make several cards (by time and mileage). However, there are several problems:
First, the duration of the workout comes from Excel in the form of a DateTime column, in which the date component is 01.01.0001. It is impossible to summarize dates, and therefore the duration must be converted to a floating-point number, which can be done using a calculated field (calculated field) by giving it the expression
GetHour ([TM]) + GetMinute ([TM]) / 60.0 . I do not anticipate trainings longer than a day, so we will limit ourselves to hours and minutes.
Secondly, the “bare” cards do not look very good, so it would be good to add a sparkline there. But, in order for the graph to look beautiful, you need to group the data by week. Unfortunately, we don’t have the built-in group interval by weeks and years, and grouping only by the week number in the year will be wrong; we will have to create another calculated field with the start date of the week so that it can be used as a value for the group. The expression will look like
AddDays ([Date], - GetDayOfWeek ([Date]) + 1) . Just a little bit of settings (the format of numbers and names) and we get the following:
Yes, dashboards are not only numbers and functionality, but also a beautiful picture. When developing a specific dashboard, one has to take into account its visual component - everything should look good.After the general numbers I would like to show more detailed information on the dashboard. Add graphs of training volumes for mileage, time, set of heights in the context of different types of activities and dates. To do this, create a new element in the dashboard - a chart (Chart). To get the grouping by weeks and years, we first add the Date field to the arguments, grouped by year, and then again with the same grouping “Week number per year”. Next, add a few panels (ane) and add fields to them for the duration of the training, time and height gain. Next, add to the series (Series) type of training, and turn on them coloring. Switch the types of graphs on all panels in “Stacked bar” (in Russian, this sounds like a “accumulated histogram”) and we get the following picture:

Now I want to check - is the dashboard showing the correct data? And also to satisfy curiosity and find out what is hidden under a specific column in the diagram. For example, to find out, and what kind of training were that week, when the climb reached 3 thousand meters? For this you need to give Dashboard its important ability - interactivity. First, let's add a grid dashboard item to the table. I would like to see detailed training information there - that is, almost all fields from the source data. You have to spend some time adding them to the table and setting options for displaying them. After that, turn on the multiple master filter mode of the previously added graphics and see what happens:

Thus, by clicking on the chart, you can filter the records in the table below. And so that the filter does not affect the cards at the top - they need to set the ignore mode to the master filter. At the same time, you can make the filter work when you click on the card. Only now, so that it does not affect the graphics, they will also have to be banned from responding to the master filter.
So, now the dashboard allows you to select one or more specific types of activities and see a list of trainings on them in the table below. After that, you can select one or several dates in the activity graphs and filter the data in the table in more detail:

Now we have statistics on the volume and dates of training, but in the initial data there is also data on the pulse. In theory, the average heart rate should reflect the intensity of the workout and I would like to look at the correlation between the average heart rate and the average speed, which should roughly reflect the progress in the workouts. Of course, the simple dependence of the pulse / average speed will not take into account the fact that the treadmill is easier to run than the cross country, and for a bicycle the speed also depends on the quality of the road, wind and other external factors. But still, it would be interesting to look at it.
To do this, use the scatter plot. Put the average pulse on the X axis, the average speed on the Y axis. Put the trip date in the arguments so that the points do not merge into one, and the type of activity to color different types with different colors (but with the same elements of the chart that are colored - thanks to the support of the dashboards global palettes). In the "weight" field we will put a "set of heights" to distinguish trips on flat terrain from trips with a large set (but at the same time we lose workouts on the bike station, because, unfortunately, there are no data on the set of heights for them and they are shown in the diagram will not).
It will also be convenient to reduce to one scale the pace of running, which is set in minutes / km, and the speed when riding a bicycle, which is given in km / h. To do this, we make another calculated field “Average speed / pace of the race” with the following expression:
Iif ([AVS temp] <1, [AVS temp] * 24, [AVS temp] )
Generally speaking, there is also swimming, where the pace is often recorded in min / 100m, but I didn’t have accurate data on the speed in the pool, and the set of heights in the pool does not make sense. Therefore, I did not take into account the speed in the pool in this expression. In skiing, speed is also often recorded in the form of pace, like when running - but the author of these lines does not like cross-country skiing.We turn on the filtering mode for the resulting diagram so that for a specific value it is possible to find out which trainings have been included in it. The final dashboard will look like this:

What is the result?
Dashboard can be used for detailed "digging" in the data. For example, you can choose only running training for a specific week and see the speed / pulse distribution for them. Or choose a week with the maximum amount of training and see what kind of training it was. In this case, the pulse diagram will show the correlation between the intensity of the workout and the average pulse, as well as the values ​​“falling out” of the general trend. In this case, it will be easy to see why they turned out so. In my case, this is either a large set of heights, due to which, with the same average pulse, the average speed was 15 km / h instead of the usual 22 km / h for such a pulse, or a specific type of activity, such as for mtb, where the last cross - Kantri race last season. In which, despite the rather extreme pulse values ​​for me, the average speed was only 10 km / h, which, however, is normal for them.
The source code of the example, as well as data and xml dashboard file can be downloaded from
GitHub . You can either try to change the dashboard, or substitute your data in the xls file (or add your own data source).
I will be glad to answer all questions, both on the training process, and on dashboards.