Пример #1
0
        private void drawLineChart(IDrawContext context, Axis axisX, Axis axisY)
        {
            var plotBase = new PointF(context.PlotArea.Left, context.PlotArea.Top);
            var startP   = new PointF();
            var endP     = new PointF();

            setPhisicalPos(ref endP, items[0].Key, items[0].Value, axisX, axisY, plotBase);

            if (items.Count == 1)
            {
                context.DrawPoint(endP, Width, Color);
                return;
            }
            startP = endP;
            for (var i = 1; i < items.Count; i++)
            {
                setPhisicalPos(ref endP, items[i].Key, items[i].Value, axisX, axisY, plotBase);
                //前から1pxも動いてなかったら線を引かない
                if (((int)(startP.X - endP.X) != 0) || ((int)(startP.Y - endP.Y) != 0))
                {
                    context.DrawLine(startP, endP, Width, Color);
                    startP = endP;
                }
            }
        }