Esempio n. 1
0
        public void updateChartModel(VsChartModel model)
        {
            //MessageBox.Show(System.IO.Directory.GetCurrentDirectory());
            try
            {
                m_chartSample1.ChartDescription.Columns.Clear();
                m_panelChartLegend.ChartLegendDescription.Items.Clear();
                if (model.dataModel.Count > 0)
                {
                    //MessageBox.Show("this" +model.dataModel.Count );


                    //list<colum<value>>
                    List <List <int> > data = new List <List <int> >();
                    List <string>      cams = new List <string>();

                    foreach (string head in model.headerNsme)
                    {
                        data.Add(new List <int>());
                    }


                    foreach (KeyValuePair <string, List <int> > kvp in model.dataModel)
                    {
                        //ChartColumn column = m_chartSample1.AddColumn(kvp);
                        int  sum       = 0;
                        int  c         = 0;
                        bool zeroValue = true;

                        foreach (int v in kvp.Value)
                        {
                            if (v > 0)
                            {
                                zeroValue = false;
                                break;
                            }
                        }

                        if (zeroValue)//debuggg
                        {
                            //c = 0;
                            foreach (int v in kvp.Value)
                            {
                                data[c].Add(v + 1);
                                sum = 0;
                                c++;
                            }

                            //MessageBox.Show("rero");
                        }
                        else
                        {
                            foreach (int v in kvp.Value)
                            {
                                data[c].Add(v);
                                //MessageBox.Show(">0");
                                sum += v;
                                c++;
                            }
                        }

                        cams.Add(kvp.Key);
                    }
                    int cc = 0;
                    foreach (string head in model.headerNsme)
                    {
                        ChartColumn column = m_chartSample1.AddColumn(data[cc].ToArray());
                        cc++;
                        column.Title = head;
                    }

                    Color[] predefinedColors = m_chartSample1.ChartDescription.PredefinedColors;

                    for (int i = 0; i < m_chartSample1.ChartDescription.NumberOfItemsPerColumn; i++)
                    {
                        m_panelChartLegend.AddItem(predefinedColors[i], cams[i]);
                    }

                    this.m_chartSample1.ChartDescription.VerticalAxisStep = 10000;//for auto set when step over
                    m_chartSample1.ChartDescription.BottomMargin          = 80;

                    m_chartSample1.ChartDescription.MainTitle = model.mainTitle;
                    //m_chartSample1.ChartDescription.RenderingMode = ChartRenderingMode.Linear3d;
                    m_chartSample1.ChartDescription.DisplayHiddenSides = false;
                    m_chartSample1.CumulativeMode = ChartCumulativeMode.StartFrom0;

                    this.m_chartSample1.ChartDescription.VerticalAxisMinValue = 1;//for buggggggggggg?????????
                }
                m_panelChartLegend.Invalidate();
                m_chartSample1.Invalidate();
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }
Esempio n. 2
0
        void FillInterface()
        {
            //
            // Chart 1
            //
            ChartColumn column1 = m_chartSample1.AddColumn(-5000, 0, 0, 2500);
            ChartColumn column2 = m_chartSample1.AddColumn(0, 0, 2000, 0);
            ChartColumn column3 = m_chartSample1.AddColumn(0, -3000, 0, 0);
            ChartColumn column4 = m_chartSample1.AddColumn(-500, -1000, -2508, -500);
            ChartColumn column5 = m_chartSample1.AddColumn(100, 250, 45, 800);
            ChartColumn column6 = m_chartSample1.AddColumn(0, 0, 0, 0);
            ChartColumn column7 = m_chartSample1.AddColumn(753, 200, 120, 475);
            ChartColumn column8 = m_chartSample1.AddColumn(753, 200, 120, 475);

            column1.Title = "January";
            column2.Title = "February";
            column3.Title = "March";
            column4.Title = "April";
            column5.Title = "May";
            column6.Title = "June";
            column7.Title = "July";
            column8.Title = "August";

            m_chartSample1.ChartDescription.BottomMargin       = 80;
            m_chartSample1.ChartDescription.MainTitle          = "One year evolution";
            m_chartSample1.ChartDescription.RenderingMode      = ChartRenderingMode.Linear3d;
            m_chartSample1.ChartDescription.DisplayHiddenSides = false;
            m_chartSample1.CumulativeMode = ChartCumulativeMode.StartFrom0;

            //
            // Chart 2
            //
            m_chartSample2.AddColumn(-5000, 210, 0, 500);
            m_chartSample2.AddColumn(500, 210, -2000, 150);
            m_chartSample2.AddColumn(3000, 220, 150, 275);
            m_chartSample2.AddColumn(-500, -1000, -2508, -500);
            m_chartSample2.AddColumn(100, 250, 45, 800);
            m_chartSample2.AddColumn(0, -1000, 0, 0);
            m_chartSample2.AddColumn(0, 0, 3860, 0);

            m_chartSample2.ChartDescription.RenderingMode = ChartRenderingMode.BarWith3dGradient;
            m_chartSample2.CumulativeMode = ChartCumulativeMode.StartFromLastValue;


            //
            // Chart 3
            //
            m_chartSample3.AddColumn(90, 5);
            m_chartSample3.AddColumn(50, 30);
            m_chartSample3.AddColumn(5, 5);
            m_chartSample3.AddColumn(20, 10);
            m_chartSample3.AddColumn(85, 10);
            m_chartSample3.AddColumn(0, 30);
            m_chartSample3.AddColumn(40, 20);

            m_chartSample3.ChartDescription.RenderingMode = ChartRenderingMode.BarWith3dGradient;
            m_chartSample3.CumulativeMode = ChartCumulativeMode.StartFromLastValue;


            //
            // Legend
            //
            m_panelChartLegend.ChartLegendDescription.MainTitle = "Who's who";
            Color[]  predefinedColors = m_chartSample1.ChartDescription.PredefinedColors;
            string[] legend           = { "Man", "Woman", "Boy", "Girl" };
            for (int i = 0; i < m_chartSample1.ChartDescription.NumberOfItemsPerColumn; i++)
            {
                m_panelChartLegend.AddItem(predefinedColors[i], legend [i]);
            }
        }