Search Framework:
BarGlyphBase
Namespace: WealthLab.ChartWPF
Parent: PlotBase

The BarGlyphBase class is the base class for small chart glyphs that appear above or below individual bars. BarGlyphs are commonly used to visually represent events such as dividends, splits, earnings, or chart patterns. BarGlyphBase derives from PlotBase, so it also inherits PlotBase's chart access, configuration, coordinate conversion, and rendering functionality.

Chart Related
Bars
public BarHistory Bars

Returns the BarHistory currently being displayed by the chart.


ChartPreferences
public ChartPreferences ChartPreferences

Returns the ChartPreferences associated with the chart. ChartPreferences contains the colors, styles, spacing, and other settings used when rendering the chart.


Color
public WLColor Color

Specifies the color associated with this plot object.


DefaultBrush
public Brush DefaultBrush

Returns the default WPF Brush used when rendering this plot object.


DefaultPen
public Pen DefaultPen

Returns the default WPF Pen used when rendering this plot object.


GetBarColor
public virtual WLColor GetBarColor(int idx)

Returns the WLColor that should be used to render the chart item associated with the BarHistory index idx.


GetMaxValue
public override double GetMaxValue(int start, int end)

Returns the highest y-axis value required to render this BarGlyph within the supplied BarHistory index range. If the glyph falls within the range and AboveBar is true, the method accounts for the glyph's height and PixelOffset so the chart can allocate sufficient vertical space. Otherwise it returns Double.MinValue.


GetMinValue
public override double GetMinValue(int start, int end)

Returns the lowest y-axis value required to render this BarGlyph within the supplied BarHistory index range. If the glyph falls within the range and AboveBar is false, the method accounts for the glyph's height and PixelOffset so the chart can allocate sufficient vertical space. Otherwise it returns Double.MaxValue.


IsMouseOver
public override bool IsMouseOver(Point pt)

Returns true if the point in pt falls within the area occupied by the BarGlyph. BarGlyphBase determines the glyph's vertical position using the bar's High or Low, AboveBar, PixelOffset, and GlyphHeight.


Opacity
public byte Opacity

Contains the opacity used when rendering this plot object. When reading the property, the value is represented internally on a scale from 0 to 255. When assigning the property, the input represents a percentage from 0 to 100.



Configuration
ConfigKey
public virtual string ConfigKey

The key WealthLab uses when saving the object's Configuration. The default implementation is based on Name followed by "_Configuration".


Configuration
public string Configuration

Contains the configuration of the object expressed as a string. By default, the Configuration is generated from the Parameter instances in Parameters.


Description
public virtual string Description

Returns a short description of the object. WealthLab can display this text when the object's Parameters are edited.


EditConfig
public virtual string EditConfig()

Displays the standard configuration editor and returns the resulting Configuration string. Derived classes can override this method to provide a custom configuration interface.


IsConfigurable
public virtual bool IsConfigurable

Returns whether the object has configurable Parameters.


Name
public abstract string Name

Returns the name of the plot object.


Parameters
public ParameterList Parameters

Contains the Parameter instances that comprise the object's configuration.


ProcessConfig
public virtual void ProcessConfig()

Processes a changed Configuration string. The default implementation updates the object's Parameters from the new Configuration.



Coordinate Conversion
ConvertDateTimeToX
public double ConvertDateTimeToX(DateTime dt)

Converts the DateTime in dt to an x-axis pixel coordinate on the chart.


ConvertIndexToX
public double ConvertIndexToX(int idx)

Converts the BarHistory index in idx to an x-axis pixel coordinate.


ConvertValueToY
public double ConvertValueToY(double value)

Converts the data value in value to a y-axis pixel coordinate in the current chart pane.


ConvertXToDateTime
public DateTime ConvertXToDateTime(double x)

Converts the x-axis pixel coordinate in x to the corresponding DateTime in the charted BarHistory.


ConvertXToIndex
public virtual int ConvertXToIndex(double x)

Converts the x-axis pixel coordinate in x to an index in the charted BarHistory.


ConvertYToValue
public double ConvertYToValue(double y)

Converts the y-axis pixel coordinate in y to its corresponding data value.



Members
AboveBar
public virtual bool AboveBar

Determines whether the BarGlyph is positioned above or below its chart bar. The default value is false, which places the glyph below the bar. Override this property and return true to position the glyph above the bar.


BarsWide
public virtual int BarsWide

Returns the number of chart bars occupied by the glyph. The default value is 1.


DrawTooltip
public void DrawTooltip(DrawingContext dc, string txt, WLColor color, double y)

Renders a single-line tooltip for the BarGlyph. This method is typically called from RenderHighlight when the user moves the mouse over the glyph. The tooltip is horizontally centered around the glyph and adjusted to remain within the chart pane.


DrawTooltips
public void DrawTooltips(DrawingContext dc, List<ChartTooltip> tooltips, double y)

Renders a multi-line tooltip for the BarGlyph using the supplied ChartTooltip instances. Each ChartTooltip controls the text and color of one line. The tooltip is positioned relative to the glyph and adjusted as necessary to remain inside the chart pane.


GlyphHeight
public double GlyphHeight

Specifies the height of the BarGlyph in pixels. The default value is 12.


GlyphWidth
public double GlyphWidth

Specifies the width of the BarGlyph in pixels. The default value is 12.


Index
public int Index

Specifies the BarHistory index associated with the BarGlyph.


PixelOffset
public int PixelOffset

Specifies an additional vertical offset, in pixels, used when positioning the BarGlyph. WealthLab can use this value to separate multiple glyphs that occur on the same chart bar.



Rendering
HasMouseOverState
public virtual bool HasMouseOverState

Returns whether the plot object renders a special state when the mouse is positioned over it.


PostRender
public virtual void PostRender(DrawingContext dc)

WealthLab calls this method after the main rendering phase has completed.


PreRender
public virtual void PreRender(DrawingContext dc)

WealthLab calls this method before the main rendering phase begins.


Render
public abstract void Render(DrawingContext dc)

Override this method to render the plot object onto the supplied WPF DrawingContext.


RenderHighlight
public virtual void RenderHighlight(DrawingContext dc)

WealthLab calls this method when the plot object's mouse-over state should be rendered. A BarGlyph implementation can override this method and call DrawTooltip or DrawTooltips to display information about the glyph.


RenderPass
public virtual int RenderPass

Returns the chart rendering pass in which the plot object participates. WealthLab renders charts in multiple passes so that relatively static chart content can be buffered separately from transient elements such as cursors and mouse-over effects.