FIT Graph

I'm trying to generate a graph in Garmin Connect's Activity view. I've created graphs before. Easy. But this one isn't working.

I have auto-pause turned on, so no data is written when stopped. I track stop time. When I resume moving, I want to write a value that is the number of minutes of that last stop.

But I want it to look like the top bar graph, not the bottom line graph. So I write the stop duration value and then immediately write a ZERO value. But that isn't working. It should, I think. Any ideas? Wait a few seconds to write the zero?

  • FitContributor.Field.setData() doesn't actually write any data, it sets the next value to be written. I think that's why it's called setData() and not writeData().

    This is a subtle distinction which has caused some confusion when it comes to things like writing data at the end of a lap or an activity.

    So I write the stop duration value and then immediately write a ZERO value

    So if you do this ^, I would expect to see only one of those values in the graph (I would actually expect to see the 0, not the stop duration value, since it was set last, so I'm not sure exactly what's happening here.)

    I would call setData(0) roughly a second later, since data is written once per second.

    I'll also point out that, unlike a native FIT field, it's impossible to write "no data" once you've called setData() once, since setData(null) is not allowed, which kind of sucks It means that the native HR field could have gaps in the case of sensor dropouts (for old watches that didn't have an optical sensor, or if your optical sensor is turned off), but any 3rd-party field cannot, so it's not possible the handle cases like sensor dropouts in an optimal way.The best you could do is write zeroes. Not really related to this question, but just an annoyance for me. (A power value of 0 is clearly different than unknown/not applicable power, but it's not possible to make that distinction with a 3rd party field.)

  • Thx! That makes sense. Yeah regarding null, a -1 isn’t ideal but helps.

  • Thanks again I changed it to retain the desired value for 3 seconds and this is perfect.