Esempio n. 1
0
        /// <summary>
        ///   Sets values for the chart and draws them.
        /// </summary>
        /// <param name = "graphics">
        ///   Graphics object used for drawing.
        /// </param>
        protected void DoDraw(Graphics graphics)
        {
            if (_values == null || _values.Length <= 0 || !HasNonZeroValue())
            {
                return;
            }

            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            var width  = ClientSize.Width - _leftMargin - _rightMargin;
            var height = ClientSize.Height - _topMargin - _bottomMargin;

            // if the width or height if <=0 an exception would be thrown -> exit method..
            if (width <= 0 || height <= 0)
            {
                return;
            }
            if (_pieChart != null)
            {
                _pieChart.Dispose();
            }
            if (_colors != null && _colors.Length > 0)
            {
                _pieChart = new PieChart3D(_leftMargin, _topMargin, width, height, _values, _colors,
                                           _sliceRelativeHeight);
            }
            else
            {
                _pieChart = new PieChart3D(_leftMargin, _topMargin, width, height, _values, _sliceRelativeHeight);
            }
            _pieChart.FitToBoundingRectangle = _fitChart;
            _pieChart.SetInitialAngle(_initialAngle);
            _pieChart.SetSliceRelativeDisplacements(_relativeSliceDisplacements);
            _pieChart.EdgeColorType    = _edgeColorType;
            _pieChart.EdgeLineWidth    = _edgeLineWidth;
            _pieChart.ShadowStyle      = _shadowStyle;
            _pieChart.HighlightedIndex = _highlightedIndex;
            _pieChart.Draw(graphics);
        }
Esempio n. 2
0
        /// <summary>
        ///   Sets values for the chart and draws them.
        /// </summary>
        /// <param name = "graphics">
        ///   Graphics object used for drawing.
        /// </param>
        protected void DoDraw(Graphics graphics)
        {
            if (_values == null || _values.Length <= 0 || !HasNonZeroValue())
                return;

            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            var width = ClientSize.Width - _leftMargin - _rightMargin;
            var height = ClientSize.Height - _topMargin - _bottomMargin;

            // if the width or height if <=0 an exception would be thrown -> exit method..
            if (width <= 0 || height <= 0)
                return;
            if (_pieChart != null)
                _pieChart.Dispose();
            if (_colors != null && _colors.Length > 0)
                _pieChart = new PieChart3D(_leftMargin, _topMargin, width, height, _values, _colors,
                                           _sliceRelativeHeight);
            else
                _pieChart = new PieChart3D(_leftMargin, _topMargin, width, height, _values, _sliceRelativeHeight);
            _pieChart.FitToBoundingRectangle = _fitChart;
            _pieChart.SetInitialAngle(_initialAngle);
            _pieChart.SetSliceRelativeDisplacements(_relativeSliceDisplacements);
            _pieChart.EdgeColorType = _edgeColorType;
            _pieChart.EdgeLineWidth = _edgeLineWidth;
            _pieChart.ShadowStyle = _shadowStyle;
            _pieChart.HighlightedIndex = _highlightedIndex;
            _pieChart.Draw(graphics);
        }