Example #1
0
 /// <summary>
 /// Adds the range.
 /// </summary>
 /// <param name="value">The value.</param>
 public void AddRange(BarSliceCollection value)
 {
     for (int i = 0; (i < value.Count); i = (i + 1))
     {
         Add(value[i]);
     }
 }
Example #2
0
        /// <summary>
        /// Gets the maximum value.
        /// </summary>
        /// <returns></returns>
        private double GetMaximumValue()
        {
            double maxValue = Double.MinValue;

            BarSliceCollection barSliceCollection = barGraph.BarSliceCollection;

            if (barSliceCollection == null || barSliceCollection.Count == 0)
            {
                return(0);
            }

            if (barGraph.MultiBarDisplayStyle == MultiBarDisplayStyle.SingleBar)
            {
                foreach (BarSlice barSlice in barSliceCollection)
                {
                    if (barSlice.Value > maxValue)
                    {
                        maxValue = barSlice.Value;
                    }
                }
            }
            else
            {
                foreach (BarSlice barSlice in barSliceCollection)
                {
                    if (barSlice.GetType().Name == "BarSlice")
                    {
                        if (barSlice.Value > maxValue)
                        {
                            maxValue = barSlice.Value;
                        }
                    }
                    else
                    {
                        if (((MultipleBarSlice)barSlice).MaxValue > maxValue)
                        {
                            maxValue = ((MultipleBarSlice)barSlice).MaxValue;
                        }
                    }
                }
            }

            if (barGraph.RoundOffGridHeight)
            {
                if (maxValue < 10.0)
                {
                    maxValue = 10.0;
                }
            }

            if (barGraph.HonorScale && maxValue < barGraph.MaxScaleValue)
            {
                return(barGraph.MaxScaleValue);
            }
            else
            {
                return(maxValue);
            }
        }
Example #3
0
        /// <summary>
        /// Gets the minimum value.
        /// </summary>
        /// <returns></returns>
        private double GetMinimumValue()
        {
            double minValue = Double.MaxValue;

            BarSliceCollection barSliceCollection = barGraph.BarSliceCollection;

            if (barSliceCollection == null || barSliceCollection.Count == 0)
            {
                return(0.0);
            }

            if (barGraph.MultiBarDisplayStyle == MultiBarDisplayStyle.SingleBar)
            {
                foreach (BarSlice barSlice in barSliceCollection)
                {
                    if (barSlice.Value < minValue)
                    {
                        minValue = barSlice.Value;
                    }
                }
            }
            else
            {
                foreach (BarSlice barSlice in barSliceCollection)
                {
                    if (barSlice.GetType().Name == "BarSlice")
                    {
                        if (barSlice.Value < minValue)
                        {
                            minValue = barSlice.Value;
                        }
                    }
                    else
                    {
                        if (((MultipleBarSlice)barSlice).MinValue < minValue)
                        {
                            minValue = ((MultipleBarSlice)barSlice).MinValue;
                        }
                    }
                }
            }

            if (minValue > 0)
            {
                minValue = 0;
            }

            if (barGraph.RoundOffGridHeight)
            {
                if (minValue < 0.0 && minValue > -10.0)
                {
                    minValue = -10.0;
                }
            }

            return(minValue);
        }
Example #4
0
        /// <summary>
        /// Gets the single bar graph.
        /// </summary>
        /// <param name="size">The size.</param>
        /// <param name="graphTitle">The graph title.</param>
        /// <param name="values">The values.</param>
        /// <param name="barTexts">The bar texts.</param>
        /// <returns></returns>
        public static Image GetSingleBarGraph(Size size, string graphTitle, int[] values, string[] barTexts)
        {
            rand = new Random(100);
            bg   = SetUpGraph(size, graphTitle);
            if (barTexts == null)
            {
                barTexts = new string[values.Length];
            }

            BarSliceCollection bsc = new BarSliceCollection();

            for (int i = 0; i < values.Length; i++)
            {
                bsc.Add(new BarSlice(values[i], GetRandomColor(), barTexts[i]));
            }
            bg.BarSliceCollection = bsc;
            return(GraphRenderer.DrawGraph(bg));
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarGraph"/> class.
 /// </summary>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 public BarGraph(int width, int height)
     : base(width, height)
 {
     barSliceCollection = new BarSliceCollection();
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarGraph"/> class.
 /// </summary>
 /// <param name="size">The size.</param>
 public BarGraph(Size size)
     : base(size)
 {
     barSliceCollection = new BarSliceCollection();
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarGraph"/> class.
 /// </summary>
 public BarGraph()
 {
     barSliceCollection = new BarSliceCollection();
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarSliceCollection"/> class.
 /// </summary>
 /// <param name="value">The value.</param>
 public BarSliceCollection(BarSliceCollection value)
 {
     AddRange(value);
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BarSliceEnumerator"/> class.
 /// </summary>
 /// <param name="mappings">The mappings.</param>
 public BarSliceEnumerator(BarSliceCollection mappings)
 {
     temp           = ((IEnumerable)(mappings));
     baseEnumerator = temp.GetEnumerator();
 }