Exemplo n.º 1
0
        /// <summary>
        /// When the user double click the control, we allow him to change the clicked group's color
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void skillPieChartControl_DoubleClick(object sender, EventArgs e)
        {
            // Retrieve the clicked segment
            MouseEventArgs ev         = (MouseEventArgs)e;
            PieChart3D     m_pieChart = skillPieChartControl.PieChart;
            int            index      = m_pieChart.FindPieSliceUnderPoint(new PointF(ev.X, ev.Y));

            // If none clicked, we return. Otherwise we open the color picker.
            if (index == -1)
            {
                return;
            }
            if (m_colorDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // The user picked a new color, we update our colors list.
            if (sortBySizeCheck.Checked)
            {
                int realIndex = skillPieChartControl.GetIndex(index);
                skillPieChartControl.Colors[realIndex] = Color.FromArgb(125, m_colorDialog.Color);
            }
            else
            {
                skillPieChartControl.Colors[index] = Color.FromArgb(125, m_colorDialog.Color);
            }

            // Forces an update of the control
            skillPieChartControl.OrderSlices(sortBySizeCheck.Checked);
        }
        /// <summary>
        ///   Sets values for the chart and draws them.
        /// </summary>
        /// <param name="graphics">
        ///   Graphics object used for drawing.
        /// </param>
		protected void DoDraw(IGUIContext ctx, Rectangle bounds)
        {
            if (m_values != null && m_values.Length > 0) 
            {                
                float width = bounds.Width - m_leftMargin - m_rightMargin;
				float height = bounds.Height - m_topMargin - m_bottomMargin;
                
				// if the width or height if <=0 an exception would be thrown -> exit method..
                if (width <= 0 || height <= 0)
                    return;
				
                if (m_pieChart != null)
                    m_pieChart.Dispose();
				
                if (m_colors != null && m_colors.Length > 0)
					m_pieChart = new PieChart3D(ctx, bounds.Left + m_leftMargin, bounds.Top + m_topMargin, width, height, m_values, m_colors, m_sliceRelativeHeight, m_texts);
                else
					m_pieChart = new PieChart3D(ctx, bounds.Left + m_leftMargin, bounds.Top + m_topMargin, width, height, m_values, m_sliceRelativeHeight, m_texts);
				
                m_pieChart.FitToBoundingRectangle = m_fitChart;
                m_pieChart.InitialAngle = m_initialAngle;
                m_pieChart.SliceRelativeDisplacements = m_relativeSliceDisplacements;
                m_pieChart.EdgeColorType = m_edgeColorType;
                m_pieChart.EdgeLineWidth = m_edgeLineWidth;
                m_pieChart.ShadowStyle = m_shadowStyle;
                m_pieChart.HighlightedIndex = m_highlightedIndex;
                m_pieChart.Draw(ctx, bounds);

                m_pieChart.Font = this.Font;
                m_pieChart.ForeColor = this.ForeColor;
                m_pieChart.PlaceTexts(ctx);				               
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 绑定Chart图


        /// </summary>
        public void DataBind()
        {
            DefineChartStyle();

            DataTable data = ConvertDataTable();

            PieChart3D.DataSource = data;
            PieChart3D.DataBind();
        }
Exemplo n.º 4
0
 public PrintChart(PieChart3D pieChart)
 {
     m_pieChart = pieChart;
 }