Ejemplo n.º 1
0
        public void Draw(ChartStyle chart)
        {
            Polyline pl = new Polyline();

            foreach (Point p in this.points)
            {
                pl.Points.Add(chart.NormalizePoint(p));
            }

            pl.Stroke = this.color;
            pl.StrokeThickness = 1.5d;

            chart.ChartCanvas.Children.Add(pl);
        }
Ejemplo n.º 2
0
        public void Draw(ChartStyle chart)
        {
            Polyline pl = new Polyline();

            foreach (Point p in this.points)
            {
                pl.Points.Add(chart.NormalizePoint(p));
            }

            pl.Stroke          = this.color;
            pl.StrokeThickness = 1.5d;

            chart.ChartCanvas.Children.Add(pl);
        }
Ejemplo n.º 3
0
        public void Draw(ChartStyle chart, double width, double x)
        {
            double thirdWidth      = width * 0.34d;
            double quarterWidth    = width * 0.25d;
            double strokeThickness = 2.0d;

            Point pMinL = chart.NormalizePoint(new Point(x - quarterWidth, this.minimum));
            Point pMinR = chart.NormalizePoint(new Point(x + quarterWidth, this.minimum));
            Point pLQ   = chart.NormalizePoint(new Point(x, this.lowerQuartile));
            Point pMedL = chart.NormalizePoint(new Point(x - thirdWidth, this.median));
            Point pMedR = chart.NormalizePoint(new Point(x + thirdWidth, this.median));
            Point pUQ   = chart.NormalizePoint(new Point(x, this.upperQuartile));
            Point pMax  = chart.NormalizePoint(new Point(x, this.maximum));

            // Box
            Polygon plg = new Polygon();

            plg.Fill            = this.color;
            plg.Stroke          = this.color;
            plg.StrokeThickness = strokeThickness;
            plg.Points.Add(new Point(pMedL.X, pLQ.Y));
            plg.Points.Add(new Point(pMedR.X, pLQ.Y));
            plg.Points.Add(new Point(pMedR.X, pUQ.Y));
            plg.Points.Add(new Point(pMedL.X, pUQ.Y));


            TextBlock tBlock = new TextBlock();

            tBlock.TextWrapping = TextWrapping.Wrap;
            tBlock.Width        = 80.0d;
            tBlock.Text         = "Max: " + Math.Round(this.maximum, 3).ToString() + "\n" +
                                  "Q3: " + Math.Round(this.upperQuartile, 3).ToString() + "\n" +
                                  "Median: " + Math.Round(this.median, 3).ToString() + "\n" +
                                  "Q1: " + Math.Round(this.lowerQuartile, 3).ToString() + "\n" +
                                  "Min: " + Math.Round(this.minimum, 3).ToString();

            ToolTip tTip = new ToolTip();

            tTip.Content = tBlock;
            plg.ToolTip  = tTip;


            // Bottom Whiskers
            Line lBottomH = new Line();

            lBottomH.Stroke          = this.color;
            lBottomH.StrokeThickness = strokeThickness;
            lBottomH.X1      = pMinL.X;
            lBottomH.Y1      = pMinL.Y;
            lBottomH.X2      = pMinR.X;
            lBottomH.Y2      = pMinR.Y;
            lBottomH.ToolTip = tTip;

            Line lBottomV = new Line();

            lBottomV.Stroke          = this.color;
            lBottomV.StrokeThickness = strokeThickness;
            lBottomV.X1      = pLQ.X;
            lBottomV.Y1      = pMinL.Y;
            lBottomV.X2      = pLQ.X;
            lBottomV.Y2      = pLQ.Y;
            lBottomV.ToolTip = tTip;

            // Top Whiskers
            Line lTopH = new Line();

            lTopH.Stroke          = this.color;
            lTopH.StrokeThickness = strokeThickness;
            lTopH.X1      = pMinL.X;
            lTopH.Y1      = pMax.Y;
            lTopH.X2      = pMinR.X;
            lTopH.Y2      = pMax.Y;
            lTopH.ToolTip = tTip;

            Line lTopV = new Line();

            lTopV.Stroke          = this.color;
            lTopV.StrokeThickness = strokeThickness;
            lTopV.X1      = pMax.X;
            lTopV.Y1      = pMax.Y;
            lTopV.X2      = pUQ.X;
            lTopV.Y2      = pUQ.Y;
            lTopV.ToolTip = tTip;

            // Median line
            Line lMedian = new Line();

            lMedian.Stroke          = Brushes.Black;
            lMedian.StrokeThickness = strokeThickness;
            lMedian.X1 = pMedL.X;
            lMedian.Y1 = pMedL.Y;
            lMedian.X2 = pMedR.X;
            lMedian.Y2 = pMedR.Y;

            chart.ChartCanvas.Children.Add(plg);
            chart.ChartCanvas.Children.Add(lBottomV);
            chart.ChartCanvas.Children.Add(lTopV);
            chart.ChartCanvas.Children.Add(lBottomH);
            chart.ChartCanvas.Children.Add(lTopH);
            chart.ChartCanvas.Children.Add(lMedian);
        }
Ejemplo n.º 4
0
        public void Draw(ChartStyle chart, double width, double x)
        {
            double thirdWidth = width * 0.34d;
            double quarterWidth = width * 0.25d;
            double strokeThickness = 2.0d;

            Point pMinL = chart.NormalizePoint(new Point(x - quarterWidth, this.minimum));
            Point pMinR = chart.NormalizePoint(new Point(x + quarterWidth, this.minimum));
            Point pLQ = chart.NormalizePoint(new Point(x, this.lowerQuartile));
            Point pMedL = chart.NormalizePoint(new Point(x - thirdWidth, this.median));
            Point pMedR = chart.NormalizePoint(new Point(x + thirdWidth, this.median));
            Point pUQ = chart.NormalizePoint(new Point(x, this.upperQuartile));
            Point pMax = chart.NormalizePoint(new Point(x, this.maximum));

            // Box
            Polygon plg = new Polygon();
            plg.Fill = this.color;
            plg.Stroke = this.color;
            plg.StrokeThickness = strokeThickness;
            plg.Points.Add(new Point(pMedL.X, pLQ.Y));
            plg.Points.Add(new Point(pMedR.X, pLQ.Y));
            plg.Points.Add(new Point(pMedR.X, pUQ.Y));
            plg.Points.Add(new Point(pMedL.X, pUQ.Y));

            TextBlock tBlock = new TextBlock();
            tBlock.TextWrapping = TextWrapping.Wrap;
            tBlock.Width = 80.0d;
            tBlock.Text = "Max: " + Math.Round(this.maximum, 3).ToString() + "\n" +
                            "Q3: " + Math.Round(this.upperQuartile, 3).ToString() + "\n" +
                            "Median: " + Math.Round(this.median, 3).ToString() + "\n" +
                            "Q1: " + Math.Round(this.lowerQuartile, 3).ToString() + "\n" +
                            "Min: " + Math.Round(this.minimum, 3).ToString();

            ToolTip tTip = new ToolTip();
            tTip.Content = tBlock;
            plg.ToolTip = tTip;

            // Bottom Whiskers
            Line lBottomH = new Line();
            lBottomH.Stroke = this.color;
            lBottomH.StrokeThickness = strokeThickness;
            lBottomH.X1 = pMinL.X;
            lBottomH.Y1 = pMinL.Y;
            lBottomH.X2 = pMinR.X;
            lBottomH.Y2 = pMinR.Y;
            lBottomH.ToolTip = tTip;

            Line lBottomV = new Line();
            lBottomV.Stroke = this.color;
            lBottomV.StrokeThickness = strokeThickness;
            lBottomV.X1 = pLQ.X;
            lBottomV.Y1 = pMinL.Y;
            lBottomV.X2 = pLQ.X;
            lBottomV.Y2 = pLQ.Y;
            lBottomV.ToolTip = tTip;

            // Top Whiskers
            Line lTopH = new Line();
            lTopH.Stroke = this.color;
            lTopH.StrokeThickness = strokeThickness;
            lTopH.X1 = pMinL.X;
            lTopH.Y1 = pMax.Y;
            lTopH.X2 = pMinR.X;
            lTopH.Y2 = pMax.Y;
            lTopH.ToolTip = tTip;

            Line lTopV = new Line();
            lTopV.Stroke = this.color;
            lTopV.StrokeThickness = strokeThickness;
            lTopV.X1 = pMax.X;
            lTopV.Y1 = pMax.Y;
            lTopV.X2 = pUQ.X;
            lTopV.Y2 = pUQ.Y;
            lTopV.ToolTip = tTip;

            // Median line
            Line lMedian = new Line();
            lMedian.Stroke = Brushes.Black;
            lMedian.StrokeThickness = strokeThickness;
            lMedian.X1 = pMedL.X;
            lMedian.Y1 = pMedL.Y;
            lMedian.X2 = pMedR.X;
            lMedian.Y2 = pMedR.Y;

            chart.ChartCanvas.Children.Add(plg);
            chart.ChartCanvas.Children.Add(lBottomV);
            chart.ChartCanvas.Children.Add(lTopV);
            chart.ChartCanvas.Children.Add(lBottomH);
            chart.ChartCanvas.Children.Add(lTopH);
            chart.ChartCanvas.Children.Add(lMedian);
        }