How to show specially formatted units in custom data field

Former Member
Former Member
Hi everyone, I just got an Edge 1000 and have been studying the Connect IQ developer documentation with the intent of making a custom data screen.

I think I've mostly figured out how to get the required data and position it on the screen and format it and all that, but one thing I can't yet figure out is how you can add units to the numbers in the way that the native built-in data fields are shown. By this I mean that if you show speed in a stock field, it'll show in a font smaller than the value "km" and "h" under that... or bpm vertically stacked for heart rate.

What is the trick to using these specially formatted units in a font size that is different than the value? Are these really each just a special character in the bitmap font or something? So far in my digging I've been unable to find this documented and can't find any examples of this.

Any info about how this is done would be appreciated!
  • With datafields, there are two types in CIQ - Simple and Complex. With a simple one, a value is returned in compute() and that gets displayed and your code doesn't have control over font/location/etc. With a complex one, there's an "onUpdate()" function for updating the display and you have control over screen locations, fonts, colors, etc so if you want "km" and "h" under that, you draw it yourself with a smaller/different font than the one you use for the data.

    So, to do what you want, you want to use a complex DF as a base. Then using the FONT_* values available, you'll likely find something that works for the value and another for the km/h.
  • Former Member
    Former Member
    Thanks for the info. I definitely want to use the complex data fields because I want to precisely control the appearance.

    To clarify, to do what you are saying, would you have to make separate fields for each of the "b" "p" and "m" in bpm to show a bpm unit by the value? Or can you have different fonts and positions and colors and such actually within one field?

    If it does require different fields, I'm worried that it would be impossible to have them move together when you have a value that changes from 1 to 1000, for instance, unless you right-align the number so that the right side doesn't move relative to the unit... which could look pretty bad. But if you want to center it, how could you make that work?