C# Class MSChartExtension, MSChartExtension

Extension class for MSChart
Exibir arquivo Open project: Code-Artist/MSChartExtension

Public Methods

Method Description
AddText ( this sender, string text, double x, double y, Drawing, textColor, string name = "", TextStyle, textStyle = TextStyle.Default, ChartArea chartArea = null ) : Annotation,

Add text annotation to chart.

ClearPoints ( this sender ) : void

Speed up MSChart data points clear operations.

Cursor1 ( this sender ) : ChartCursor

Return Cursor 1 Object

Cursor2 ( this sender ) : ChartCursor

Return Cursor 2 Object

CursorsDiff ( this sender ) : PointF

Calculate different between Cursor2 and Cursor1 where result = Cursor2 - Cursor1. Return 0 if either cursor is not valid.

DisableZoomAndPanControls ( this sender ) : void

Disable Zoom and Pan Controls

DrawHorizontalLine ( this sender, double y, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation

Draw a horizontal line on chart.

DrawLine ( this sender, double x0, double x1, double y0, double y1, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation

Draw a line on chart.

DrawRectangle ( this sender, double x, double y, double width, double height, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation

Draw a rectangle on chart.

DrawVerticalLine ( this sender, double x, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation

Draw a vertical line on chart.

EnableZoomAndPanControls ( this sender ) : void

Enable Zoom and Pan Controls.

EnableZoomAndPanControls ( this sender, CursorPositionChanged selectionChanged, CursorPositionChanged cursorMoved, ZoomChanged zoomChanged = null, ChartOption option = null ) : void

Enable Zoom and Pan Controls.

Callback are optional (pass in null to ignore).

WARNING: Add or Remove Chart Area or Chart Series after enabled zoom and pan controls may cause unexpected behavior.

Recommended to enable the zoom and pan controls after configure the ChartArea and Series.

GetChartAreaBoundary ( this sender, bool primaryAxis = true ) : RectangleF

Return the entire chart boundary

GetChartToolState ( this sender ) : MSChartExtensionToolState

Get current control state.

GetChartVisibleAreaBoundary ( this sender, bool primaryAxis = true ) : RectangleF

Return chart boundary for visible area.

Private Methods

Method Description
ChartAreaHitTest ( object sender, Point, cursorPos ) : ChartArea
ChartContext_ItemClicked ( object sender, ToolStripItemClickedEventArgs, e ) : void
ChartContext_Opening ( object sender, CancelEventArgs, e ) : void
ChartControl_MouseDown ( object sender, MouseEventArgs, e ) : void
ChartControl_MouseMove ( object sender, MouseEventArgs, e ) : void
ChartControl_MouseUp ( object sender, MouseEventArgs, e ) : void
ChartControl_MouseWheel ( object sender, MouseEventArgs e ) : void
GetChartAreaBoundary ( ChartArea sender, bool primaryAxis, bool visibleAreaOnly ) : RectangleF
ScaleViewScroll ( Axis ptrAxis, int delta ) : void
ScaleViewZoom ( Axis ptrAxis, int delta ) : void
SetChartControlState ( Chart sender, MSChartExtensionToolState state ) : void
UpdateChartControlState ( Chart sender ) : void

Method Details

AddText() public static method

Add text annotation to chart.
public static AddText ( this sender, string text, double x, double y, Drawing, textColor, string name = "", TextStyle, textStyle = TextStyle.Default, ChartArea chartArea = null ) : Annotation,
sender this Source Chart.
text string Text to display.
x double Text box upper left X Coordinate.
y double Text box upper left Y coordinate.
textColor Drawing, Text color.
name string Annotation name.
textStyle TextStyle, Style of text.
chartArea ChartArea Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.
return Annotation,

ClearPoints() public static method

Speed up MSChart data points clear operations.
public static ClearPoints ( this sender ) : void
sender this
return void

Cursor1() public static method

Return Cursor 1 Object
public static Cursor1 ( this sender ) : ChartCursor
sender this
return ChartCursor

Cursor2() public static method

Return Cursor 2 Object
public static Cursor2 ( this sender ) : ChartCursor
sender this
return ChartCursor

CursorsDiff() public static method

Calculate different between Cursor2 and Cursor1 where result = Cursor2 - Cursor1. Return 0 if either cursor is not valid.
public static CursorsDiff ( this sender ) : PointF
sender this
return PointF

DisableZoomAndPanControls() public static method

Disable Zoom and Pan Controls
public static DisableZoomAndPanControls ( this sender ) : void
sender this
return void

DrawHorizontalLine() public static method

Draw a horizontal line on chart.
public static DrawHorizontalLine ( this sender, double y, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation
sender this Source Chart.
y double YAxis value.
lineColor Drawing Line color.
name string Annotation name.
lineWidth int Line width
lineStyle ChartDashStyle Line style
chartArea ChartArea Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.
return Annotation

DrawLine() public static method

Draw a line on chart.
public static DrawLine ( this sender, double x0, double x1, double y0, double y1, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation
sender this Source Chart.
x0 double First point on XAxis.
x1 double Second piont on XAxis.
y0 double First point on YAxis.
y1 double Second point on YAxis.
lineColor Drawing Outline color.
name string Annotation name.
lineWidth int Line width
lineStyle ChartDashStyle Line style
chartArea ChartArea Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.
return Annotation

DrawRectangle() public static method

Draw a rectangle on chart.
public static DrawRectangle ( this sender, double x, double y, double width, double height, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation
sender this Source Chart.
x double XAxis value
y double YAxis value
width double rectangle width using XAis value.
height double rectangle height using YAis value.
lineColor Drawing Outline color.
name string Annotation name.
lineWidth int Line width
lineStyle ChartDashStyle Line style
chartArea ChartArea Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.
return Annotation

DrawVerticalLine() public static method

Draw a vertical line on chart.
public static DrawVerticalLine ( this sender, double x, Drawing lineColor, string name = "", int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null ) : Annotation
sender this Source Chart.
x double XAxis value.
lineColor Drawing Line color.
name string Annotation name.
lineWidth int Line width
lineStyle ChartDashStyle Line style
chartArea ChartArea Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.
return Annotation

EnableZoomAndPanControls() public static method

Enable Zoom and Pan Controls.
public static EnableZoomAndPanControls ( this sender ) : void
sender this
return void

EnableZoomAndPanControls() public static method

Enable Zoom and Pan Controls.

Callback are optional (pass in null to ignore).

WARNING: Add or Remove Chart Area or Chart Series after enabled zoom and pan controls may cause unexpected behavior.

Recommended to enable the zoom and pan controls after configure the ChartArea and Series.

public static EnableZoomAndPanControls ( this sender, CursorPositionChanged selectionChanged, CursorPositionChanged cursorMoved, ZoomChanged zoomChanged = null, ChartOption option = null ) : void
sender this The sender.
selectionChanged CursorPositionChanged Selection changed callabck. Triggered when user select a point with selec tool.
cursorMoved CursorPositionChanged Cursor moved callabck. Triggered when user move the mouse in chart area.
zoomChanged ZoomChanged Callback triggered when chart has /// zoomed in or out (and on first painting of the chart).
option ChartOption Additional user options
return void

GetChartAreaBoundary() public static method

Return the entire chart boundary
public static GetChartAreaBoundary ( this sender, bool primaryAxis = true ) : RectangleF
sender this
primaryAxis bool
return RectangleF

GetChartToolState() public static method

Get current control state.
public static GetChartToolState ( this sender ) : MSChartExtensionToolState
sender this
return MSChartExtensionToolState

GetChartVisibleAreaBoundary() public static method

Return chart boundary for visible area.
public static GetChartVisibleAreaBoundary ( this sender, bool primaryAxis = true ) : RectangleF
sender this
primaryAxis bool
return RectangleF