Example #1
0
        private NNumericAxisPagingView GetVerticalAxisPagingView()
        {
            NNumericAxisPagingView view = null;

            switch (VerticalPageSizeComboBox.SelectedIndex)
            {
            case 0:
                view = new NNumericAxisPagingView(new NRange1DD(0, 3));
                break;

            case 1:
                view = new NNumericAxisPagingView(new NRange1DD(0, 4));
                break;

            case 2:
                view = new NNumericAxisPagingView(new NRange1DD(0, 5));
                break;

            default:
                Debug.Assert(false);
                break;
            }

            return(view);
        }
Example #2
0
        private void YAxisPageSizeNumericUpDown_ValueChanged(object sender, System.EventArgs e)
        {
            if (nChartControl1 == null || m_Update)
            {
                return;
            }

            NCartesianChart chart = nChartControl1.Charts[0] as NCartesianChart;

            if (chart != null)
            {
                NNumericAxisPagingView pagingView = chart.Axis(StandardAxis.PrimaryY).PagingView as NNumericAxisPagingView;
                pagingView.Length = (double)YAxisPageSizeNumericUpDown.Value;

                nChartControl1.Refresh();
            }
        }
Example #3
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Numeric Axis Paging");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomCenter;
            title.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // no legend
            nChartControl1.Legends.Clear();

            // setup chart
            m_Chart            = nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;

            // configure the X and Y axes to use linear scale without tick rounding
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.RoundToTickMax = false;
            linearScale.RoundToTickMin = false;

            // add interlace stripe to the X axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;
            linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            linearScale.RoundToTickMin = false;
            linearScale.RoundToTickMax = false;

            // add interlace stripe to the Y axis
            stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScale.StripStyles.Add(stripStyle);

            m_Chart.Axis(StandardAxis.PrimaryY).ScrollBar.ResetButton.Visible = false;

            // configure a XY scatter point chart
            NPointSeries point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            point.UseXValues             = true;
            point.Size                   = new NLength(5, NGraphicsUnit.Point);
            point.DataLabelStyle.Visible = false;

            point.Values.FillRandomRange(Random, 200, 0, 100);
            point.XValues.FillRandomRange(Random, 200, 0, 100);

            // configure the x and y axis paging
            NNumericAxisPagingView numericPagingView;

            numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 20));
            m_Chart.Axis(StandardAxis.PrimaryX).PagingView = numericPagingView;

            numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 20));
            m_Chart.Axis(StandardAxis.PrimaryY).PagingView = numericPagingView;

            // subscribe for the scrollbar value changed event
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.BeginValueChanged += new EventHandler(BottomAxisScrollbarValueChanged);
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ShowSliders        = false;
            m_Chart.Axis(StandardAxis.PrimaryY).ScrollBar.BeginValueChanged += new EventHandler(LeftAxisScrollbarValueChanged);
            m_Chart.Axis(StandardAxis.PrimaryY).ScrollBar.ShowSliders        = false;

            // apply style sheet
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);

            styleSheet.Apply(nChartControl1.Document);

            LeftAxisPageSizeNumericUpDown.Value    = 20;
            LeftAxisPageValueNumericUpDown.Value   = 10;
            BottomAxisPageSizeNumericUpDown.Value  = 20;
            BottomAxisPageValueNumericUpDown.Value = 10;

            ShowLeftScrollBarCheckBox.Checked        = true;
            ShowBottomScrollbarCheckBox.Checked      = true;
            LeftUseAutoSmallChangeCheckBox.Checked   = true;
            BottomUseAutoSmallChangeCheckBox.Checked = true;

            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
            nChartControl1.Refresh();
        }
Example #4
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Data Pan Tool<br/><font size = '12pt'>Demonstrates how to configure scrollbars with sliders and to enable data panning</font>");

            header.DockMode             = PanelDockMode.Top;
            header.Margins              = new NMarginsL(10, 10, 10, 10);
            header.TextStyle.TextFormat = TextFormat.XML;
            header.TextStyle.FontStyle  = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            header.ContentAlignment     = ContentAlignment.BottomRight;
            header.Location             = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            nChartControl1.Panels.Add(header);

            // configure the chart
            NCartesianChart chart = new NCartesianChart();

            chart.DockMode = PanelDockMode.Fill;
            chart.Margins  = new NMarginsL(10, 0, 10, 10);
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.BoundsMode = BoundsMode.Stretch;
            nChartControl1.Panels.Add(chart);

            // add some dummy data
            NPointSeries pointSeries = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pointSeries.UseXValues             = true;
            pointSeries.Name                   = "Point Series";
            pointSeries.BorderStyle.Width      = new NLength(1, NGraphicsUnit.Pixel);;
            pointSeries.BorderStyle.Color      = Color.DarkRed;
            pointSeries.DataLabelStyle.Visible = false;
            pointSeries.Size                   = new NLength(5, NGraphicsUnit.Point);

            NDataPoint dp = new NDataPoint();

            // add xy values
            for (int i = 0; i < 200; i++)
            {
                dp[DataPointValue.X]     = Random.Next(100);
                dp[DataPointValue.Y]     = Random.Next(100);
                dp[DataPointValue.Label] = "Item" + i.ToString();
                pointSeries.AddDataPoint(dp);
            }

            // configure chart axes
            // set the primary X axis in FixedPageSize mode
            double pageSize = 10;
            NAxis  primaryX = chart.Axis(StandardAxis.PrimaryX);

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            linearScale.RoundToTickMax = false;
            linearScale.RoundToTickMin = false;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add an interlaced strip to the Y axis
            NScaleStripStyle xInterlacedStrip = new NScaleStripStyle();

            xInterlacedStrip.SetShowAtWall(ChartWallType.Back, true);
            xInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray));
            linearScale.StripStyles.Add(xInterlacedStrip);

            primaryX.ScaleConfigurator = linearScale;
            NNumericAxisPagingView xPagingView = new NNumericAxisPagingView(new NRange1DD(0, pageSize));

            xPagingView.MinPageLength            = 1.0;
            primaryX.PagingView                  = xPagingView;
            primaryX.ScrollBar.Visible           = true;
            primaryX.ScrollBar.ViewRangeChanged += new EventHandler(OnXViewRangeChanged);

            // set the primary Y axis in FixedPageSize mode
            NAxis primaryY = chart.Axis(StandardAxis.PrimaryY);

            linearScale = new NLinearScaleConfigurator();
            linearScale.RoundToTickMax = false;
            linearScale.RoundToTickMin = false;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            // add an interlaced strip to the Y axis
            NScaleStripStyle yInterlacedStrip = new NScaleStripStyle();

            yInterlacedStrip.SetShowAtWall(ChartWallType.Back, true);
            yInterlacedStrip.FillStyle = new NColorFillStyle(Color.FromArgb(40, Color.LightGray));
            linearScale.StripStyles.Add(yInterlacedStrip);

            primaryY.ScaleConfigurator = linearScale;
            NNumericAxisPagingView yPagingView = new NNumericAxisPagingView(new NRange1DD(0, pageSize));

            yPagingView.MinPageLength            = 1.0;
            primaryY.PagingView                  = yPagingView;
            primaryY.ScrollBar.Visible           = true;
            primaryY.ScrollBar.ViewRangeChanged += new EventHandler(OnYViewRangeChanged);

            // disable the reset button
            chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;
            chart.Axis(StandardAxis.PrimaryY).ScrollBar.ResetButton.Visible = false;

            m_DataPanTool = new NDataPanTool();
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(m_DataPanTool);
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

            m_DataPanTool.Cancel += new EventHandler(OnCancel);

            // init form controls
            XAxisPageSizeNumericUpDown.Value     = (decimal)10;
            YAxisPageSizeNumericUpDown.Value     = (decimal)10;
            ShowScrollbarSlidersCheckBox.Checked = true;

            RepaintChartWhileDraggingCheckBox.Checked = m_DataPanTool.RepaintChartWhileDragging;
        }
Example #5
0
        private void callLowHighGraph(string projectName, string ScenarioName)
        {
            nChartControl1.Clear();
            nChartControl1.Legends.Clear();

            NLabel title = nChartControl1.Labels.AddHeader("이미지별 최대 최소 시간");
            //title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Bold);
            title.TextStyle.FontStyle = new NFontStyle(pfc.Families[0].ToString(), 18, FontStyle.Regular);
            //title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            // add a High-Low series
            m_HighLow = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow);
            m_HighLow.Name = "High-Low Series";
            m_HighLow.HighFillStyle = new NColorFillStyle(Color.FromArgb(68, 90, 108));
            m_HighLow.HighBorderStyle = new NStrokeStyle(Color.FromArgb(254, 181, 25));
            //m_HighLow.LowFillStyle = new NColorFillStyle(DarkOrange);
            m_HighLow.DataLabelStyle.Visible = true;
            m_HighLow.DataLabelStyle.Format = " <high_value>\n<low_value>";
            m_HighLow.LowValues.ValueFormatter = new NNumericValueFormatter("0.##");
            m_HighLow.HighValues.ValueFormatter = new NNumericValueFormatter("0.##");


            m_HighLow.DropLines = true;

            m_HighLow.ClearDataPoints();


            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();
            //m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;

            NNumericAxisPagingView numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 10));
            m_Chart.Axis(StandardAxis.PrimaryX).PagingView = numericPagingView;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

            NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
            scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount;

            scaleConfiguratorX.AutoLabels = false;

            // data 값을 다 불러와서
            foreach (ResultData.ResultInfo temp in rData.getRData())
            {
                // 현재 찾고자 하는 프로젝트와 시나리오랑 같으면
                if (temp.projectName == projectName && temp.taskName == ScenarioName)
                {
                    // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기
                    foreach (ResultData.ImgTime imgTemp in temp.pathInfo)
                    {
                        bool inList = false;

                        float timeValue = System.Convert.ToSingle(imgTemp.timeImg);

                        // 리스트 내에 같은 값 찾기

                        if (ImgTimeInfo.Count != 0)
                        {
                            foreach (ImgTime inListImg in ImgTimeInfo)
                            {
                                // 같은게 있다면
                                if (inListImg.imgName == imgTemp.imgName)
                                {
                                    // 현재 값이 high 보다 크다면
                                    if (inListImg.High <= timeValue)
                                        inListImg.High = timeValue;
                                    else if (inListImg.Low >= timeValue)
                                        inListImg.Low = timeValue;

                                    inList = true;

                                    break;
                                }
                            }
                        }

                        // 리스트 내에 없다면
                        if (inList == false)
                            ImgTimeInfo.Add(new ImgTime() { imgName = imgTemp.imgName, High = timeValue, Low = timeValue });
                    }
                }
            }

            foreach (ImgTime listImg in ImgTimeInfo)
            {
                scaleConfiguratorX.Labels.Add(listImg.imgName);
                m_HighLow.HighValues.Add(listImg.High);
                m_HighLow.LowValues.Add(listImg.Low);
            }

            nChartControl1.Refresh();
        }
Example #6
0
        private void callPersonalGraph(string projectName, string ScenarioName, int idx)
        {
            nChartControl1.Clear();

            //rData.getRData()[0].taskName 이런식으로 인덱스 줘서 사용하면 될 듯
            m_FuncCalculator = new NFunctionCalculator();

            nChartControl1.Legends.Clear();



            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Task x 소요 시간");
            //title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Regular);
            title.TextStyle.FontStyle = new NFontStyle(pfc.Families[0].ToString(), 18, FontStyle.Regular);
            title.ContentAlignment = ContentAlignment.BottomCenter;
            title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // setup chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.BoundsMode = BoundsMode.Stretch;
            m_Chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            m_Chart.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(75, NRelativeUnit.ParentPercentage));
            


            //m_Chart.Axis(StandardAxis.Depth).Visible = false;


            // add a line series for the function
            m_Line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line.MarkerStyle.Visible = true;
            m_Line.MarkerStyle.BorderStyle.Color = Color.DarkGreen;
            m_Line.MarkerStyle.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel);
            m_Line.MarkerStyle.Width = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            m_Line.MarkerStyle.Height = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            m_Line.MarkerStyle.PointShape = PointShape.Cylinder;
            m_Line.MarkerStyle.FillStyle = new NColorFillStyle(Color.Gold);
            m_Line.BorderStyle.Color = Color.DarkGreen;
            m_Line.BorderStyle.Width = new NLength(2, NGraphicsUnit.Pixel);
            m_Line.Legend.Mode = SeriesLegendMode.None;
            m_Line.DataLabelStyle.Format = "<value>";
            m_Line.Values.ValueFormatter = new NNumericValueFormatter("0.0");
            m_Line.ShadowStyle.Type = ShadowType.GaussianBlur;
            m_Line.ShadowStyle.Offset = new NPointL(2, 2);
            m_Line.ShadowStyle.Color = Color.FromArgb(120, 0, 0, 0);
            m_Line.ShadowStyle.FadeLength = new NLength(5);


            // add the bar series
            m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar.Name = "Bar1";
            m_Bar.Values.Name = "values";
            m_Bar.Values.ValueFormatter = new NNumericValueFormatter("0.0");
            m_Bar.MultiBarMode = MultiBarMode.Stacked;
            m_Bar.DataLabelStyle.Visible = true; // 바에 보이는 값
            //m_Bar.Legend.Mode = SeriesLegendMode.None; // 범례 안보이게 하는 거
            m_Bar.BarShape = BarShape.Cylinder;
            m_Bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            m_Bar.FillStyle = new NColorFillStyle(Color.DarkKhaki);
            m_Bar.ShadowStyle.Type = ShadowType.Solid;
            m_Bar.ShadowStyle.Offset = new NPointL(2, 2);
            m_Bar.ShadowStyle.Color = Color.FromArgb(80, 0, 0, 0);
            //m_Bar.Values.FillRandomRange(new Random(), 14, 0, 100);

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();
            //m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;

            NNumericAxisPagingView numericPagingView = new NNumericAxisPagingView(new NRange1DD(0, 10));
            m_Chart.Axis(StandardAxis.PrimaryX).PagingView = numericPagingView;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

            NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
            scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount;

            scaleConfiguratorX.AutoLabels = false;

            foreach (ResultData.ResultInfo temp in rData.getRData())
            {
                // 현재 찾고자 하는 프로젝트와 시나리오랑 같으면
                if (temp.projectName == projectName && temp.taskName == ScenarioName)
                {
                    if (idx == -1 /*&& temp.isMin == true*/) // ***************************************************************************************************************** check
                    {
                        ImgAverageInfo.Clear();

                        // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기
                        foreach (ResultData.ImgTime imgTemp in temp.pathInfo)
                        {
                            bool inList = false;

                            float timeValue = System.Convert.ToSingle(imgTemp.timeImg);

                            // 리스트 내에 같은 값 찾기

                            if (ImgAverageInfo.Count != 0)
                            {
                                foreach (ImgAverageTime inListImg in ImgAverageInfo)
                                {
                                    // 같은게 있다면
                                    if (inListImg.imgName == imgTemp.imgName)
                                    {
                                        inListImg.count += 1;
                                        inListImg.imgTime += timeValue;
                                        inList = true;
                                        break;
                                    }
                                }
                            }

                            // 리스트 내에 없다면
                            if (inList == false)
                                ImgAverageInfo.Add(new ImgAverageTime() { imgName = imgTemp.imgName, imgTime = timeValue, count = 1 });
                        }
                    }
                    // Idx랑 같으면
                    else if (temp.idx == idx)
                    {
                        // 해당 시나리오 값에서 이동한 path 이미지들 값 가져오기
                        foreach (ResultData.ImgTime imgTemp in temp.pathInfo)
                        {
                            scaleConfiguratorX.Labels.Add(imgTemp.imgName);
                            m_Bar.Values.Add(imgTemp.timeImg);
                        }
                    }
                }
            }


            if (idx == -1)
            {
                foreach (ImgAverageTime listImg in ImgAverageInfo)
                {
                    scaleConfiguratorX.Labels.Add(listImg.imgName);
                    m_Bar.Values.Add(listImg.imgTime / listImg.count);
                }
            }





            //m_FuncCalculator.Arguments.Add(m_Line.Values);
            m_FuncCalculator.Arguments.Add(m_Bar.Values);
            m_FuncCalculator.Expression = "CUMSUM(values)";
            m_Line.Values = m_FuncCalculator.Calculate();

            m_Line.Values.ValueFormatter = new NNumericValueFormatter("0.0");


            // form controls
            /*m_FunctionCombo.Items.Add("Power");
            m_FunctionCombo.Items.Add("Cumulative");
            m_FunctionCombo.Items.Add("Exponential Average");
            m_FunctionCombo.SelectedIndex = 0;*/


            nChartControl1.Refresh();
        }