/// <summary> /// ClickHotSpot event handler. In this demo, we just list out the hot spot information in /// a pop up dialog. /// </summary> private void winChartViewer1_ClickHotSpot(object sender, WinHotSpotEventArgs e) { // We show the pop up dialog only when the mouse action is not in zoom-in or zoom-out mode. if ((winChartViewer1.MouseUsage != WinChartMouseUsage.ZoomIn) && (winChartViewer1.MouseUsage != WinChartMouseUsage.ZoomOut)) { new ParamViewer().Display(sender, e); } }
private void winChartViewer1_ClickHotSpot(object sender, WinHotSpotEventArgs e) { Hashtable ht = e.GetAttrValues(); ht.Add("数据值", e.AttrValues["value"]); ht.Add("数据序号", e.AttrValues["xLabel"]); new FrmParamViewer().Display(sender, e); }
private void hotSpot(int index, WinChartViewer viewer, WinHotSpotEventArgs e) { String nodeName; Hashtable table = e.AttrValues; String chartSubType = table["dataSetName"].ToString(); if (chartSubType.Length == 0) { bool found = false; // clicking is inexact, try and see if we're nearby something that is clickable for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { // check ++, +-, -+, -- if (!found) { table = viewer.GetHotSpot(e.X + i, e.Y + j); if (table != null) { chartSubType = table["dataSetName"].ToString(); if (chartSubType.Length > 0) { found = true; } } } if (!found) { table = viewer.GetHotSpot(e.X + i, e.Y - j); if (table != null) { chartSubType = table["dataSetName"].ToString(); if (chartSubType.Length > 0) { found = true; } } } if (!found) { table = viewer.GetHotSpot(e.X - i, e.Y + j); if (table != null) { chartSubType = table["dataSetName"].ToString(); if (chartSubType.Length > 0) { found = true; } } } } } if (!found) //if there is no dataSetName -- there is nothing to show on the popup { return; } } String xLabel = table["x"].ToString(); switch (index) { case 0: nodeName = first.Text; break; case 1: nodeName = second.Text; break; case 2: nodeName = third.Text; break; default: nodeName = "unknown"; break; } if (this.ChartOutputType.Equals(OutputType.INFO_ELEMENT)) { if (pop2 != null && pop2.Visible.Equals(true)) { pop2.Visible = false; } pop2 = new Chart.InfoTablePopUp(xLabel, nodeName, chartData.GetDataForDetailPopup(this.ChartOutputType, chartSubType, nodeName + "-" + xLabel)); pop2.Visible = true; } else { if (pop != null && pop.Visible.Equals(true)) { pop.Visible = false; } pop = new Chart.TablePopUp(xLabel, nodeName, chartData.GetDataForDetailPopup(this.ChartOutputType, chartSubType, nodeName + "-" + xLabel)); pop.Visible = true; } //Console.WriteLine("X: " + e.AttrValues["x"] + " Value: " + e.AttrValues["value"] + " Node: " + nodeName); }
private void winChartViewer3_ClickHotSpot(object sender, WinHotSpotEventArgs e) { hotSpot(2, winChartViewer3, e); }