Logarithmic axis in TypeScript Chart control
18 Nov 20181 minute to read
The logarithmic axis uses a logarithmic scale and is particularly useful for visualizing data that spans a wide range of values. It effectively represents datasets that include both very small values (for example, 10-6) and very large values (for example, 106) within the same chart, improving readability and comparison.
Note: To use log axis, we need to inject
Logarithmicusing methodChart.Inject(Logarithmic)and set thevalueTypeof axis toLogarithmic.
Range
The range of the logarithmic axis is calculated automatically based on the provided data. This automatic calculation ensures that all data points are visible within the chart area. The axis range can also be customized explicitly using the minimum, maximum, and interval properties.
Logarithmic Base
The logarithmic base of the axis can be customized using the logBase property. This property determines how the axis values are distributed along the scale.
For example, when the logarithmic base is set to 5, the axis values follow the sequence 5-2, 5-1, 50, 51, 52, and so on.
Logarithmic Interval
The spacing between logarithmic axis labels can be controlled using the interval property. This property defines the step size between consecutive logarithmic values.
For example, when the logarithmic base is 10 and the interval is set to 2, the axis labels are placed at values such as 102, 104, and 106. The default value of the interval is 1.