コード例 #1
0
        // привязан к типу диаграммы (в данном случае - столбцовая, время - значение)

        public int GetStartBarNumber(SortedList <DateTime, List <double> > currentSeriesUnitedData, DiagramDrawingCalculator drawingCalculator, Point point)
        {
            var pointAnalyzer = new DiagramPointAnalyzer(currentSeriesUnitedData, drawingCalculator);

            int leftBar;
            var startBarNumber = pointAnalyzer.PointToBar(point, out leftBar);

            if (startBarNumber == -1)
            {
                startBarNumber = ++leftBar;
            }
            return(startBarNumber);
        }
コード例 #2
0
        public int GetFinishBarNumber(SortedList <DateTime, List <double> > currentSeriesUnitedData, DiagramDrawingCalculator drawingCalculator, Point point)
        {
            var pointAnalyzer = new DiagramPointAnalyzer(currentSeriesUnitedData, drawingCalculator);

            int leftBar;
            var finishBarNumber = pointAnalyzer.PointToBar(point, out leftBar);

            if (finishBarNumber == -1)
            {
                finishBarNumber = leftBar != -1 ? leftBar : 0;
            }
            return(finishBarNumber);
        }
コード例 #3
0
        public bool CreateHint(Point pt, out string context, out Brush background)
        {
            context    = "";
            background = Brushes.White;
            switch (_diagramMode)
            {
            case DiagramMode.BarVertical:
                int  barLeft;
                bool isOverBar;
                var  pointAnalyzer = new DiagramPointAnalyzer(_currentSeriesUnitedData, _diagramDrawingCalculator);
                var  bar           = pointAnalyzer.PointToBar(pt, out barLeft, out isOverBar);
                if (isOverBar)
                {
                    background = DefineBackground(bar);
                    context    = DefineContent(bar);
                    return(true);
                }

                if (bar != -1)
                {
                    Console.WriteLine("  {0}:{1}   Mouse pointer missed {2}th bar by height", pt.X, pt.Y, bar + 1);
                }
                else
                {
                    Console.WriteLine("  {0}:{1}   Mouse pointer is to the right of {2}th bar", pt.X, pt.Y, barLeft + 1);
                }
                return(false);

            case DiagramMode.Lines:
            case DiagramMode.SeparateLines:
                return(false);

            default:
                return(false);
            }
        }