예제 #1
0
        /// <summary>Draws the specified series definition on the view.</summary>
        /// <param name="definition">The definition.</param>
        private void DrawOnView(List <Annotation> annotations)
        {
            double minimumX         = graphView.AxisMinimum(Axis.AxisType.Bottom);
            double maximumX         = graphView.AxisMaximum(Axis.AxisType.Bottom);
            double minimumY         = graphView.AxisMinimum(Axis.AxisType.Left);
            double maximumY         = graphView.AxisMaximum(Axis.AxisType.Left);
            double majorStepY       = graphView.AxisMajorStep(Axis.AxisType.Left);
            double lowestAxisScale  = Math.Min(minimumX, minimumY);
            double largestAxisScale = Math.Max(maximumX, maximumY);

            for (int i = 0; i < annotations.Count; i++)
            {
                int    numLines = StringUtilities.CountSubStrings(annotations[i].text, "\r\n") + 1;
                double interval = (largestAxisScale - lowestAxisScale) / 10; // fit 10 annotations on graph.

                double yPosition = largestAxisScale - i * interval;
                graphView.DrawText(annotations[i].text, minimumX, yPosition, Axis.AxisType.Bottom, Axis.AxisType.Left, annotations[i].colour);
            }
        }
예제 #2
0
        /// <summary>Draws the specified series definition on the view.</summary>
        /// <param name="definition">The definition.</param>
        private void DrawOnView(List <Annotation> annotations)
        {
            double minimumX         = graphView.AxisMinimum(Axis.AxisType.Bottom);
            double maximumX         = graphView.AxisMaximum(Axis.AxisType.Bottom);
            double minimumY         = graphView.AxisMinimum(Axis.AxisType.Left);
            double maximumY         = graphView.AxisMaximum(Axis.AxisType.Left);
            double majorStepY       = graphView.AxisMajorStep(Axis.AxisType.Left);
            double lowestAxisScale  = Math.Min(minimumX, minimumY);
            double largestAxisScale = Math.Max(maximumX, maximumY);

            for (int i = 0; i < annotations.Count; i++)
            {
                if (annotations[i] is TextAnnotation)
                {
                    TextAnnotation textAnnotation = annotations[i] as TextAnnotation;
                    if (textAnnotation.x is double && ((double)textAnnotation.x) == double.MinValue)
                    {
                        double interval = (largestAxisScale - lowestAxisScale) / 10; // fit 10 annotations on graph.

                        double yPosition = largestAxisScale - i * interval;
                        double xPosition = minimumX + (maximumX - minimumX) * 0.01;
                        graphView.DrawText(textAnnotation.text, xPosition, yPosition,
                                           textAnnotation.leftAlign, textAnnotation.textRotation,
                                           Axis.AxisType.Bottom, Axis.AxisType.Left, textAnnotation.colour);
                    }
                    else
                    {
                        graphView.DrawText(textAnnotation.text, textAnnotation.x, textAnnotation.y,
                                           textAnnotation.leftAlign, textAnnotation.textRotation,
                                           Axis.AxisType.Bottom, Axis.AxisType.Left, textAnnotation.colour);
                    }
                }
                else
                {
                    LineAnnotation lineAnnotation = annotations[i] as LineAnnotation;

                    graphView.DrawLine(lineAnnotation.x1, lineAnnotation.y1,
                                       lineAnnotation.x2, lineAnnotation.y2,
                                       lineAnnotation.type, lineAnnotation.thickness, lineAnnotation.colour);
                }
            }
        }