private void _cursorTool_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e) { Steema.TeeChart.Tools.CursorTool _currentCursor = sender as Steema.TeeChart.Tools.CursorTool; double xValue = _currentCursor.XValue; double yValue = _currentCursor.YValue; ControlCollection parentControl = this.pnlChart.Controls; for (int i = 0; i < parentControl.Count; i++) { if (parentControl[i] is BaseChart) { BaseChart baseChart = parentControl[i] as BaseChart; for (int j = 0; j < baseChart.SPCChart.Chart.Tools.Count; j++) { if (baseChart.SPCChart.Chart.Tools[j].GetType() == typeof(Steema.TeeChart.Tools.CursorTool)) { Steema.TeeChart.Tools.CursorTool _CursorDesc = (Steema.TeeChart.Tools.CursorTool)baseChart.SPCChart.Chart.Tools[j]; if (_CursorDesc.Pen.Color == Color.Gray) { if (xValue != _CursorDesc.XValue && yValue != _CursorDesc.YValue) { CursorSynchronize(_currentCursor, _CursorDesc); break; } } } } } } }
public void InitializeChart() { if (ChartVariable.dtParamData != null && ChartVariable.dtParamData.Rows.Count > 0) { _dataManager.RawDataTable = ChartVariable.dtParamData; } int iChart = _llstChart.Count; int iHeight = 300; if (iChart == 1) { iHeight = this.pnlChart.Height; } else if (iChart > 1) { iHeight = this.pnlChart.Height / 2; } this.pnlChart.Controls.Clear(); DefaultChart chartBase = null; Steema.TeeChart.Tools.CursorTool _cursorTool = null; for (int i = _llstChart.Count - 1; i >= 0; i--) { string strKey = this._llstChart.GetKey(i).ToString(); string strValue = this._llstChart.GetValue(i).ToString(); chartBase = new DefaultChart(_dataManager); chartBase.ClearChart(); chartBase.Title = strValue; chartBase.Name = strKey; chartBase.Pagekey = Definition.PAGE_KEY_SPC_CONTROL_CHART_UC; chartBase.Itemkey = Definition.CHART_BUTTON.CHART_DEFAULT; chartBase.SPCChartTitlePanel.Name = strKey; chartBase.Height = iHeight; chartBase.URL = this.URL; chartBase.Dock = System.Windows.Forms.DockStyle.Top; chartBase.ContextMenu = this.bbtnListChart.ContextMenu; chartBase.ParentControl = this.pnlChart; chartBase.StartDateTime = ChartVariable.dateTimeStart; chartBase.EndDateTime = ChartVariable.dateTimeEnd; chartBase.SettingXBarInfo(strKey, Definition.CHART_COLUMN.TIME, ChartVariable.lstRawColumn, this._llstChartSeriesVisibleType); if (!chartBase.DrawSPCChart()) { continue; } _cursorTool = new Steema.TeeChart.Tools.CursorTool(); _cursorTool.Active = true; _cursorTool.Style = Steema.TeeChart.Tools.CursorToolStyles.Both; _cursorTool.Pen.Style = System.Drawing.Drawing2D.DashStyle.Dot; _cursorTool.Pen.Color = Color.Gray; _cursorTool.FollowMouse = true; _cursorTool.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(_cursorTool_Change); chartBase.SPCChart.Chart.Tools.Add(_cursorTool); chartBase.SPCChart.Chart.MouseLeave += new EventHandler(Chart_MouseLeave); chartBase.SPCChart.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(SPCChart_ClickSeries); this.pnlChart.Controls.Add(chartBase); } }
private void CursorSynchronize(Steema.TeeChart.Tools.CursorTool SRC, Steema.TeeChart.Tools.CursorTool DEST) { DEST.XValue = SRC.XValue; DEST.YValue = SRC.YValue; }