Custom field chart displayed as histogram

When I create a field, using

<fitContributions>

        <fitField id="2" displayInChart="true"  displayInActivitySummary="true" sortOrder = "0" precision="1"

        chartTitle="@Strings.charttitleEN" dataLabel="@Strings.datalabelEN"

        unitLabel="@Strings.kcalsmin" fillColor="#FF0000"  />

</fitContributions>

energyfield = activityrecord.createField ("Energy", 2, Fit.DATA_TYPE_FLOAT, {: mesgType => Fit.MESG_TYPE_RECORD,: units => "kcal/min"});

var actinfo=        Activity.getActivityInfo();

energyfield.setData(actinfo.energyExpenditure);

The data points are displayed as a histogram: through each data point does a horizontal line instead of a line connecting it to the following data point.

Other custom data fields don’t have this blocked appearance (e.g. “Estimated body temperature”).

How can I do the same?

  • You might want to post your question to the Connect IQ forum. The data is stored in a FIT file, but how the data is displayed in Connect is configured in the app's metadata that is uploaded to the app store. https://forums.garmin.com/developer/connect-iq/

    If Activity.getActivityInfo(); is being called, then I will assume that this is an app and not a data field since an ActivityInfo is passed to the data field's compute method once per second so you do not need to explicitly call Activity.getActivityInfo(). If it is an app, then there is probably a timer being used to trigger the call to Activity.getActivityInfo();. That timer should be set to 1 sec. The Record messages are written to the file once per second, and the last value set by calling energyfield.setData(actinfo.energyExpenditure); will be what is written to the file. If that value is not updated every second, then the same value may be written out to the file multiple times which could give you the stepped looking chart.

    It might also be that actinfo.energyExpenditure is only updated a every few seconds which would give you a chart that is more squareish looking. 

    You can use the FIT CSV Tool to convert the file to CSV and then look at the actual values in the file to see if the values are repeated or not.
    developer.garmin.com/.../