When RadCartesianChart visualizes
CategoricalSeries, it needs an axis that can represent the different categories. The
CategoricalAxis is used to displays a range of categories. Categories are built depending on the Category value of each CategoricalDataPoint present in the owning CategoricalSeries chart series. The axis is divided into discrete slots and each data point is visualized in the slot corresponding to its categorical value.
DateTimeContinuousAxis is a special axis that may be considered as a hybrid between a categorical and a value axis. DateTimeContinuousAxis works with categorical data but instead of categories, the axis builds time slots depending on its
DateTimeContinuousAxis also expects valid Calendar values so that the data could be plotted correctly. Think of DateTimeContinuousAxis as a timeline where each data point has a certain position, depending on its Calendar value. The timeline range properties' values are automatically calculated if not set explicitly by the user: the default value of the major step is the smallest difference between any two Calendar values. Because this axis behaves like a numerical one, there might be empty time slots if no data falling into them is found.
When binding the chart to data that contains Date objects, developers need to convert these date objects to time in milliseconds.
This is necessarry because the Telerik UI library calls JSON.stringify() on the data objects before they are passed to the underlying native implementation. Then, the native implementation
parses back the string to a native Android or iOS object. This call to stringify may produce incorrect results when called on a Date object. To be safe, convert the Date data beforehand to time
in milliseconds. For example:
Defines the maximum available value. To get or set the maximum use the maximum property.
Defines the minimum available value. To get or set the maximum use the minimum property.
The major step represents the value difference between two visible ticks on the axis. The major step unit is used to determine what exactly the value of the major step represents. To get or set the major step use the majorStep property.
The CategoricalAxis allows you to define how exactly the axis will be plotted on the viewport of the chart. The possible values are:
BetweenTicks: Points are plotted in the middle of the range, defined between each two ticks.
OnTicks: Points are plotted over each tick.
OnTicksPadded: Points are plotted over each tick with half a step padding applied on both ends of the axis.
You can get and set the current value with the
Want to see this scenario in action?
Check our SDK examples repo on GitHub. You will find this and many other practical examples with NativeScript UI.
Related articles you might find useful: