Chart for .NET > User's Guide > Axes > Scale > Manually Programming the Scale > Range Processing |
Range sampling is the process of dividing ranges into smaller ones. The object that perform this are called range samplers and are represented by classes that derive directly or indirectly from the base NRangeSampler class.
There are three important groups of range samplers:
Step range sampling
Step range samplers will sample a given range from an origin value with one or more steps. For example consider you have to sample the range [21, 41] with step 5. If the range sampler origin starts at zero the output of the sampler will be the following ranges:
[20, 25], [30, 35], [35, 40], [40, 45]
This is also referred to as range sampling with custom origin. Alternatively you may want to always sample the range starting at the range begin value (21 in this case). Then the output of the sampler will be:
[21, 26], [26, 31], [31, 36], [36, 41], [41, 46]
This is also referred to as range sampling with variable origin. The scale model exposes three types of step range samplers shown in the following table:
NNumericStepRangeSampler - Used for sampling with double precision. Steps can be any positive double value.
NIntegerStepRangeSampler - Used for sampling with integer precision (integer numbers only). Steps can be any positive integer value.
NDateTimeStepRangeSampler - Used for date time sampling. Steps are represented in NDateTimeSpan format. The NDateTimeSpan groups together a date time unit and unit count.
Furthermore each step sampler is connected to a step provider that can automatically calculate the step depending on the range length or the length of the scale in device units (used for range length or device length dependent scale decoration).
Density range sampling
Density range sampling is sampling a given range a number of times regardless of the range length. For example if we have the range [0, 10] and want to sample it with density 5 then the step is calculated as 10 / 5 = 2. The output of the sampler in this case will be: [0, 2], [2, 4], [4, 6], [6, 8], [8, 10]. Density range sampling is represented by the NDensityRangeSampler class.
Custom range sampling
With custom range sampling you can manually provide the range sample intervals. Custom range sampling is represented by the NCustomRangeSampler.