示例#1
0
        /// <summary>
        /// Converts movements to a graphical line and polygon
        /// </summary>
        /// <param name="results"></param>
        /// <param name="color"></param>
        /// <param name="label"></param>
        /// <returns></returns>
        public static LineAndPolygon ConvertResultsToMovementLineAndPolygon(float[] results, Color color, string label)
        {
            // Create the Line
            ChartPrimitive chartLine = new ChartPrimitive();

            chartLine.Color        = color;
            chartLine.Label        = label;
            chartLine.ShowInLegend = true;
            chartLine.HitTest      = true;

            for (int monthNo = 0; monthNo < results.Length; ++monthNo)
            {
                chartLine.AddSmoothHorizontalBar(new Point(monthNo + .5f, results[monthNo]));
            }

            // Create the polygon
            ChartPrimitive polygon = ChartUtilities.ChartLineToBaseLinedPolygon(chartLine);

            color.A              = (byte)(alpha * color.A);
            polygon.Color        = color;
            polygon.ShowInLegend = false;
            polygon.HitTest      = false;

            return(new LineAndPolygon(chartLine, polygon));
        }