コード例 #1
0
ファイル: VsPlayback.cs プロジェクト: tdhieu/openvss
        private void updateChart()
        {
            try
            {
                VsChartModel model = new VsChartModel();

                List<string> headname = new List<string>();

                if ("day".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List<int> value = engine.getNumberOfMotionInDay(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 0; i <= 23; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁÇѹ");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
                else if ("month".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List<int> value = engine.getNumberOfMotionInMonth(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 1; i <= 31; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁà´×͹");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
                else if ("year".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List<int> value = engine.getNumberOfMotionInYear(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 1; i <= 12; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁ»Õ");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace); ;
            }
        }
コード例 #2
0
ファイル: VsChartPresent.cs プロジェクト: tdhieu/openvss
        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); ;
            }
        }
コード例 #3
0
ファイル: VsPlayback.cs プロジェクト: xfbingshan/openvss
        private void updateChart()
        {
            try
            {
                VsChartModel model = new VsChartModel();

                List <string> headname = new List <string>();

                if ("day".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List <int> value = engine.getNumberOfMotionInDay(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 0; i <= 23; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁÇѹ");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
                else if ("month".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List <int> value = engine.getNumberOfMotionInMonth(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 1; i <= 31; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁà´×͹");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
                else if ("year".Equals(ChartMode))
                {
                    foreach (int i in camSelect)
                    {
                        List <int> value = engine.getNumberOfMotionInYear(timeBegin, timeEnd, camList[i].cameraID.ToString());
                        model.getCamData(camList[i].location, value);
                    }
                    for (int i = 1; i <= 12; i++)
                    {
                        headname.Add("" + i);
                    }

                    model.getMainTile("áÊ´§¡ÃÒ¿¢Í§à˵ءÒóìµÒÁ»Õ");
                    model.getHeaderName(headname);
                    chartPresent1.updateChartModel(model);
                }
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }
コード例 #4
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);;
            }
        }