ScottPlot
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
ScottPlot.TickGenerators.DateTimeFixedInterval Class Reference
Inheritance diagram for ScottPlot.TickGenerators.DateTimeFixedInterval:
ScottPlot.TickGenerators.IDateTimeTickGenerator ScottPlot.ITickGenerator

Public Member Functions

 DateTimeFixedInterval (ITimeUnit interval, int intervalsPerTick=1, ITimeUnit? minorInterval=null, int minorIntervalsPerTick=1, Func< DateTime, DateTime >? getIntervalStartFunc=null)
 Creates a new DateTimeFixedInterval generator.
 
IEnumerable< double > ConvertToCoordinateSpace (IEnumerable< DateTime > dates)
 
void Regenerate (CoordinateRange range, Edge edge, PixelLength size, SKPaint paint, LabelStyle labelStyle)
 Generate ticks based on the current settings and store the result in Ticks
 

Properties

ITimeUnit Interval [get, set]
 The time unit to use for major ticks.
 
int IntervalsPerTick [get, set]
 The number of Interval units between major ticks (e.g. major ticks every 7 Days)
 
ITimeUnitMinorInterval [get, set]
 The time unit to use for minor ticks. If null, no minor ticks are generated.
 
int MinorIntervalsPerTick [get, set]
 The number of MinorInterval units between minor ticks.
 
Func< DateTime, DateTime >? GetIntervalStartFunc [get, set]
 An optional function to override where the intervals for ticks start. The DateTime argument provided is the start range of the axis (i.e. IAxis.Min).
 
Func< DateTime, string >? LabelFormatter = null [get, set]
 If assigned, this function will be used to create tick labels.
 
Tick[] Ticks = Array.Empty<Tick>() [get, set]
 Ticks to display the next time the axis is rendered. This array and its contents should not be modified directly. Call Regenerate() to update this array.
 
int MaxTickCount = 10_000 [get, set]
 Do not generate more than this number of ticks.
 
- Properties inherited from ScottPlot.ITickGenerator

Constructor & Destructor Documentation

◆ DateTimeFixedInterval()

ScottPlot.TickGenerators.DateTimeFixedInterval.DateTimeFixedInterval ( ITimeUnit  interval,
int  intervalsPerTick = 1,
ITimeUnit minorInterval = null,
int  minorIntervalsPerTick = 1,
Func< DateTime, DateTime >?  getIntervalStartFunc = null 
)
inline

Creates a new DateTimeFixedInterval generator.

Parameters
intervalThe time unit to use for major ticks
intervalsPerTickThe number of Interval units between major ticks
minorIntervalThe time unit to use for minor ticks. If null, no minor ticks are generated.
minorIntervalsPerTickThe number of MinorInterval units between minor ticks.
getIntervalStartFuncAn optional function to override where the intervals for ticks start. The DateTime argument provided is the start range of the axis (i.e. IAxis.Min).

Member Function Documentation

◆ ConvertToCoordinateSpace()

IEnumerable< double > ScottPlot.TickGenerators.DateTimeFixedInterval.ConvertToCoordinateSpace ( IEnumerable< DateTime >  dates)
inline

◆ Regenerate()

void ScottPlot.TickGenerators.DateTimeFixedInterval.Regenerate ( CoordinateRange  range,
Edge  edge,
PixelLength  size,
SKPaint  paint,
LabelStyle  labelStyle 
)
inline

Generate ticks based on the current settings and store the result in Ticks

Implements ScottPlot.ITickGenerator.

Property Documentation

◆ GetIntervalStartFunc

Func<DateTime, DateTime>? ScottPlot.TickGenerators.DateTimeFixedInterval.GetIntervalStartFunc
getset

An optional function to override where the intervals for ticks start. The DateTime argument provided is the start range of the axis (i.e. IAxis.Min).

If omitted, the ticks will start from IAxis.Min. This may have undesirable effects when zooming and panning. If provided, the ticks will start from the returned DateTime.

If the plot contains weekly data, and it is desired to have ticks on the 1st of each month:

dt => new DateTime(dt.Year, dt.Month, 1);

If the plot contains hourly data, and it is desired to have ticks every 6 hours at 00:00, 6:00, 12:00, etc, then set Interval to Hour, IntervalsPerTick to 6, and provide the function:

dt => new DateTime(dt.Year, dt.Month, dt.Day);

◆ Interval

ITimeUnit ScottPlot.TickGenerators.DateTimeFixedInterval.Interval
getset

The time unit to use for major ticks.

◆ IntervalsPerTick

int ScottPlot.TickGenerators.DateTimeFixedInterval.IntervalsPerTick
getset

The number of Interval units between major ticks (e.g. major ticks every 7 Days)

◆ LabelFormatter

Func<DateTime, string>? ScottPlot.TickGenerators.DateTimeFixedInterval.LabelFormatter = null
getset

If assigned, this function will be used to create tick labels.

◆ MaxTickCount

int ScottPlot.TickGenerators.DateTimeFixedInterval.MaxTickCount = 10_000
getset

Do not generate more than this number of ticks.

Implements ScottPlot.ITickGenerator.

◆ MinorInterval

ITimeUnit? ScottPlot.TickGenerators.DateTimeFixedInterval.MinorInterval
getset

The time unit to use for minor ticks. If null, no minor ticks are generated.

◆ MinorIntervalsPerTick

int ScottPlot.TickGenerators.DateTimeFixedInterval.MinorIntervalsPerTick
getset

The number of MinorInterval units between minor ticks.

◆ Ticks

Tick [] ScottPlot.TickGenerators.DateTimeFixedInterval.Ticks = Array.Empty<Tick>()
getset

Ticks to display the next time the axis is rendered. This array and its contents should not be modified directly. Call Regenerate() to update this array.

Implements ScottPlot.ITickGenerator.


The documentation for this class was generated from the following file: