private void c1Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button.Equals(MouseButtons.None))
            {
                C1Chart         chart  = (C1Chart)sender;
                ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);

                int g = -1, s = -1, p = -1, d = -1;
                if (region.Equals(ChartRegionEnum.Legend))
                {
                    if (chart.Legend.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                    {
                        if (g >= 0 && s >= 0)
                        {
                            chart.Footer.Text = "Series #" + s.ToString();
                        }
                    }
                }
                else
                {
                    ChartGroup grp = chart.ChartGroups[0];
                    if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref s, ref p, ref d))
                    {
                        if (d == 0 && s >= 0 && p >= 0)
                        {
                            chart.Footer.Text = "Slice #" + s.ToString();
                        }
                        else if (!chart.Footer.Text.Equals("Nowhere"))
                        {
                            chart.Footer.Text = "Nowhere";
                        }
                    }
                }
            }
        }
        private void c1Chart1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            C1Chart chart = (C1Chart)sender;
            int     g = 0, s = -1;

            ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);

            if (region.Equals(ChartRegionEnum.Legend))
            {
                Legend leg = chart.Legend;
                if (leg.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                {
                    if (s >= 0)
                    {
                        if (e.Button.Equals(MouseButtons.Left))
                        {
                            CycleSeries(s);
                        }
                        else if (e.Button.Equals(MouseButtons.Right))
                        {
                            ResetSeries(s);
                        }
                        else if (e.Button.Equals(MouseButtons.Middle))
                        {
                            ToggleSeriesDisplay(s);
                        }
                    }
                }
            }
        }
        private void c1Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            C1Chart    chart = (C1Chart)sender;
            int        g = 0, s = -1, p = -1, d = -1;
            ChartGroup grp = chart.ChartGroups[g];

            ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);

            string footerText = "Nowhere";

            if (region.Equals(ChartRegionEnum.Legend))
            {
                // if in the legend, check for the series and update
                // the footerText as appropriate
                Legend leg = chart.Legend;
                if (leg.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                {
                    if (s >= 0)
                    {
                        footerText = string.Format("Series {0}", s);
                    }
                }
            }
            else
            {
                // if it's close enough check for the series and update
                // the footerText as appropriate
                CoordinateFocusEnum focus = CoordinateFocusEnum.XandYCoord;
                bool stacked = grp.Stacked;
                int  minDist = 5;

                if (radioBar.Checked && !stacked)
                {
                    // special case where X focus is more appropriate
                    focus   = CoordinateFocusEnum.XCoord;
                    minDist = 0;
                }
                else if (radioPie.Checked || (radioBar.Checked && stacked))
                {
                    // special case where minimum distance of 0 is more
                    // appropriate.
                    minDist = 0;
                }

                if (grp.CoordToDataIndex(e.X, e.Y, focus, ref s, ref p, ref d))
                {
                    if (s >= 0 && p >= 0 && d <= minDist)
                    {
                        footerText = string.Format("Index({0},{1})", s, p);
                    }
                }
            }

            chart.Footer.Text = footerText;
        }
        private void c1Chart1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            C1Chart chart = (C1Chart)sender;

            if (e.Button.Equals(MouseButtons.Left))
            {
                int             g = -1, s = -1, p = -1, d = -1;
                ChartGroup      grp = chart.ChartGroups[0];
                ChartDataSeries ser = null;

                ChartRegionEnum region = chart.ChartRegionFromCoord(e.X, e.Y);
                if (region.Equals(ChartRegionEnum.Legend))
                {
                    if (chart.Legend.SeriesFromCoord(e.X, e.Y, ref g, ref s))
                    {
                        ser = grp.ChartData.SeriesList[s];
                        if (ser.Display.Equals(SeriesDisplayEnum.Show))
                        {
                            ser.Display = SeriesDisplayEnum.Hide;
                        }
                        else
                        {
                            ser.Display = SeriesDisplayEnum.Show;
                        }
                    }
                    return;
                }

                if (grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord,
                                         ref s, ref p, ref d))
                {
                    if (d == 0 && s >= 0 && p >= 0)
                    {
                        ser = grp.ChartData.SeriesList[s];
                        int offset = ser.Offset;
                        if (offset == 0)
                        {
                            offset = 40;
                        }
                        else
                        {
                            offset = 0;
                        }
                        ser.Offset = offset;

                        SetTextBoxSliceOffsetValue(s, offset);
                    }
                }
            }
        }