Esempio n. 1
0
        private void pChart_MouseUp(object sender, MouseEventArgs e)
        {
            System.Windows.Forms.DataVisualization.Charting.HitTestResult result = pChart.HitTest(e.X, e.Y);

            int intLastSeriesIdx = pChart.Series.Count - 1;

            //Remove Previous Selection
            if (pChart.Series[intLastSeriesIdx].Name == "SelSeries")
            {
                pChart.Series.RemoveAt(intLastSeriesIdx);
            }

            if (result.ChartElementType == System.Windows.Forms.DataVisualization.Charting.ChartElementType.DataPoint)
            {
                //Brushing on Graph
                int index = result.PointIndex;

                double dblYValue    = pChart.Series[0].Points[index].YValues[0] + pChart.Series[1].Points[index].YValues[0];
                double dblSelYValue = pChart.Series[0].Points[index].YValues[0] + pChart.Series[1].Points[index].YValues[0] + pChart.Series[2].Points[index].YValues[0];

                double dblXvalue = pChart.Series[1].Points[index].XValue;

                var Selseries1 = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = "SelSeries",
                    Color             = System.Drawing.Color.Cyan,
                    BorderColor       = System.Drawing.Color.Black,
                    IsVisibleInLegend = false,
                    //BackHatchStyle = ChartHatchStyle.DiagonalCross,
                    ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column,
                };
                pChart.Series.Add(Selseries1);
                Selseries1.Points.AddXY(dblXvalue, dblSelYValue);

                string whereClause = strValueFldName + " = " + dblYValue.ToString();

                //Brushing to ActiveView
                pSnippet.FeatureSelectionOnActiveView(whereClause, pActiveView, pFLayer);

                //Brushing to other graphs
                pSnippet.BrushingToOthers(pFLayer, this.Handle);
            }
            else
            {
                //Clear Selection Both Histogram and ActiveView
                //Remove Previous Selection
                intLastSeriesIdx = pChart.Series.Count - 1;
                if (pChart.Series[intLastSeriesIdx].Name == "SelSeries")
                {
                    pChart.Series.RemoveAt(intLastSeriesIdx);
                }
                IFeatureSelection featureSelection = (IFeatureSelection)pFLayer;
                pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);
                featureSelection.Clear();
                pActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);

                //Brushing to other graphs
                pSnippet.BrushingToOthers(pFLayer, this.Handle);
            }
        }