コード例 #1
0
        void DrawValues(Graphics g)
        {
            int    bottom = this.Height - this.bottomBorder;
            double width  = (double)this.ValidWidth / (this.data.values.Count - 1);
            double min    = this.data.values[0];
            double max    = this.data.values[this.data.values.Count - 1];
            int    zero   = bottom;

            if (min < 0)
            {
                zero += (int)(min / (max - min) * this.valueChartHeight);
                g.DrawLine(Pens.Red, this.leftBorder, zero, this.Width - this.rightBorder, zero);
            }

            for (int i = 0; i < this.data.values.Count; i++)
            {
                Color4 c4 = TriMeshUtil.GradientColor((float)((this.data.values[i] - min) / (max - min)));
                Color  c  = Color.FromArgb((int)(c4.R), (int)(c4.G), (int)(c4.B));
                g.DrawLine(new Pen(c),
                           (int)(i * width) + this.leftBorder,
                           zero - (int)(this.data.values[i] / (max - min) * this.valueChartHeight),
                           (int)(i * width) + this.leftBorder,
                           zero);
            }
        }
コード例 #2
0
        void DrawHistogram(Graphics g)
        {
            int w = this.ValidWidth / this.data.hist.Length;

            if (w < 2)
            {
                w = 2;
            }
            for (int i = 0; i < this.data.hist.Length; i++)
            {
                double p  = (double)this.data.hist[i] / this.data.maxCount;
                int    l  = (int)(p * this.HistChartHeight);
                Color4 c4 = TriMeshUtil.GradientColor((float)i / this.data.hist.Length);
                Color  c  = Color.FromArgb((int)(c4.R), (int)(c4.G), (int)(c4.B));
                g.FillRectangle(new SolidBrush(c), i * w + this.leftBorder, this.HistChartHeight - l, w - 1, l);
            }
        }