+
+
+
+
+Class BaseChartDrawable
+
+
+
+
- Namespace
- AlohaKit.Controls
+
- Assembly
- AlohaKit.dll
+
+
+
+
+
+
+
public abstract class BaseChartDrawable : IDrawable, IDisposable
+
+
+
+
+
+
+ - Inheritance
+ -
+
+
BaseChartDrawable
+
+
+
+
+ - Implements
+ -
+
+
+
+
+
+
+ - Derived
+ -
+
+
+
+
+
+
+
+
+ - Inherited Members
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fields
+
+
+
+
+
+ AxisXMargin
+
+
+
+
+
+
+
+
protected int AxisXMargin
+
+
+
+
+
+ Field Value
+
+ - int
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsAnimating
+
+
+
+
+
+
+
+
public bool IsAnimating
+
+
+
+
+
+ Field Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsInitialized
+
+
+
+
+
+
+
+
public bool IsInitialized
+
+
+
+
+
+ Field Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MaxYValueCoordinate
+
+
+
+
+
+
+
+
protected float MaxYValueCoordinate
+
+
+
+
+
+ Field Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Points
+
+
+
+
+
+
+
+
protected PointF[] Points
+
+
+
+
+
+ Field Value
+
+ - PointF[]
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _colorBrush
+
+
+
+
+
+
+
+
protected Brush _colorBrush
+
+
+
+
+
+ Field Value
+
+ - Brush
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _dirtyRect
+
+
+
+
+
+
+
+
protected RectF _dirtyRect
+
+
+
+
+
+ Field Value
+
+ - RectF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
protected bool _displayHeaderValues
+
+
+
+
+
+ Field Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _displayValueLabelsOnTop
+
+
+
+
+
+
+
+
protected bool _displayValueLabelsOnTop
+
+
+
+
+
+ Field Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+ Properties
+
+
+
+
+
+
+ AnimationProgress
+
+
+
+ Represents the percentage of the current chart Animation from 1-100
+
+
+
+
+
public int AnimationProgress { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - int
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AxisDashPattern
+
+
+
+
+
+
+
+
public float[] AxisDashPattern { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float[]
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AxisFontSize
+
+
+
+ Gets or sets font size to use when drawing chart axis labels. Default is 11
+
+
+
+
+
public float AxisFontSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AxisLinesColor
+
+
+
+ Axis lines color. Default is Lightgray
+
+
+
+
+
public Color AxisLinesColor { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Color
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AxisLinesStrokeSize
+
+
+
+ Axis lines stroke size. Default is 0.9
+
+
+
+
+
public float AxisLinesStrokeSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ColorBrush
+
+
+
+
+
+
+
+
public Brush ColorBrush { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Brush
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
public bool DisplayHeaderValues { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DisplayHorizontalAxisLines
+
+
+
+ If true header labels will be hidden and chart will draw horizontal step lines.
+
+
+
+
+
public bool DisplayHorizontalAxisLines { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DisplayValueLabelsOnTop
+
+
+
+ If true, chart will show value labels on top of canvas. Default is true
+
+
+
+
+
public bool DisplayValueLabelsOnTop { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DisplayVerticalAxisLines
+
+
+
+ If true vertical lines will be drawn as background along with horizontal lines. DisplayHorizontalAxisLines prop needs to be true as well
+
+
+
+
+
public bool DisplayVerticalAxisLines { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EnableAntialias
+
+
+
+ Gets or sets if the current canvas will use Antialias mode or not when drawing content. Default is true
+
+
+
+
+
public bool EnableAntialias { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Entries
+
+
+
+ Gets or sets the items to display within canvas
+
+
+
+
+
public ObservableCollection<ChartItem> Entries { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - ObservableCollection<ChartItem>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FillColor
+
+
+
+ Gets or sets the canvas default fill color. Default is transparent
+
+
+
+
+
public Color FillColor { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Color
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Font
+
+
+
+ Gets or sets the canvas default Font to use when drawing strings. [10/10/22 -> GRAPHICS MISSING SUPPORT FOR CUSTOM FONTS]
+
+
+
+
+
public IFont Font { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - IFont
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FontColor
+
+
+
+ Gets or sets the color to use when drawing value labels. Default is Black
+
+
+
+
+
public Color FontColor { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Color
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FontSize
+
+
+
+ Gets or sets font size to use when drawing value labels. Default is 11
+
+
+
+
+
public float FontSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets Footer height
+
+
+
+
+
protected float FooterHeight { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets the color to use when drawing footer labels. Default is Black
+
+
+
+
+
public Color FooterLabelsFontColor { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Color
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets font margin to use when calculating footer labels coordinates. Default is 8
+
+
+
+
+
public float FooterLabelsMargin { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets font size to use for footer label values. Default is 10
+
+
+
+
+
public float FooterLabelsTextSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets Header height
+
+
+
+
+
protected float HeaderHeight { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gets or sets font margin to use when calculating header value labels coordinates. Default is 30
+
+
+
+
+
public float HeaderValuesMargin { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Height
+
+
+
+ Gets or sets control height
+
+
+
+
+
protected float Height { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsLabelTextTruncationEnabled
+
+
+
+ If true, chart labels text will be truncated to fit available size. Default is true
+
+
+
+
+
public bool IsLabelTextTruncationEnabled { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - bool
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ItemSeparationMargin
+
+
+
+ Gets or sets the separation margin between each item. Default is 8
+
+
+
+
+
public float ItemSeparationMargin { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ItemSize
+
+
+
+ Gets or sets the size for each value column
+
+
+
+
+
protected SizeF ItemSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - SizeF
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Margin
+
+
+
+ Gets or sets the default top and bottom internal margin to use when drawing canvas content. Default value is 15
+
+
+
+
+
public float Margin { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MaxValue
+
+
+
+ Gets the greatest value within ChartEntries collection
+
+
+
+
+
protected float MaxValue { get; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinValue
+
+
+
+ Gets the smallest value within ChartEntries collection
+
+
+
+
+
protected float MinValue { get; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Origin
+
+
+
+ gets or sets the origin in Y axis
+
+
+
+
+
protected float Origin { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PathsColorOpacity
+
+
+
+ Sets the Alpha modifier value to use when drawing solid color backgrounds.Default is 0.6
+
+
+
+
+
public float PathsColorOpacity { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ StrokeColor
+
+
+
+ Stroke color. Default is Black
+
+
+
+
+
public Color StrokeColor { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - Color
+
+
+
+
+
+
+
+
+
+
+
+
+
+ StrokeSize
+
+
+
+ Stroke size. Default is 2.5
+
+
+
+
+
public float StrokeSize { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ValueRange
+
+
+
+ Gets or sets chart value range by subtracting MaxValue from MinValue.
+
+
+
+
+
protected float ValueRange { get; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Width
+
+
+
+ Gets or sets control Width
+
+
+
+
+
protected float Width { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - float
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _canvas
+
+
+
+
+
+
+
+
protected ICanvas _canvas { get; set; }
+
+
+
+
+
+
+ Property Value
+
+ - ICanvas
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+
+
+
+ Calculates footer total height
+
+
+
+
+
protected virtual float CalculateFooterHeight(SizeF[] valueLabelSizes)
+
+
+ Parameters
+
+ valueLabelSizes SizeF[]
+ Label size
+
+
+
+ Returns
+
+ - float
+ Labels height
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Calculates header height
+
+
+
+
+
protected virtual float CalculateHeaderHeight(SizeF[] valueLabelSizes)
+
+
+ Parameters
+
+ valueLabelSizes SizeF[]
+ Label size
+
+
+
+ Returns
+
+ - float
+ Header total height
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculateHorizontalYLineCoordinate(float, SizeF, float, float)
+
+
+
+ For a given value, calculates its Y coordinate within current canvas
+
+
+
+
+
protected virtual PointF CalculateHorizontalYLineCoordinate(float value, SizeF itemSize, float origin, float headerHeight)
+
+
+ Parameters
+
+ value float
+ Value to calculate
+
+ itemSize SizeF
+ Item available size
+
+ origin float
+ Y coordinate origin coordinate
+
+ headerHeight float
+ Header height
+
+
+
+ Returns
+
+ - PointF
+ Y Coordinate of given value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculateItemSize(List<ChartItem>, float, float, float, float)
+
+
+
+ Calculates the size chart is going to use when drawing each bar
+
+
+
+
+
protected virtual SizeF CalculateItemSize(List<ChartItem> entries, float width, float height, float footerHeight, float headerHeight)
+
+
+ Parameters
+
+ entries List<ChartItem>
+
+ width float
+ Control width
+
+ height float
+ Control height
+
+ footerHeight float
+ Chart footer label area height
+
+ headerHeight float
+ Chart header area height
+
+
+
+ Returns
+
+ - SizeF
+ The size for each bar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculateItemSize(float, float, float, float)
+
+
+
+ Calculates the size chart is going to use when drawing each bar
+
+
+
+
+
protected virtual SizeF CalculateItemSize(float width, float height, float footerHeight, float headerHeight)
+
+
+ Parameters
+
+ width float
+ Control width
+
+ height float
+ Control height
+
+ footerHeight float
+ Chart footer label area height
+
+ headerHeight float
+ Chart header area height
+
+
+
+ Returns
+
+ - SizeF
+ The size for each bar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculatePaddingForLabelValue(float, SizeF)
+
+
+
+ Calculate the center for a given rectangle
+
+
+
+
+
protected virtual float CalculatePaddingForLabelValue(float coordinateX, SizeF rect)
+
+
+ Parameters
+
+ coordinateX float
+ X axis coordinate
+
+ rect SizeF
+ Rectangle container to be centered
+
+
+
+ Returns
+
+ - float
+ Number indicating the center X coordinate within input rectangle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculatePoints(SizeF, float, float)
+
+
+
+ Calculates the coordinates of each value within the chart canvas
+
+
+
+
+
protected virtual PointF[] CalculatePoints(SizeF itemSize, float origin, float headerHeight)
+
+
+ Parameters
+
+ itemSize SizeF
+ Item size
+
+ origin float
+ Y axis origin coordinate
+
+ headerHeight float
+ Chart header area height
+
+
+
+ Returns
+
+ - PointF[]
+ Array with the points coordinates
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculatePoints(List<ChartItem>, SizeF, float, float)
+
+
+
+ Calculates the coordinates of each value within the chart canvas
+
+
+
+
+
protected virtual PointF[] CalculatePoints(List<ChartItem> entries, SizeF itemSize, float origin, float headerHeight)
+
+
+ Parameters
+
+ entries List<ChartItem>
+
+ itemSize SizeF
+ Item size
+
+ origin float
+ Y axis origin coordinate
+
+ headerHeight float
+ Chart header area height
+
+
+
+ Returns
+
+ - PointF[]
+ Array with the points coordinates
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CalculateYOrigin(float, float)
+
+
+
+ Calculates the Y axis origin value
+
+
+
+
+
protected float CalculateYOrigin(float itemHeight, float headerHeight)
+
+
+ Parameters
+
+ itemHeight float
+ Each bar width
+
+ headerHeight float
+ Control total height
+
+
+
+ Returns
+
+ - float
+ Y axis origin coordinate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ClearBackground(ICanvas, SizeF, Color)
+
+
+
+ Change current canvas background fill color
+
+
+
+
+
public virtual void ClearBackground(ICanvas canvas, SizeF containerSize, Color fillColor)
+
+
+ Parameters
+
+ canvas ICanvas
+ Current canvas
+
+ containerSize SizeF
+ Canvas size
+
+ fillColor Color
+ Fill color
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dispose()
+
+
+
+ Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+
+
+
+
+
public virtual void Dispose()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Draw(ICanvas, RectF)
+
+
+
+
+
+
+
+
public void Draw(ICanvas canvas, RectF dirtyRect)
+
+
+ Parameters
+
+ canvas ICanvas
+
+ dirtyRect RectF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DrawChart(ICanvas, RectF)
+
+
+
+ Calculates and draws the current chart with the Entries[] data
+
+
+
+
+
public virtual void DrawChart(ICanvas canvas, RectF dirtyRect)
+
+
+ Parameters
+
+ canvas ICanvas
+ Current canvas
+
+ dirtyRect RectF
+ Current canvas rect
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DrawHorizontalStepLines(ICanvas, IEnumerable<PointF>, float, float, float, float, float)
+
+
+
+ Draw horizontal lines in Y Axis
+
+
+
+
+
protected virtual void DrawHorizontalStepLines(ICanvas canvas, IEnumerable<PointF> points, float width, float height, float origin, float originX, float finalX)
+
+
+ Parameters
+
+ canvas ICanvas
+ Current canvas
+
+ points IEnumerable<PointF>
+ Current chart calculated points
+
+ width float
+ Current canvas total Width
+
+ height float
+ Current Canvas total Height
+
+ origin float
+ Y origin coordinate
+
+ originX float
+ X coordinate that determines where the line should start
+
+ finalX float
+ X coordinate that determines where the line should end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DrawLabels(ICanvas, PointF[], SizeF, float, float, float)
+
+
+
+ Draws footer and value labels on current canvas
+
+
+
+
+
protected virtual void DrawLabels(ICanvas canvas, PointF[] points, SizeF itemSize, float height, float footerHeight, float origin)
+
+
+ Parameters
+
+ canvas ICanvas
+ Canvas to draw on
+
+ points PointF[]
+ Coordinates for each footer label
+
+ itemSize SizeF
+ Item size
+
+ height float
+ Control height
+
+ footerHeight float
+ Chart footer area height
+
+ origin float
+ Y axis origin coordinate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DrawLabels(List<ChartItem>, ICanvas, PointF[], SizeF, float, float, float)
+
+
+
+ Draws footer and value labels on current canvas
+
+
+
+
+
protected virtual void DrawLabels(List<ChartItem> entries, ICanvas canvas, PointF[] points, SizeF itemSize, float height, float footerHeight, float origin)
+
+
+ Parameters
+
+ entries List<ChartItem>
+
+ canvas ICanvas
+ Canvas to draw on
+
+ points PointF[]
+ Coordinates for each footer label
+
+ itemSize SizeF
+ Item size
+
+ height float
+ Control height
+
+ footerHeight float
+ Chart footer area height
+
+ origin float
+ Y axis origin coordinate
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DrawVerticalStepLines(ICanvas, PointF[], float, float)
+
+
+
+
+
+
+
+
protected abstract void DrawVerticalStepLines(ICanvas canvas, PointF[] points, float origin, float maxPositiveValue)
+
+
+ Parameters
+
+ canvas ICanvas
+
+ points PointF[]
+
+ origin float
+
+ maxPositiveValue float
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Entries_CollectionChanged(object, NotifyCollectionChangedEventArgs)
+
+
+
+
+
+
+
+
protected virtual void Entries_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+
+
+ Parameters
+
+ sender object
+
+ e NotifyCollectionChangedEventArgs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Entry_PropertyChanged(object, PropertyChangedEventArgs)
+
+
+
+
+
+
+
+
protected virtual void Entry_PropertyChanged(object sender, PropertyChangedEventArgs e)
+
+
+ Parameters
+
+ sender object
+
+ e PropertyChangedEventArgs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MeasureLabels()
+
+
+
+ Gets the size for labels container rectangle by measuring text length
+
+
+
+
+
protected virtual SizeF[] MeasureLabels()
+
+
+
+ Returns
+
+ - SizeF[]
+ Array with labels rectangle containers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RequestInvalidate()
+
+
+
+ Trigger Invalidate() method on ChartView()
+
+
+
+
+
protected void RequestInvalidate()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TruncateText(ICanvas, SizeF, string)
+
+
+
+ Allows long words to be shortened by removing characters so it can fit within the provided area
+
+
+
+
+
protected string TruncateText(ICanvas canvas, SizeF availableSize, string text)
+
+
+ Parameters
+
+ canvas ICanvas
+ Canvas to draw on
+
+ availableSize SizeF
+ Represents the available width
+
+ text string
+ Text to truncate within the available area
+
+
+
+ Returns
+
+ - string
+ Truncated text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+