Exemplo n.º 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));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Converts population level to a line and polygon
        /// </summary>
        /// <param name="results"></param>
        /// <param name="color"></param>
        /// <param name="label"></param>
        /// <returns></returns>
        public static LineAndPolygon ConvertResultsToPopulationLineAndPolygon(float[] results, Color color, string label)
        {
            ChartPrimitive populationLine = new ChartPrimitive();

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

            for (int monthNo = 0; monthNo < results.Length; monthNo += 2)
            {
                populationLine.AddPoint(new Point(monthNo * .5f, results[monthNo]));
                populationLine.AddPoint(new Point(monthNo * .5f + 1f, results[monthNo + 1]));
            }

            ChartPrimitive populationPolygon = ChartUtilities.ChartLineToBaseLinedPolygon(populationLine);

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

            return(new LineAndPolygon(populationLine, populationPolygon));
        }