Exemple #1
0
        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);
        }
Exemple #2
0
 private void winChartViewer3_ClickHotSpot(object sender, WinHotSpotEventArgs e)
 {
     hotSpot(2, winChartViewer3, e);
 }