C# Class MSChartExtension, MSChartExtension

Extension class for MSChart
Afficher le fichier Open project: Code-Artist/MSChartExtension

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat Annotation,

ClearPoints() public static méthode

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

Cursor1() public static méthode

Return Cursor 1 Object
public static Cursor1 ( this sender ) : ChartCursor
sender this
Résultat ChartCursor

Cursor2() public static méthode

Return Cursor 2 Object
public static Cursor2 ( this sender ) : ChartCursor
sender this
Résultat ChartCursor

CursorsDiff() public static méthode

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
Résultat PointF

DisableZoomAndPanControls() public static méthode

Disable Zoom and Pan Controls
public static DisableZoomAndPanControls ( this sender ) : void
sender this
Résultat void

DrawHorizontalLine() public static méthode

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.
Résultat Annotation

DrawLine() public static méthode

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.
Résultat Annotation

DrawRectangle() public static méthode

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.
Résultat Annotation

DrawVerticalLine() public static méthode

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.
Résultat Annotation

EnableZoomAndPanControls() public static méthode

Enable Zoom and Pan Controls.
public static EnableZoomAndPanControls ( this sender ) : void
sender this
Résultat void

EnableZoomAndPanControls() public static méthode

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
Résultat void

GetChartAreaBoundary() public static méthode

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

GetChartToolState() public static méthode

Get current control state.
public static GetChartToolState ( this sender ) : MSChartExtensionToolState
sender this
Résultat MSChartExtensionToolState

GetChartVisibleAreaBoundary() public static méthode

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