IsVisibleOnChart()

View as Markdown

Definition

Indicates a chart object is visible on the chart. When the IsVisibleOnChart() method determines a chart object is not visible and returns false, the object will not be used in a render pass, will not be considered in a hit test, and will not be used for alerting. The base implementation is to always return true on all chart objects, however this behavior can be overridden for your custom object if desired.

Method Return Value

A virtual bool value which when true, the object will be rendered and can be interacted with by a user; otherwise false. Default value is true.

Syntax

You must override this method using the following syntax:

public override bool IsVisibleOnChart(ChartControl chartControl, ChartScale chartScale, DateTime firstTimeOnChart, DateTime lastTimeOnChart)

Method Parameters

ParameterDescription
chartControlA ChartControl representing the x-axis
chartScaleA ChartScale representing the y-axis
firstTimeOnChartA DateTime representing the first painted bar displayed on the chart
lastTimeOnChartA DateTime representing the last painted bar displayed on the chart

Examples

1public override bool IsVisibleOnChart(ChartControl chartControl, ChartScale chartScale, DateTime firstTimeOnChart, DateTime lastTimeOnChart)
2{
3 // check if any chart anchors are visible
4 foreach (ChartAnchor anchor in Anchors)
5 {
6 if (anchor.Time >= firstTimeOnChart && anchor.Time <= lastTimeOnChart)
7 return true;
8 }
9 return false; // otherwise the object should not be displayed
10}