Exemplo n.º 1
0
        private void PieGraph_CheckedChanged(object sender, System.EventArgs e)
        {
            if(PieGraph.Checked)
            {
                if(BarGraph.Checked)
                {
                    BarGraph.Checked=false;
                }

                if(btnAverages.Enabled)
                {
                    if(m_source!=null)
                    {
                        m_source=null;
                    }
                    try
                    {
                        m_source=fillDataSource();
                        psLegendPanel.Refresh();
                        initializeClientChart(new Piechart(canvasPanel.Size));

                    }
                    catch(Exception ex)
                    {
                        MessageBox.Show ("Unable to draw the chart.The selected column may not have numeric values.\n"+ex.Message,"Error!");
                    }
                }
                m_hashTable.Clear();
            }
        }
Exemplo n.º 2
0
        private DefaultDataSource fillDataSource()
        {
            DefaultDataSource source = new DefaultDataSource();
            Series series = new Series();
            source.add(series);
            updateCumulativeData();
            if(m_hashTable.Count>26)
            {
                psLegendPanel.PanelState =PSUI.PSPanelState.Expanded ;
                double sizeMark=m_hashTable.Count/26.000  ;
                psLegendPanel.Height=Convert.ToInt32(System.Math.Ceiling(sizeMark)*550);
                psLegendPanel.Refresh();
            }

            foreach(object key in m_hashTable.Keys)
            {
                series.add(new DataPoint(Convert.ToString(key),(float)Convert.ToDouble(m_hashTable[key]),Color.FromArgb(randomizer.Next(255),randomizer.Next(255),randomizer.Next(255))));
            }
            return source;
        }