private void chartControl1_ChartRegionMouseHover(object sender, ChartRegionMouseEventArgs e) { if (e.Region.SeriesIndex == 1 && this.Ser2CheckBox.Checked == false) { series1.FancyToolTip.Visible = false; } if (e.Region.SeriesIndex == 0 && this.Ser1CheckBox.Checked == false) { series2.FancyToolTip.Visible = false; } if (e.Region.SeriesIndex == 0 && this.Ser1CheckBox.Checked) { series1.FancyToolTip.Visible = true; series2.FancyToolTip.Visible = false; } if (e.Region.SeriesIndex == 1 && this.Ser2CheckBox.Checked) { series1.FancyToolTip.Visible = false; series2.FancyToolTip.Visible = true; } if (e.Region.SeriesIndex == -1) { series1.FancyToolTip.Visible = false; series2.FancyToolTip.Visible = false; } this.chartControl1.Redraw(true); }
private void chartControl1_ChartRegionClick(object sender, ChartRegionMouseEventArgs e) { if (e.Region.Type == ChartRegionType.ChartCustom) { this.isDragging = false; this.Cursor = Cursors.Default; } }
void chartControl1_ChartRegionMouseHover(object sender, ChartRegionMouseEventArgs e) { ChartPoint cpt = chartControl1.ChartArea.GetValueByPoint(e.Point); for (int i = 0; i < chartControl1.Series[0].Points.Count; i++) { chartControl1.Series[0].Styles[i].ResetSymbol(); } if (cpt != null && chartControl1.ChartArea.RenderBounds.Contains(e.Point)) { chartControl1.CustomPoints.Clear(); ChartPoint cpStock = null, cpVolume = null; Point clientPoint = Point.Empty; //Chart points for stock and volume series. stockPointIndex = GetPointIndex(cpt.DateX, 0); if (stockPointIndex != -1) { cpStock = this.chartControl1.Series[0].Points[stockPointIndex]; } int volumePointIndex = GetPointIndex(cpt.DateX, 1); if (volumePointIndex != -1) { cpVolume = this.chartControl1.Series[1].Points[volumePointIndex]; } if (cpStock != null && cpVolume != null) { //Display Date, High, Low, Open, Close and Volume values. this.label1.Text = "Date = " + cpt.DateX.ToShortDateString() + " Open = " + cpStock.YValues[3] + ", High = " + cpStock.YValues[0] + ", Low = " + cpStock.YValues[1] + ", Close = " + cpStock.YValues[2] + ", Volume = " + cpVolume.YValues[0]; //Custom Symbol at the active stock series point this.chartControl1.Series[0].Styles[stockPointIndex].Symbol.Shape = ChartSymbolShape.Square; this.chartControl1.Series[0].Styles[stockPointIndex].Symbol.Color = Color.Blue; this.chartControl1.Series[0].Styles[stockPointIndex].Symbol.Size = new Size(7, 7); //Custom Point at the active volume series point ChartCustomPoint ptVolume = new ChartCustomPoint(); ptVolume.Symbol.Color = Color.Blue; ptVolume.Symbol.Shape = ChartSymbolShape.Circle; ptVolume.Symbol.Size = new Size(7, 7); ptVolume.SeriesIndex = 1; ptVolume.PointIndex = volumePointIndex; ptVolume.CustomType = ChartCustomPointType.PointFollow; chartControl1.CustomPoints.Add(ptVolume); } } }
private void chartControl1_ChartRegionDoubleClick(object sender, ChartRegionMouseEventArgs e) { if (this.chkRegionDoubleClick.Checked) { if (e.Region.SeriesIndex == 0) { OutputText(String.Format("Double Click over Series 1 Column {0} Point : {1}", e.Region.PointIndex, e.Point)); ShowChartRegion("ChartSeries"); } else { OutputText(String.Format("Double Click over {0}", e.Region.Description.ToString())); ShowChartRegion(e.Region.Description.ToString()); } } }
void chartControl1_ChartRegionMouseMove(object sender, ChartRegionMouseEventArgs e) { bounds = this.chartControl1.ChartArea.RenderBounds; if (e.Point.X > bounds.Left && e.Point.X < bounds.Right && e.Point.Y > bounds.Top && e.Point.Y < bounds.Bottom) { point = FindClosestChartPoint(e.Point); closestPoint = this.chartControl1.ChartArea.GetPointByValue(point); currentPoint = point; if (previousPoint.X != currentPoint.X) { ClearTrackBall = true; this.chartControl1.Refresh(); } } previousPoint = currentPoint; }
//Highlights the series point and the corresponding LegendItem. private void chartControl1_ChartRegionMouseHover(object sender, ChartRegionMouseEventArgs e) { foreach (ChartLegend chartLegend in this.chartControl1.Legends) { chartLegend.BackInterior = new BrushInfo(GradientStyle.Vertical, legendColor); foreach (ChartLegendItem cli in chartLegend.Items) { cli.Font = new Font("Segoe UI", 8.0f, FontStyle.Regular); cli.TextColor = Color.Black; } } if (e.Region.SeriesIndex > -1) { chartControl1.Legends[this.chartControl1.Series[e.Region.SeriesIndex].LegendName].BackInterior = new BrushInfo(GradientStyle.Vertical, legendHighlightColor); this.chartControl1.Series[e.Region.SeriesIndex].LegendItem.Font = new Font("Segoe UI", 7.0f, FontStyle.Bold); this.chartControl1.Series[e.Region.SeriesIndex].LegendItem.TextColor = Color.FromArgb(44, 127, 179); } }
private void chartControl1_ChartRegionMouseHover(object sender, ChartRegionMouseEventArgs e) { Point mousePoint = new Point(e.Point.X, e.Point.Y); ChartPoint chpt = chartControl1.ChartArea.GetValueByPoint(new Point(e.Point.X, e.Point.Y)); Point pt = chartControl1.ChartArea.GetPointByValue(chpt); string text = ""; switch (e.Region.PointIndex) { case 0: text = "Automobile sales in the SUV segment"; break; case 1: text = "Automobile sales in the Car segment"; break; case 2: text = "Automobile sales in the Pickup segment"; break; case 3: text = "Automobile sales in the Minivan segment"; break; default: text = ""; break; } if (e.Region.PointIndex >= 0 && e.Region.PointIndex < 4) { this.chartControl1.Cursor = System.Windows.Forms.Cursors.Hand; } else { this.chartControl1.Cursor = System.Windows.Forms.Cursors.Default; } if (this.chartControl1.Series[0].Type == ChartSeriesType.Column) { toolTip1.SetToolTip(chartControl1, text); } }
void chartControl1_ChartRegionMouseMove(object sender, ChartRegionMouseEventArgs e) { Graphics g = this.chartControl1.CreateGraphics(); Rectangle bounds = this.chartControl1.ChartArea.RenderBounds; if (e.Point.X > bounds.Left && e.Point.X < bounds.Right && e.Point.Y > bounds.Top && e.Point.Y < bounds.Bottom) { Syncfusion.Windows.Forms.Chart.ChartPoint point = FindClosestChartPoint(e.Point); Point closestPoint = this.chartControl1.ChartArea.GetPointByValue(point); currentPoint = point; if (previousPoint.X != currentPoint.X) { updatePanel = false; this.chartControl1.Refresh(); updatePanel = true; TrackBallInfo.TrackBallLine.Color = Color.Orange; TrackBallInfo.TrackBallLine.Width = 2; g.DrawLine(TrackBallInfo.TrackBallLine, closestPoint.X, bounds.Top, closestPoint.X, bounds.Bottom); DrawTrackBallToolTip(g, point); } } previousPoint = currentPoint; }