Axis Labels - TextFormatting and CursorTextFormatting
All the axis classes obey standard Cocoa formatting strings, calling methods of the NSFormatter APIs internally. Thus, standard Date Formatters and Number Formatters strings patterns can be applied to format axis labels. There are the
ISCIAxisCore.cursorTextFormatting properties for this purpose.
NSNumberFormatterrelies on Unicode Technical Standard #35
See possible string patterns provided by UTS#35
Axis Labels Formatting
Axis API allows to assign a formatting string for axis labels. There is the
ISCIAxisCore.textFormatting property for this. Such formatting can be set in code as shown below:
NOTE: Axis labels formatting is also applied to
Axis Cursor Text Formatting
Axis API allows to assign a formatting string for axis overlays, such as
SCICursorModifier axis labels. Similarly to axis labels formatting, there is the
ISCIAxisCore.cursorTextFormatting property for this. Such formatting can be set in code as shown below:
Numeric Axes and Scientific Notation
It is possible to render axis labels and text in tooltips in a shortened form using scientific notation (standard form). This becomes an issue when working with large numbers. In this case axis size will grow to fit axis labels inside. This is a common issue when working with
To configure an axis to show numbers in this form, it is necessary that a proper format string is provided and
SCIScientificNotation is set to the desired value. There is a
ISCINumericAxis.scientificNotation property for this purpose. Possible options are listed below:
SCIScientificNotation.SCIScientificNotation_None- the default value.
SCIScientificNotation.SCIScientificNotation_Normalized- assumes 10 as base.
SCIScientificNotation.SCIScientificNotation_E- assumes the number E as base.
SCIScientificNotation.SCIScientificNotation_LogarithmicBase- used with
SCILogarithmicNumericAxis. Assumes the logarithmic base of the
An axis can be configured to use
SCIScientificNotation like follows:
Dynamically Changing TextFormatting
For more advanced formatting scenarios,
Axis API provides a feature called LabelProviders. It grants full control over text output of every axis label. This can be useful if required to customize textual representation of particular axis labels or replace all of them with other strings based on some logics. Please refer to the LabelProvider API article for further details.