protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RedAxisZoneDropDownList.Items.Add("Front Left");
                RedAxisZoneDropDownList.Items.Add("Front Right");

                GreenAxisZoneDropDownList.Items.Add("Front Left");
                GreenAxisZoneDropDownList.Items.Add("Front Right");

                BlueAxisZoneDropDownList.Items.Add("Front Left");
                BlueAxisZoneDropDownList.Items.Add("Front Right");
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddHeader("Axis Docking<br/> <font size = '9pt'>Demonstrates how to use of the dock axis anchor and how to add custom axes</font>");

            header.TextStyle.TextFormat = TextFormat.XML;
            header.TextStyle.FontStyle  = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Left;
            header.TextStyle.ShadowStyle.Type            = ShadowType.LinearBlur;
            header.ContentAlignment = ContentAlignment.BottomRight;
            header.Location         = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // remove all legends
            nChartControl1.Legends.Clear();

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

            m_RedAxis           = m_Chart.Axis(StandardAxis.PrimaryY);
            m_GreenAxis         = m_Chart.Axis(StandardAxis.SecondaryY);
            m_GreenAxis.Visible = true;

            // Add a custom vertical axis
            m_BlueAxis = ((NCartesianAxisCollection)m_Chart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontLeft);

            // create three line series and dispay them on three vertical axes (red, green and blue axis)
            NLineSeries line1 = CreateLineSeries(Color.Red, Color.DarkRed, 10, 20);
            NLineSeries line2 = CreateLineSeries(Color.Green, Color.DarkGreen, 50, 100);
            NLineSeries line3 = CreateLineSeries(Color.Blue, Color.DarkBlue, 100, 200);

            line1.DisplayOnAxis(StandardAxis.PrimaryY, true);

            line2.DisplayOnAxis(StandardAxis.PrimaryY, false);
            line2.DisplayOnAxis(StandardAxis.SecondaryY, true);

            line3.DisplayOnAxis(StandardAxis.PrimaryY, false);
            line3.DisplayOnAxis(m_BlueAxis.AxisId, true);

            // now configure the axis appearance
            NLinearScaleConfigurator linearScale;

            // setup the red axis
            linearScale = new NLinearScaleConfigurator();
            m_RedAxis.ScaleConfigurator = linearScale;

            linearScale.RulerStyle.FillStyle                = new NColorFillStyle(Color.DarkRed);
            linearScale.RulerStyle.BorderStyle.Color        = Color.Red;
            linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Red;
            linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Red;
            linearScale.LabelStyle.TextStyle.FillStyle      = new NColorFillStyle(Color.DarkRed);

            // setup the green axis
            linearScale = new NLinearScaleConfigurator();
            m_GreenAxis.ScaleConfigurator = linearScale;

            linearScale.RulerStyle.FillStyle                = new NColorFillStyle(Color.DarkGreen);
            linearScale.RulerStyle.BorderStyle.Color        = Color.Green;
            linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Green;
            linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Green;
            linearScale.LabelStyle.TextStyle.FillStyle      = new NColorFillStyle(Color.DarkGreen);

            // setup the blue axis
            linearScale = new NLinearScaleConfigurator();
            m_BlueAxis.ScaleConfigurator = linearScale;

            linearScale.RulerStyle.FillStyle                = new NColorFillStyle(Color.DarkBlue);
            linearScale.RulerStyle.BorderStyle.Color        = Color.Blue;
            linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Blue;
            linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Blue;
            linearScale.LabelStyle.TextStyle.FillStyle      = new NColorFillStyle(Color.DarkBlue);

            UpdateAxisAnchors();
        }
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Jittering / Blur Effect");

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

            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Axis(StandardAxis.Depth).Visible = false;
            m_Chart.Depth = 34;
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            m_Chart.Projection.Type      = ProjectionType.Perspective;
            m_Chart.Projection.Elevation = 17;
            m_Chart.Projection.Rotation  = -10;

            Color c = Color.FromArgb(128, 128, 192);

            m_Chart.Wall(ChartWallType.Left).FillStyle  = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White);
            m_Chart.Wall(ChartWallType.Floor).FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, c, Color.White);
            m_Chart.Wall(ChartWallType.Back).FillStyle  = new NGradientFillStyle(GradientStyle.DiagonalDown, GradientVariant.Variant3, c, Color.White);

            NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);

            bubble.InflateMargins         = false;
            bubble.DataLabelStyle.Visible = false;
            bubble.Legend.Mode            = SeriesLegendMode.DataPoints;
            bubble.BubbleShape            = PointShape.Sphere;

            bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "B1", new NColorFillStyle(Color.DarkGoldenrod)));
            bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "B2", new NColorFillStyle(Color.IndianRed)));
            bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "B3", new NColorFillStyle(Color.DarkMagenta)));
            bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "B4", new NColorFillStyle(Color.DarkOrchid)));

            NBarSeries bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);

            bar.Name = "Stack 1";
            bar.DataLabelStyle.Visible = false;
            bar.BarShape          = BarShape.Cylinder;
            bar.WidthPercent      = 60;
            bar.DepthPercent      = 60;
            bar.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            bar.FillStyle         = new NColorFillStyle(Color.CornflowerBlue);
            bar.Values.FillRandomRange(Random, 4, 5, 15);

            bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            bar.MultiBarMode           = MultiBarMode.Stacked;
            bar.Name                   = "Stack 2";
            bar.DataLabelStyle.Visible = false;
            bar.BarShape               = BarShape.Cylinder;
            bar.WidthPercent           = 60;
            bar.DepthPercent           = 60;
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.FillStyle              = new NColorFillStyle(Color.Yellow);
            bar.Values.FillRandomRange(Random, 4, 5, 15);

            bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            bar.MultiBarMode           = MultiBarMode.Stacked;
            bar.Name                   = "Stack 3";
            bar.DataLabelStyle.Visible = false;
            bar.BarShape               = BarShape.Cylinder;
            bar.WidthPercent           = 60;
            bar.DepthPercent           = 60;
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.FillStyle              = new NColorFillStyle(Color.MediumSeaGreen);
            bar.Values.FillRandomRange(Random, 4, 5, 15);

            // init form controls
            for (int i = 2; i < 17; i++)
            {
                JitteringStepsComboBox.Items.Add(i.ToString());
            }

            JitteringStepsComboBox.SelectedIndex = nChartControl1.Settings.JitteringSteps - 2;
            JitteringDeviationUpDown.Value       = (decimal)nChartControl1.Settings.JitteringDeviation;
            JitteringStepsComboBox.Enabled       = false;
            JitteringDeviationUpDown.Enabled     = false;
            EnableJitteringCheckBox.Checked      = false;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stacked Line Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);

            // configure the chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlaced stripe to the Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(System.Drawing.Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            ((NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator).StripStyles.Add(stripStyle);

            // add the first line
            m_Line1                                                 = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line1.Name                                            = "Line 1";
            m_Line1.MultiLineMode                                   = MultiLineMode.Series;
            m_Line1.DataLabelStyle.Visible                          = false;
            m_Line1.DataLabelStyle.ArrowLength                      = new NLength(0, NRelativeUnit.ParentPercentage);
            m_Line1.DataLabelStyle.ArrowStrokeStyle.Width           = new NLength(0, NGraphicsUnit.Pixel);
            m_Line1.DataLabelStyle.TextStyle.BackplaneStyle.Shape   = BackplaneShape.Ellipse;
            m_Line1.DataLabelStyle.TextStyle.BackplaneStyle.Inflate = new NSizeL(6, 6);
            m_Line1.DataLabelStyle.TextStyle.FontStyle              = new NFontStyle("Arial", 8);
            m_Line1.LineSegmentShape                                = LineSegmentShape.Tape;
            m_Line1.DepthPercent                                    = 50;
            m_Line1.DataLabelStyle.Format                           = "<value>";

            // add the second line
            m_Line2      = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line2.Name = "Line 2";
            m_Line2.DataLabelStyle.Visible                          = false;
            m_Line2.MultiLineMode                                   = MultiLineMode.Stacked;
            m_Line2.DataLabelStyle.ArrowLength                      = new NLength(0);
            m_Line2.DataLabelStyle.ArrowStrokeStyle.Width           = new NLength(0, NGraphicsUnit.Pixel);
            m_Line2.DataLabelStyle.TextStyle.BackplaneStyle.Shape   = BackplaneShape.Ellipse;
            m_Line2.DataLabelStyle.TextStyle.BackplaneStyle.Inflate = new NSizeL(6, 6);
            m_Line2.DataLabelStyle.TextStyle.FontStyle              = new NFontStyle("Arial", 8);
            m_Line2.LineSegmentShape                                = LineSegmentShape.Tape;
            m_Line2.DepthPercent          = 50;
            m_Line2.DataLabelStyle.Format = "<value>";

            // add the third line
            m_Line3      = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line3.Name = "Line 3";
            m_Line3.DataLabelStyle.Visible                          = false;
            m_Line3.MultiLineMode                                   = MultiLineMode.Stacked;
            m_Line3.DataLabelStyle.ArrowLength                      = new NLength(0);
            m_Line3.DataLabelStyle.ArrowStrokeStyle.Width           = new NLength(0, NGraphicsUnit.Pixel);
            m_Line3.DataLabelStyle.TextStyle.BackplaneStyle.Shape   = BackplaneShape.Ellipse;
            m_Line3.DataLabelStyle.TextStyle.BackplaneStyle.Inflate = new NSizeL(6, 6);
            m_Line3.DataLabelStyle.TextStyle.FontStyle              = new NFontStyle("Arial", 8);
            m_Line3.LineSegmentShape                                = LineSegmentShape.Tape;
            m_Line3.DepthPercent          = 50;
            m_Line3.DataLabelStyle.Format = "<value>";

            // apply layout
            ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]);

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            PositiveValuesButton_Click(null, null);

            StackModeComboBox.Items.Add("Stacked");
            StackModeComboBox.Items.Add("Stacked %");
            StackModeComboBox.SelectedIndex = 0;

            ShowDataLabelsCheckBox.IsChecked = false;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XY Scatter Smooth Line");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective);
            chart.Width  = 70;
            chart.Height = 70;
            chart.Depth  = 15;

            // setup Y axis
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            // setup X axis
            linearScaleConfigurator = new NLinearScaleConfigurator();
            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Back, ChartWallType.Floor };
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator      = linearScaleConfigurator;

            // hide the Z axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the smooth line series
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.Legend.Mode                    = SeriesLegendMode.None;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            line.MarkerStyle.BorderStyle.Color  = Color.Indigo;
            line.MarkerStyle.AutoDepth          = false;
            line.MarkerStyle.Width              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height             = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth              = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line.UseXValues                     = true;
            line.UseZValues                     = false;
            line.Use1DInterpolationForXYScatter = false;

            ChangeData(line);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
示例#5
0
        private void GenerateDateLabels(int nTotalDays)
        {
            // the chart starts with the first monday of june 2003
            DateTime   dt        = new DateTime(2003, 6, 2);
            TimeSpan   daySpan   = new TimeSpan(1, 0, 0, 0);
            NFontStyle labelFont = new NFontStyle("Arial", 9, FontStyle.Bold);
            NAxis      axisX1    = m_Chart.Axis(StandardAxis.PrimaryX);
            NLinearScaleConfigurator linearScale = axisX1.ScaleConfigurator as NLinearScaleConfigurator;
            int nCurCategory = 0;

            m_Chart.ChildPanels.Clear();

            for (int i = 0; i < nTotalDays; i++)
            {
                // add a custom label for the first work day of the month
                if ((dt.Day == 1) ||
                    ((dt.DayOfWeek == DayOfWeek.Monday) && (dt.Day == 2 || dt.Day == 3)))
                {
                    NRectangularCallout callout = new NRectangularCallout();
                    callout.Anchor      = new NAxisValueAnchor(axisX1, AxisValueAnchorMode.Clamp, nCurCategory);
                    callout.Orientation = 270;

                    callout.TextStyle.FontStyle = labelFont;
                    callout.Text = dt.ToString("MMM yyyy");
                    callout.StrokeStyle.Color   = Color.DarkSeaGreen;
                    callout.StrokeStyle.Pattern = LinePattern.Dot;
                    callout.ArrowBasePercent    = 0;
                    callout.UseAutomaticSize    = true;

                    m_Chart.ChildPanels.Add(callout);

                    NAxisConstLine cl = axisX1.ConstLines.Add();
                    cl.Value             = nCurCategory;
                    cl.StrokeStyle.Color = Color.DarkSeaGreen;
                }

                if (dt.DayOfWeek == DayOfWeek.Monday)
                {
                    if ((dt.Day == 1) || (dt.Day == 2) || (dt.Day == 3))
                    {
                        linearScale.Labels.Add("");
                        nCurCategory++;
                    }
                    else
                    {
                        linearScale.Labels.Add(dt.Day.ToString());
                        nCurCategory++;
                    }
                }
                else if (dt.DayOfWeek == DayOfWeek.Saturday)
                {
                }
                else if (dt.DayOfWeek == DayOfWeek.Sunday)
                {
                }
                else
                {
                    nCurCategory++;
                }

                dt += daySpan;
            }
        }
示例#6
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Pareto Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

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

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

            // setup the X axis
            NAxis axisX = m_Chart.Axis(StandardAxis.PrimaryX);
            NOrdinalScaleConfigurator scaleX = (NOrdinalScaleConfigurator)axisX.ScaleConfigurator;

            scaleX.InnerMajorTickStyle.Visible = false;

            // Setup the primary Y axis
            NAxis axisY1 = m_Chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator scaleY1 = (NLinearScaleConfigurator)axisY1.ScaleConfigurator;

            scaleY1.InnerMajorTickStyle.Visible = false;
            scaleY1.Title.Text = "Number of Occurences";

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            scaleY1.StripStyles.Add(stripStyle);

            // Setup the secondary Y axis
            NLinearScaleConfigurator scaleY2 = new NLinearScaleConfigurator();

            scaleY2.LabelValueFormatter         = new NNumericValueFormatter("0%");
            scaleY2.InnerMajorTickStyle.Visible = false;
            scaleY2.Title.Text = "Cumulative Percent";
            NAxis axisY2 = m_Chart.Axis(StandardAxis.SecondaryY);

            axisY2.Visible           = true;
            axisY2.ScaleConfigurator = scaleY2;
            axisY2.View = new NRangeAxisView(new NRange1DD(0, 1), true, true);

            // add the line series
            m_Line      = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line.Name = "Cumulative %";
            m_Line.DataLabelStyle.Visible = false;
            m_Line.MarkerStyle.Visible    = true;
            m_Line.MarkerStyle.PointShape = PointShape.Cylinder;
            m_Line.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            m_Line.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            m_Line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            m_Line.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            m_Line.ShadowStyle.Offset     = new NPointL(2, 2);
            m_Line.ShadowStyle.FadeLength = new NLength(4);
            m_Line.DisplayOnAxis(StandardAxis.PrimaryY, false);
            m_Line.DisplayOnAxis(StandardAxis.SecondaryY, true);

            // add the bar series
            m_Bar      = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar.Name = "Bar Series";
            m_Bar.DataLabelStyle.Visible = false;
            m_Bar.ShadowStyle.Type       = ShadowType.GaussianBlur;
            m_Bar.ShadowStyle.Color      = Color.FromArgb(60, 0, 0, 0);
            m_Bar.ShadowStyle.Offset     = new NPointL(3, 3);
            m_Bar.ShadowStyle.FadeLength = new NLength(4);

            // fill with random data and sort in descending order
            m_Bar.Values.FillRandomRange(Random, 10, 100, 700);
            m_Bar.Values.Sort(DataSeriesSortOrder.Descending);

            // calculate cumulative sum of the bar values
            int    count = m_Bar.Values.Count;
            double cs    = 0;

            double[] arrCumulative = new double[count];

            for (int i = 0; i < count; i++)
            {
                cs += m_Bar.Values.GetDoubleValue(i);
                arrCumulative[i] = cs;
            }

            if (cs > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    arrCumulative[i] /= cs;
                }

                m_Line.Values.AddRange(arrCumulative);
            }

            // apply layout
            ConfigureStandardLayout(m_Chart, title, null);

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            StyleCombo.FillFromEnum(typeof(BarShape));
            StyleCombo.SelectedIndex = 0;
        }
示例#7
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Manhattan Bar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);

            // setup chart
            m_Chart                  = nChartControl1.Charts[0];
            m_Chart.Enable3D         = true;
            m_Chart.Width            = 60;
            m_Chart.Height           = 25;
            m_Chart.Depth            = 45;
            m_Chart.BoundsMode       = BoundsMode.Fit;
            m_Chart.ContentAlignment = ContentAlignment.BottomRight;
            m_Chart.Location         = new NPointL(new NLength(15, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            m_Chart.Size             = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

            // apply predefined projection and lighting
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);

            // add axis labels
            NOrdinalScaleConfigurator ordinalScale = m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Miami");
            ordinalScale.Labels.Add("Chicago");
            ordinalScale.Labels.Add("Los Angeles");
            ordinalScale.Labels.Add("New York");
            ordinalScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            ordinalScale = m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            // add interlace stripe to the Y axis
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            // add the first bar
            m_Bar1 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar1.MultiBarMode           = MultiBarMode.Series;
            m_Bar1.Name                   = "Bar1";
            m_Bar1.DataLabelStyle.Visible = false;
            m_Bar1.BorderStyle.Color      = Color.FromArgb(210, 210, 255);

            // add the second bar
            m_Bar2 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar2.MultiBarMode           = MultiBarMode.Series;
            m_Bar2.Name                   = "Bar2";
            m_Bar2.DataLabelStyle.Visible = false;
            m_Bar2.BorderStyle.Color      = Color.FromArgb(210, 255, 210);

            // add the third bar
            m_Bar3 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar3.MultiBarMode           = MultiBarMode.Series;
            m_Bar3.Name                   = "Bar3";
            m_Bar3.DataLabelStyle.Visible = false;
            m_Bar3.BorderStyle.Color      = Color.FromArgb(255, 255, 210);

            // add the second bar
            m_Bar4 = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar4.MultiBarMode           = MultiBarMode.Series;
            m_Bar4.Name                   = "Bar4";
            m_Bar4.DataLabelStyle.Visible = false;
            m_Bar4.BorderStyle.Color      = Color.FromArgb(255, 210, 210);

            // fill with random data
            m_Bar1.Values.FillRandomRange(Random, m_nBarsCount, 10, 40);
            m_Bar2.Values.FillRandomRange(Random, m_nBarsCount, 30, 60);
            m_Bar3.Values.FillRandomRange(Random, m_nBarsCount, 50, 80);
            m_Bar4.Values.FillRandomRange(Random, m_nBarsCount, 70, 100);

            // apply layout
            ConfigureStandardLayout(m_Chart, title, nChartControl1.Legends[0]);

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

            styleSheet.Apply(nChartControl1.Document);
        }
示例#8
0
文件: Graph.cs 项目: lewis810/HueApp
        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();
        }
示例#9
0
        private void LeftBeginScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e)
        {
            NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0];

            stripe.From = LeftBeginScroll.Value / 10.0;

            nChartControl1.Refresh();
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                WebExamplesUtilities.FillComboWithColorNames(UpColorDropDownList, KnownColor.White);
                WebExamplesUtilities.FillComboWithColorNames(DownColorDropDownList, KnownColor.Black);
                BoxSizeDropDownList.Items.AddRange(new ListItem[]
                {
                    new ListItem("0.5"),
                    new ListItem("1"),
                    new ListItem("2"),
                    new ListItem("2%"),
                    new ListItem("5%"),
                    new ListItem("10%")
                });
                BoxSizeDropDownList.SelectedIndex = 1;
                BoxWidthDropDownList.Items.AddRange(new ListItem[]
                {
                    new ListItem("50%"),
                    new ListItem("75%"),
                    new ListItem("100%")
                });
                BoxWidthDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Renko Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup X axis
            NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator();

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup Y axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            NRenkoSeries renko = (NRenkoSeries)chart.Series.Add(SeriesType.Renko);

            renko.UseXValues    = true;
            renko.UpFillStyle   = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(UpColorDropDownList));
            renko.DownFillStyle = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(DownColorDropDownList));

            switch (BoxSizeDropDownList.SelectedIndex)
            {
            case 0:
                renko.BoxSize           = 0.5;
                renko.BoxSizeInPercents = false;
                break;

            case 1:
                renko.BoxSize           = 1;
                renko.BoxSizeInPercents = false;
                break;

            case 2:
                renko.BoxSize           = 2;
                renko.BoxSizeInPercents = false;
                break;

            case 3:
                renko.BoxSize           = 2;
                renko.BoxSizeInPercents = true;
                break;

            case 4:
                renko.BoxSize           = 5;
                renko.BoxSizeInPercents = true;
                break;

            case 5:
                renko.BoxSize           = 10;
                renko.BoxSizeInPercents = true;
                break;
            }

            switch (BoxWidthDropDownList.SelectedIndex)
            {
            case 0:
                renko.BoxWidthPercent = 50;
                break;

            case 1:
                renko.BoxWidthPercent = 75;
                break;

            case 2:
                renko.BoxWidthPercent = 100;
                break;
            }

            GenerateData(renko);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
示例#11
0
        public override void Initialize()
        {
            base.Initialize();

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

            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.Enable3D = true;

            // apply predefined lighting and projection
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = new NLinearScaleConfigurator();

            // configure the x and y scales
            NLinearScaleConfigurator yScale = new NLinearScaleConfigurator();

            // add interlaced stripe to the Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            yScale.StripStyles.Add(stripStyle);

            // display major grid lines at back and left walls
            yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true);
            yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale;

            NLinearScaleConfigurator xScale = new NLinearScaleConfigurator();

            xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true);
            xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale;

            // Create a point series
            NPointSeries pnt = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins        = true;
            pnt.UseXValues            = true;
            pnt.Name                  = "Series 1";
            pnt.DataLabelStyle.Format = "<value>";

            // Add some data
            pnt.Values.Add(3.1);
            pnt.Values.Add(6.7);
            pnt.Values.Add(1.2);
            pnt.Values.Add(8.4);
            pnt.Values.Add(9.0);
            pnt.XValues.Add(0.5);
            pnt.XValues.Add(1.8);
            pnt.XValues.Add(2.6);
            pnt.XValues.Add(3.1);
            pnt.XValues.Add(4.4);

            // Add stripes for the left and the bottom axes
            NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);

            s1.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));
            NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            s2.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            LeftBeginScroll.Value   = (int)(s1.From * 10);
            LeftEndScroll.Value     = (int)(s1.To * 10);
            BottomBeginScroll.Value = (int)(s2.From * 20);
            BottomEndScroll.Value   = (int)(s2.To * 20);

            LeftShowAtBackCheck.Checked    = true;
            LeftShowAtLeftCheck.Checked    = true;
            BottomShowAtBackCheck.Checked  = true;
            BottomShowAtFloorCheck.Checked = true;

            nChartControl1.Refresh();
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Bubble Palette");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = false;

            NLinearScaleConfigurator linearScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;

            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            // add a bubble series
            NBubbleSeries bubble = (NBubbleSeries)chart.Series.Add(SeriesType.Bubble);

            bubble.DataLabelStyle.VertAlign = VertAlign.Center;
            bubble.DataLabelStyle.Visible   = false;
            bubble.Legend.Mode   = SeriesLegendMode.DataPoints;
            bubble.Legend.Format = "<size>";
            bubble.MinSize       = new NLength(7.0f, NRelativeUnit.ParentPercentage);
            bubble.MaxSize       = new NLength(16.0f, NRelativeUnit.ParentPercentage);

            for (int i = 0; i < 10; i++)
            {
                bubble.Values.Add(i);
                bubble.Sizes.Add(i * 10 + 10);
            }

            bubble.InflateMargins = true;

            NPalette palette = new NPalette();

            palette.SmoothPalette = true;
            palette.Clear();
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            bubble.Palette = palette;

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
        void SetupChartAxes(NChart chart)
        {
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();
            scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;
            scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.InnerMajorTickStyle.Visible = false;
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
            scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;
            scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleX.InnerMajorTickStyle.Visible = false;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EnableInitialPositioningCheckBox.Checked = true;
                RemoveOverlappedLabelsCheckBox.Checked   = false;
                EnableLabelAdjustmentCheckBox.Checked    = true;
                LocationProposalsDropDownList.Items.Clear();
                LocationProposalsDropDownList.Items.Add("Top");
                LocationProposalsDropDownList.Items.Add("Top - Bottom");
                LocationProposalsDropDownList.SelectedIndex = 0;

                HiddenField1.Value = Random.Next().ToString();
            }

            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Bar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            // configure X axis
            NOrdinalScaleConfigurator scaleX = new NOrdinalScaleConfigurator();

            scaleX.DisplayDataPointsBetweenTicks = false;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // configure Y axis
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            scaleY.MajorGridStyle.LineStyle.Pattern             = LinePattern.Dot;
            scaleY.MajorGridStyle.ShowAtWalls                   = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            // add interlaced stripe for Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            // bar series
            NBarSeries series1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            series1.FillStyle = new NColorFillStyle(DarkOrange);
            series1.DataLabelStyle.Visible     = true;
            series1.DataLabelStyle.VertAlign   = VertAlign.Top;
            series1.DataLabelStyle.ArrowLength = new NLength(10);
            series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);

            // enable / disable initial labels positioning
            chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked;

            // enable / disable removal of overlapped labels after initial positioning
            chart.LabelLayout.RemoveOverlappedLabels = RemoveOverlappedLabelsCheckBox.Checked;

            // enable / disable label adjustment
            chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked;

            // use only "top" location for the labels
            series1.LabelLayout.UseLabelLocations = true;

            switch (LocationProposalsDropDownList.SelectedIndex)
            {
            case 0:
                series1.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top };
                break;

            case 1:
                series1.LabelLayout.LabelLocations = new LabelLocation[] { LabelLocation.Top, LabelLocation.Bottom };
                break;
            }

            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = true;

            // protect data points from being overlapped
            series1.LabelLayout.EnableDataPointSafeguard = true;
            series1.LabelLayout.DataPointSafeguardSize   = new NSizeL(
                new NLength(1.3f, NRelativeUnit.ParentPercentage),
                new NLength(1.3f, NRelativeUnit.ParentPercentage));

            // fill with random data
            GenerateData(series1);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Axis Model Crossing <br/> <font size = '9pt'>Demonstrates how to use of the model cross anchor</font>");

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

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

            m_Chart = nChartControl1.Charts[0];

            // configure scales
            NLinearScaleConfigurator yScaleConfigurator = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         yStripStyle        = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);

            yStripStyle.SetShowAtWall(ChartWallType.Back, true);
            yStripStyle.Interlaced = true;
            yScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            yScaleConfigurator.StripStyles.Add(yStripStyle);

            NLinearScaleConfigurator xScaleConfigurator = new NLinearScaleConfigurator();
            NScaleStripStyle         xStripStyle        = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(40, Color.LightGray)), null, true, 0, 0, 1, 1);

            xStripStyle.SetShowAtWall(ChartWallType.Back, true);
            xStripStyle.Interlaced = true;
            xScaleConfigurator.StripStyles.Add(xStripStyle);
            xScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScaleConfigurator;

            // cross X and Y axes
            m_Chart.Axis(StandardAxis.PrimaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryY), 0));
            m_Chart.Axis(StandardAxis.PrimaryX).Anchor.RulerOrientation = RulerOrientation.Right;

            m_Chart.Axis(StandardAxis.PrimaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(m_Chart.Axis(StandardAxis.PrimaryX), 0));

            m_Chart.Axis(StandardAxis.Depth).Visible  = false;
            m_Chart.Wall(ChartWallType.Floor).Visible = false;
            m_Chart.Wall(ChartWallType.Left).Visible  = false;

            // setup bubble series
            NBubbleSeries bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);

            bubble.Name                   = "Bubble Series";
            bubble.InflateMargins         = true;
            bubble.DataLabelStyle.Visible = false;
            bubble.UseXValues             = true;
            bubble.BubbleShape            = PointShape.Sphere;

            // fill with random data
            bubble.Values.FillRandomRange(Random, 10, -20, 20);
            bubble.XValues.FillRandomRange(Random, 10, -20, 20);
            bubble.Sizes.FillRandomRange(Random, 10, 1, 6);

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            LeftAxisAlignmentComboBox.FillFromEnum(typeof(HorzAlign));
            LeftAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center;
            LeftAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage);

            BottomAxisAlignmentComboBox.FillFromEnum(typeof(VertAlign));
            BottomAxisAlignmentComboBox.SelectedIndex = (int)HorzAlign.Center;
            BottomAxisOffsetUC.Length = new NLength(0, NRelativeUnit.ParentPercentage);

            m_Updating = false;

            UpdateCrossings();
        }
        /// <summary>
        /// Configures the axis
        /// </summary>
        /// <param name="chart">Nevron chart</param>
        /// <param name="stats">Chart stats, and configuration details.</param>
        void SetupChartAxes(NChart chart, IAttributeChartStats stats)
        {
            NAxis axisY1 = chart.Axis(StandardAxis.PrimaryY);
            NAxis axisY2 = chart.Axis(StandardAxis.SecondaryY);
            NAxis axisX = chart.Axis(StandardAxis.PrimaryX);

            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
            scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;
            scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleX.InnerMajorTickStyle.Visible = false;
              scaleX.Title.Text = stats.TimeLabel;
            scaleX.Title.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold);
            scaleX.ViewRangeInflateMode = ScaleViewRangeInflateMode.Logical;
            scaleX.LogicalInflate = new NRange1DD(0.5, 0.5);
            axisX.ScaleConfigurator = scaleX;

            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();
            scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dash;
            scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.InnerMajorTickStyle.Visible = false;
              scaleY.Title.Text = stats.DefectLabel;
            scaleY.Title.TextStyle.FontStyle = new NFontStyle("Arial", 9, FontStyle.Bold);
            axisY1.ScaleConfigurator = scaleY;

            NLinearScaleConfigurator scaleY2 = new NLinearScaleConfigurator();
            scaleY2.OuterMajorTickStyle.Visible = false;
            scaleY2.InnerMajorTickStyle.Visible = false;
            scaleY2.RulerStyle.BorderStyle.Width = new NLength(0);
            scaleY2.AutoLabels = false;
            axisY2.ScaleConfigurator = scaleY2;
            axisY2.Visible = true;

            // the scale of the secodary Y axis must be the same as the primary Y axis scale
            axisY1.Slaves.Add(axisY2);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(LABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(LAEndValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BABeginValueDropDownList, 0, 100, 10);
                WebExamplesUtilities.FillComboWithValues(BAEndValueDropDownList, 0, 100, 10);

                WebExamplesUtilities.FillComboWithColorNames(LAColorDropDownList, KnownColor.LightSteelBlue);
                WebExamplesUtilities.FillComboWithColorNames(BAStripeColorDropDownList, KnownColor.LightSteelBlue);

                // init form controls
                LABeginValueDropDownList.SelectedIndex = 2;
                LAEndValueDropDownList.SelectedIndex   = 6;

                BABeginValueDropDownList.SelectedIndex = 2;
                BAEndValueDropDownList.SelectedIndex   = 6;

                LAShowAtBackWallCheckBox.Checked = true;
                LAShowAtLeftWallCheckBox.Checked = true;
                BAShowAtBackWallCheckBox.Checked = true;
                BAShowAtFloorCheckBox.Checked    = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;

            // set projection and lighting
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);

            // configure the chart margins
            chart.BoundsMode = BoundsMode.Fit;
            chart.Location   = new NPointL(
                new NLength(10, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(80, NRelativeUnit.ParentPercentage),
                new NLength(78, NRelativeUnit.ParentPercentage));

            // disable the depth axis
            chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

            // Add stripes for the left and the bottom axes
            NAxisStripe stripeY = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);
            NAxisStripe stripeX = chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            stripeY.From = LABeginValueDropDownList.SelectedIndex * 10;
            stripeY.To   = LAEndValueDropDownList.SelectedIndex * 10;

            stripeY.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(LAColorDropDownList)));
            stripeY.SetShowAtWall(ChartWallType.Back, LAShowAtBackWallCheckBox.Checked);
            stripeY.SetShowAtWall(ChartWallType.Left, LAShowAtLeftWallCheckBox.Checked);

            stripeX.From      = BABeginValueDropDownList.SelectedIndex * 10;
            stripeX.To        = BAEndValueDropDownList.SelectedIndex * 10;
            stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(BAStripeColorDropDownList)));
            stripeX.SetShowAtWall(ChartWallType.Back, BAShowAtBackWallCheckBox.Checked);
            stripeX.SetShowAtWall(ChartWallType.Floor, BAShowAtFloorCheckBox.Checked);

            // Create a point series
            NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins        = true;
            pnt.UseXValues            = true;
            pnt.Name                  = "Series 1";
            pnt.DataLabelStyle.Format = "<value>";

            // Add some data
            pnt.Values.Add(31);
            pnt.Values.Add(67);
            pnt.Values.Add(12);
            pnt.Values.Add(84);
            pnt.Values.Add(90);
            pnt.XValues.Add(10);
            pnt.XValues.Add(36);
            pnt.XValues.Add(52);
            pnt.XValues.Add(62);
            pnt.XValues.Add(88);

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

            styleSheet.Apply(nChartControl1.Document);
        }
示例#18
0
        private void ResetChartButton_Click(object sender, System.EventArgs e)
        {
            nChartControl1.Clear();

            const int nNumberOfWeeks  = 20;
            const int nWorkDaysInWeek = 5;
            const int nDaysInWeek     = 7;
            const int nTotalWorkDays  = nNumberOfWeeks * nWorkDaysInWeek;
            const int nTotalDays      = nNumberOfWeeks * nDaysInWeek;

            NLabel title = nChartControl1.Labels.AddHeader("Financial Chart");

            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));

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

            m_Chart.Location = new NPointL(new NLength(7, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage));
            m_Chart.Size     = new NSizeL(new NLength(86, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));

            m_Chart.Height = 30;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.Wall(ChartWallType.Floor).Visible  = false;
            m_Chart.Wall(ChartWallType.Left).Visible   = false;
            m_Chart.Wall(ChartWallType.Back).Width     = 0;
            m_Chart.Wall(ChartWallType.Back).FillStyle = new NColorFillStyle(Color.FromArgb(239, 245, 239));
            m_Chart.Axis(StandardAxis.Depth).Visible   = false;

            // setup y axis
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.LineStyle.Color   = Color.Gray;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false);

            // setup x axis
            NAxis axisX1 = m_Chart.Axis(StandardAxis.PrimaryX);

            linearScale = new NLinearScaleConfigurator();
            axisX1.ScaleConfigurator = linearScale;

            linearScale.AutoLabels = false;

            linearScale.MinorTickCount                      = 4;
            linearScale.MajorTickMode                       = MajorTickMode.CustomStep;
            linearScale.CustomStep                          = 5;
            linearScale.RoundToTickMax                      = false;
            linearScale.RoundToTickMin                      = false;
            linearScale.OuterMajorTickStyle.Length          = new NLength(4, NGraphicsUnit.Point);
            linearScale.InnerMajorTickStyle.Visible         = false;
            linearScale.InnerMinorTickStyle.Visible         = false;
            linearScale.OuterMinorTickStyle.Length          = new NLength(2, NGraphicsUnit.Point);
            linearScale.OuterMinorTickStyle.LineStyle.Color = Color.Brown;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, false);
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.LabelStyle.ValueScale            = 0.2;

            // create a line series for the simple moving average
            m_LineSMA      = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_LineSMA.Name = "SMA(20)";
            m_LineSMA.DataLabelStyle.Visible = false;
            m_LineSMA.BorderStyle.Color      = Color.DarkOrange;

            // create the stock series
            m_Stock                        = (NStockSeries)m_Chart.Series.Add(SeriesType.Stock);
            m_Stock.Name                   = "Stock Data";
            m_Stock.Legend.Mode            = SeriesLegendMode.None;
            m_Stock.DataLabelStyle.Visible = false;
            m_Stock.CandleStyle            = CandleStyle.Bar;
            m_Stock.CandleWidth            = new NLength(5, NGraphicsUnit.Point);
            m_Stock.InflateMargins         = false;
            m_Stock.DownFillStyle          = new NColorFillStyle(Color.Maroon);
            m_Stock.UpFillStyle            = new NColorFillStyle(Color.CornflowerBlue);
            m_Stock.DisplayOnAxis(StandardAxis.PrimaryX, true);
            m_Stock.UpStrokeStyle.Width   = new NLength(1, NGraphicsUnit.Pixel);
            m_Stock.DownStrokeStyle.Width = new NLength(1, NGraphicsUnit.Pixel);
            m_Stock.UpStrokeStyle.Color   = Color.Navy;
            m_Stock.DownStrokeStyle.Color = Color.Maroon;
            m_Stock.InflateMargins        = true;

            // add the bollinger bands as high low area
            m_HighLow      = (NHighLowSeries)m_Chart.Series.Add(SeriesType.HighLow);
            m_HighLow.Name = "BB(20, 2)";
            m_HighLow.DataLabelStyle.Visible = false;
            m_HighLow.HighFillStyle          = new NColorFillStyle(Color.FromArgb(80, 130, 134, 168));
            m_HighLow.HighBorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
            m_HighLow.DisplayOnAxis(StandardAxis.SecondaryX, true);

            // generate some stock data
            GenerateData(nTotalWorkDays + 20);

            // create a function calculator
            NFunctionCalculator fc = new NFunctionCalculator();

            m_Stock.CloseValues.Name = "close";
            fc.Arguments.Add(m_Stock.CloseValues);

            // calculate the bollinger bands
            fc.Expression        = "BOLLINGER(close; 20; 2)";
            m_HighLow.HighValues = fc.Calculate();

            fc.Expression       = "BOLLINGER(close; 20; -2)";
            m_HighLow.LowValues = fc.Calculate();

            // calculate the simple moving average
            fc.Expression    = "SMA(close; 20)";
            m_LineSMA.Values = fc.Calculate();

            // remove data that won't be charted
            m_Stock.HighValues.RemoveRange(0, 20);
            m_Stock.LowValues.RemoveRange(0, 20);
            m_Stock.OpenValues.RemoveRange(0, 20);
            m_Stock.CloseValues.RemoveRange(0, 20);
            m_HighLow.HighValues.RemoveRange(0, 20);
            m_HighLow.LowValues.RemoveRange(0, 20);
            m_LineSMA.Values.RemoveRange(0, 20);

            GenerateDateLabels(nTotalDays);

            nChartControl1.Refresh();
        }
示例#19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nFunction = new NFunctionCalculator();

            if (!IsPostBack)
            {
                FunctionDropDownList.Items.Add("Simple Moving Average");
                FunctionDropDownList.Items.Add("Weighted Moving Average");
                FunctionDropDownList.Items.Add("Exponential Moving Average");
                FunctionDropDownList.Items.Add("Modified Moving Average");
                FunctionDropDownList.SelectedIndex = 0;

                // form controls
                ApplyFunctionToDropDownList.Items.Add("Open");
                ApplyFunctionToDropDownList.Items.Add("High");
                ApplyFunctionToDropDownList.Items.Add("Low");
                ApplyFunctionToDropDownList.Items.Add("Close");
                ApplyFunctionToDropDownList.SelectedIndex = 3;

                WebExamplesUtilities.FillComboWithFloatValues(PeriodDropDownList, 0, 50, 1);
                PeriodDropDownList.SelectedIndex = 10;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Moving Averages");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            NLegend legend = nChartControl1.Legends[0];

            legend.Location = new NPointL(
                new NLength(98, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));

            NChart chart = nChartControl1.Charts[0];

            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.LightModel.EnableLighting         = false;
            chart.Axis(StandardAxis.Depth).Visible  = false;
            chart.Wall(ChartWallType.Floor).Visible = false;
            chart.Wall(ChartWallType.Left).Visible  = false;
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(5, NRelativeUnit.ParentPercentage),
                new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(90, NRelativeUnit.ParentPercentage),
                new NLength(75, NRelativeUnit.ParentPercentage));

            // align the chart and the legend
            NSideGuideline guideline = new NSideGuideline(PanelSide.Right);

            guideline.Targets.Add(legend);
            guideline.Targets.Add(chart);
            nChartControl1.Document.RootPanel.Guidelines.Add(guideline);

            // setup X axis
            NRangeTimelineScaleConfigurator scaleX = new NRangeTimelineScaleConfigurator();

            scaleX.FirstRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.FirstRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
            scaleX.FirstRow.UseGridStyle           = true;
            scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleX.SecondRow.GridStyle.LineStyle   = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
            scaleX.SecondRow.UseGridStyle          = true;
            scaleX.ThirdRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.ThirdRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
            scaleX.ThirdRow.UseGridStyle           = true;
            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;
            // set configurator
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup primary Y axis
            NAxis axis = chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)axis.ScaleConfigurator;

            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Left, false);
            linearScaleConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0, NGraphicsUnit.Pixel);

            // line series for the function
            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.DataLabelStyle.Visible = false;
            line.BorderStyle.Color      = Color.Red;
            line.BorderStyle.Width      = new NLength(2, NGraphicsUnit.Pixel);
            line.UseXValues             = true;

            Color customColor = Color.FromArgb(100, 100, 150);

            // setup the stock series
            NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock);

            stock.DataLabelStyle.Visible   = false;
            stock.CandleStyle              = CandleStyle.Bar;
            stock.CandleWidth              = new NLength(1, NRelativeUnit.ParentPercentage);
            stock.HighLowStrokeStyle.Color = customColor;
            stock.UpStrokeStyle.Color      = customColor;
            stock.DownStrokeStyle.Color    = customColor;
            stock.UpFillStyle              = new NColorFillStyle(Color.White);
            stock.DownFillStyle            = new NColorFillStyle(customColor);
            stock.Legend.Mode              = SeriesLegendMode.None;
            stock.OpenValues.Name          = "open";
            stock.HighValues.Name          = "high";
            stock.LowValues.Name           = "low";
            stock.CloseValues.Name         = "close";
            stock.UseXValues     = true;
            stock.InflateMargins = true;

            GenerateData(stock);
            BuildExpression(stock, line);

            line.XValues = (NDataSeriesDouble)stock.XValues.Clone();
            line.Values  = nFunction.Calculate();
        }
示例#20
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Lighting Filter");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);
            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.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;

            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;
            linearScale.MajorGridStyle.LineStyle.Pattern          = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);

            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.Visible = false;
            m_Bubble.Legend.Format          = "<label> X:<xvalue> Y:<value> Size:<size>";
            m_Bubble.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bubble.MinSize    = new NLength(10.0f, NRelativeUnit.ParentPercentage);
            m_Bubble.MaxSize    = new NLength(20.0f, NRelativeUnit.ParentPercentage);
            m_Bubble.UseXValues = true;

            m_Bubble.ShadowStyle.Type   = ShadowType.Solid;
            m_Bubble.ShadowStyle.Offset = new NPointL(3, 3);
            m_Bubble.ShadowStyle.Color  = Color.FromArgb(60, 0, 0, 0);
            m_Bubble.BorderStyle.Width  = new NLength(0, NGraphicsUnit.Pixel);
            m_Bubble.InflateMargins     = true;

            m_LightingFilter = new NLightingImageFilter();

            NFillStyle fillStyle = new NColorFillStyle(Color.Gold);

            fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter);
            m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 34, 10, "Company1", fillStyle));

            fillStyle = new NColorFillStyle(Color.DarkOrange);
            fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter);
            m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 12, 20, "Company2", fillStyle));

            fillStyle = new NColorFillStyle(Color.Crimson);
            fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter);
            m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 24, 25, "Company3", fillStyle));

            fillStyle = new NColorFillStyle(Color.DarkOrchid);
            fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter);
            m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 56, 15, "Company4", fillStyle));

            BubbleShapeCombo.FillFromEnum(typeof(PointShape));
            BubbleShapeCombo.SelectedIndex = 7;

            InflateMargins.Checked = true;

            LightSourceTypeComboBox.FillFromEnum(typeof(LightSourceType));
            BlurTypeComboBox.FillFromEnum(typeof(BlurType));

            BevelDepthNumericUpDown.Value         = (decimal)m_LightingFilter.BevelDepth.Value;
            BlurTypeComboBox.SelectedIndex        = (int)m_LightingFilter.BlurType;
            SurfaceScaleNumericUpDown.Value       = (decimal)m_LightingFilter.SurfaceScale;
            ShininessNumericUpDown.Value          = (decimal)m_LightingFilter.Shininess;
            LightSourceTypeComboBox.SelectedIndex = (int)m_LightingFilter.LightSourceType;

            NVector3DF vector = m_LightingFilter.Position;

            PositionXnumericUpDown.Value = (decimal)vector.X;
            PositionYnumericUpDown.Value = (decimal)vector.Y;
            PositionZnumericUpDown.Value = (decimal)vector.Z;

            m_Updating = false;
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Tooltips and Cursor");

            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));

            // init the values for the tooltip properties
            NTooltipTool tooltip = new NTooltipTool();

            AutoPopDelayUpDown.Value = tooltip.AutoPopDelay;
            InitialDelayUpDown.Value = tooltip.InitialDelay;
            ReshowDelayUpDown.Value  = tooltip.ReshowDelay;

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

            // Add stripes for the left and the bottom axes
            NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(50, 60);
            NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3);

            s1.FillStyle = new NColorFillStyle(Color.CornflowerBlue);
            s1.SetShowAtWall(ChartWallType.Left, true);
            s2.FillStyle = new NColorFillStyle(Color.DarkOrange);

            // Create a bar series
            m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);

            m_Bar.BarShape    = BarShape.Bar;
            m_Bar.Legend.Mode = SeriesLegendMode.DataPoints;
            m_Bar.Values.Add(20.0);
            m_Bar.Values.Add(60.0);
            m_Bar.Values.Add(50.0);
            m_Bar.Values.Add(80.0);
            m_Bar.Values.Add(60.0);

            m_Bar.InteractivityStyles.Add(0, new NInteractivityStyle("Data item 0", CursorType.Default));
            m_Bar.InteractivityStyles.Add(1, new NInteractivityStyle("Data item 1", CursorType.Default));
            m_Bar.InteractivityStyles.Add(2, new NInteractivityStyle("Data item 2", CursorType.Default));
            m_Bar.InteractivityStyles.Add(3, new NInteractivityStyle("Data item 3", CursorType.Default));
            m_Bar.InteractivityStyles.Add(4, new NInteractivityStyle("Data item 4", CursorType.Default));

            // set some fill styles in the collection.
            NFillStyle fillStyle;

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Chocolate, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(0, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Goldenrod, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(1, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.OliveDrab, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(2, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.SteelBlue, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(3, fillStyle);

            fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.BlueViolet, Color.WhiteSmoke);
            m_Bar.FillStyles.Add(4, fillStyle);

            // init form controls
            EnableTooltipChangeCheckBox.Checked = true;
            CursorChangeCheckBox.Checked        = true;

            ChartObjectComboBox.Items.Add("Background");
            ChartObjectComboBox.Items.Add("Back chart wall");
            ChartObjectComboBox.Items.Add("Left chart wall");
            ChartObjectComboBox.Items.Add("Floor chart wall");
            ChartObjectComboBox.Items.Add("Primary Y axis");
            ChartObjectComboBox.Items.Add("Primary X axis");
            ChartObjectComboBox.Items.Add("Horizontal stripe");
            ChartObjectComboBox.Items.Add("Vertical stripe");
            ChartObjectComboBox.Items.Add("Legend");
            ChartObjectComboBox.Items.Add("Data item 0");
            ChartObjectComboBox.Items.Add("Data item 1");
            ChartObjectComboBox.Items.Add("Data item 2");
            ChartObjectComboBox.Items.Add("Data item 3");
            ChartObjectComboBox.Items.Add("Data item 4");
            ChartObjectComboBox.SelectedIndex = 0;

            CursorComboBox.FillFromEnum(typeof(CursorType));
            CursorComboBox.SelectedIndex = 0;
        }
示例#22
0
        protected void UpdateScaleBreaks()
        {
            // read the form control values
            float threshold;

            if (!float.TryParse(thresholdTextBox.Text, out threshold) || threshold < 0 || threshold > 1)
            {
                threshold             = 0.25f;
                thresholdTextBox.Text = threshold.ToString();
            }

            int maxBreaks;

            if (!int.TryParse(maxBreaksTextBox.Text, out maxBreaks) || maxBreaks < 0 || maxBreaks > 3)
            {
                maxBreaks             = 1;
                maxBreaksTextBox.Text = maxBreaks.ToString();
            }

            float length;

            if (!float.TryParse(lengthTextBox.Text, out length) || length < 0 || length > 1000)
            {
                length             = 5;
                lengthTextBox.Text = length.ToString();
            }

            int positionPercent;

            if (!int.TryParse(positionPercentTextBox.Text, out positionPercent) || positionPercent < 0 || positionPercent > 1000)
            {
                positionPercent             = 50;
                positionPercentTextBox.Text = positionPercent.ToString();
            }

            // recreate scale breaks
            NChart chart = nChartControl1.Charts[0];
            NStandardScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NStandardScaleConfigurator;

            scale.ScaleBreaks.Clear();

            if (enableBreaksCheckBox.Checked)
            {
                NAutoScaleBreak scaleBreak = new NAutoScaleBreak(threshold);
                scaleBreak.Style              = new NWaveScaleBreakStyle();
                scaleBreak.Style.Length       = new NLength(length, NGraphicsUnit.Point);
                scaleBreak.MaxScaleBreakCount = maxBreaks;

                NScaleBreakPosition scaleBreakPosition = new NRangeScaleBreakPosition();
                switch (positionModeDropDownList.SelectedIndex)
                {
                case 0:                         // Range
                    scaleBreakPosition = new NRangeScaleBreakPosition();
                    break;

                case 1:                         // percent
                    scaleBreakPosition = new NPercentScaleBreakPosition((float)positionPercent);
                    break;

                case 2:                         // content
                    scaleBreakPosition = new NContentScaleBreakPosition();
                    break;
                }

                scaleBreak.Position = scaleBreakPosition;

                scale.ScaleBreaks.Add(scaleBreak);
            }
        }
        private NInteractivityStyle GetCurrentInteractivityStyle()
        {
            NInteractivityStyle interactivityStyle = null;

            switch (ChartObjectComboBox.SelectedIndex)
            {
            // Background
            case 0:
                interactivityStyle = nChartControl1.InteractivityStyle;
                break;

            // Back chart wall
            case 1:
                interactivityStyle = m_Chart.Wall(ChartWallType.Back).InteractivityStyle;
                break;

            // Left chart wall
            case 2:
                interactivityStyle = m_Chart.Wall(ChartWallType.Left).InteractivityStyle;
                break;

            /// Floor chart wall
            case 3:
                interactivityStyle = m_Chart.Wall(ChartWallType.Floor).InteractivityStyle;
                break;

            // Primary Y axis
            case 4:
                interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryY).InteractivityStyle;
                break;

            // Primary X axis
            case 5:
                interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryX).InteractivityStyle;
                break;

            // Horizontal stripe
            case 6:
                interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0])).InteractivityStyle;
                break;

            // Vertical stripe
            case 7:
                interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0])).InteractivityStyle;
                break;

            // Legend
            case 8:
                interactivityStyle = ((NLegend)(nChartControl1.Legends[0])).InteractivityStyle;
                break;

            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
                NSeries series = (NSeries)m_Chart.Series[0];
                interactivityStyle = (NInteractivityStyle)(series.InteractivityStyles[ChartObjectComboBox.SelectedIndex - 9]);

                break;
            }

            return(interactivityStyle);
        }
示例#24
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XY Point Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

            // configure the chart
            NChart chart = nChartControl1.Charts[0];

            // configure X axis
            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            scaleX.MajorGridStyle.LineStyle.Pattern             = LinePattern.Dot;
            scaleX.MajorGridStyle.ShowAtWalls                   = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // configure Y axis
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            scaleY.MajorGridStyle.LineStyle.Pattern             = LinePattern.Dot;
            scaleY.MajorGridStyle.ShowAtWalls                   = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            // add interlaced stripe for Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            // point series 1
            NPointSeries series1 = (NPointSeries)chart.Series.Add(SeriesType.Point);

            series1.Name                                  = "Point 1";
            series1.PointShape                            = PointShape.Ellipse;
            series1.Size                                  = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series1.UseXValues                            = true;
            series1.InflateMargins                        = true;
            series1.FillStyle                             = new NColorFillStyle(DarkOrange);
            series1.DataLabelStyle.Visible                = true;
            series1.DataLabelStyle.VertAlign              = VertAlign.Center;
            series1.DataLabelStyle.ArrowLength            = new NLength(12);
            series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange;
            series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange;

            // point series 2
            NPointSeries series2 = (NPointSeries)chart.Series.Add(SeriesType.Point);

            series2.Name                                  = "Point 2";
            series2.PointShape                            = PointShape.Ellipse;
            series2.Size                                  = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            series2.UseXValues                            = true;
            series2.InflateMargins                        = true;
            series2.FillStyle                             = new NColorFillStyle(LightOrange);
            series2.DataLabelStyle.Visible                = true;
            series2.DataLabelStyle.VertAlign              = VertAlign.Center;
            series2.DataLabelStyle.ArrowLength            = new NLength(12);
            series2.DataLabelStyle.ArrowStrokeStyle.Color = LightOrange;
            series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = LightOrange;

            // label layout settings
            chart.LabelLayout.EnableInitialPositioning   = true;
            chart.LabelLayout.EnableLabelAdjustment      = true;
            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = true;
            series2.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series2.LabelLayout.InvertLocationsIfIgnored = true;

            // fill with random data
            GenerateData(chart);

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // init form controls
            EnableLabelAdjustmentCheck.Checked    = true;
            RemoveOverlappedLabelsCheck.Checked   = false;
            EnableInitialPositioningCheck.Checked = true;
            EnableDataPointSafeguardCheck.Checked = true;
            SafeguardSizeNumericUpDown.Value      = 12;
        }
示例#25
0
        private void BuildNewNChart(byte[] m_map_content)
        {
            try
            {
                DataTable dt = (DataTable)gridControl1.DataSource;

                nChartControl1 = new NChartControl();
                nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed;
                nChartControl1.Controller.Tools.Add(new NSelectorTool());
                nChartControl1.Controller.Tools.Add(new NTrackballTool());
                nChartControl1.MouseWheel += new MouseEventHandler(nChartControl1_MouseWheel);
                nChartControl1.MouseDown  += new MouseEventHandler(nChartControl1_MouseDown);
                nChartControl1.MouseUp    += new MouseEventHandler(nChartControl1_MouseUp);

                nChartControl1.Dock = DockStyle.Fill;
                xtraTabPage2.Controls.Add(nChartControl1);
                //nChartControl1.Charts.Clear();

                NChart chart = nChartControl1.Charts[0];
                nChartControl1.Legends.Clear();
                chart.Enable3D = true;
                chart.Width    = 60.0f;
                chart.Depth    = 60.0f;
                chart.Height   = 35.0f;
                chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
                chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft);

                NStandardScaleConfigurator scaleConfiguratorX = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;
                scaleConfiguratorX.MaxTickCount  = dt.Rows.Count;
                scaleConfiguratorX.MajorTickMode = MajorTickMode.AutoMaxCount;
                //scaleConfiguratorX.AutoLabels = true;
                NScaleTitleStyle titleStyleX = (NScaleTitleStyle)scaleConfiguratorX.Title;
                titleStyleX.Text = Y_axis_name;
                //<GS-08032010> as waarden nog omzetten indien noodzakelijk (MAP etc)
                scaleConfiguratorX.AutoLabels = false;
                scaleConfiguratorX.Labels.Clear();

                for (int t = y_axisvalues.Length - 1; t >= 0; t--)
                {
                    string yvalue = y_axisvalues.GetValue(t).ToString();
                    //if (Y_axis_name == "MAP" || Y_axis_name == "Pressure error (bar)")
                    {
                        try
                        {
                            float v = (float)Convert.ToDouble(yvalue);
                            yvalue = v.ToString("F2");
                        }
                        catch (Exception cE)
                        {
                            logger.Debug(cE.Message);
                        }
                    }
                    scaleConfiguratorX.Labels.Add(yvalue);
                }
                NStandardScaleConfigurator scaleConfiguratorY = (NStandardScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator;
                scaleConfiguratorY.MajorTickMode = MajorTickMode.AutoMaxCount;
                scaleConfiguratorY.MaxTickCount  = dt.Columns.Count;
                //scaleConfiguratorY.AutoLabels = true;
                NScaleTitleStyle titleStyleY = (NScaleTitleStyle)scaleConfiguratorY.Title;
                titleStyleY.Text = X_axis_name;
                scaleConfiguratorY.AutoLabels = false;
                scaleConfiguratorY.Labels.Clear();
                for (int t = 0; t < x_axisvalues.Length; t++)
                {
                    string xvalue = x_axisvalues.GetValue(t).ToString();
                    //if (X_axis_name == "MAP" || X_axis_name == "Pressure error (bar)")
                    {
                        try
                        {
                            float v = (float)Convert.ToDouble(xvalue);
                            xvalue = v.ToString("F2");
                        }
                        catch (Exception cE)
                        {
                            logger.Debug(cE.Message);
                        }
                    }
                    scaleConfiguratorY.Labels.Add(xvalue);
                }

                NStandardScaleConfigurator scaleConfiguratorZ = (NStandardScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
                scaleConfiguratorZ.MajorTickMode = MajorTickMode.AutoMaxCount;
                NScaleTitleStyle titleStyleZ = (NScaleTitleStyle)scaleConfiguratorZ.Title;
                titleStyleZ.Text = Z_axis_name;
                scaleConfiguratorZ.AutoLabels           = true;
                chart.Wall(ChartWallType.Back).Visible  = false;
                chart.Wall(ChartWallType.Left).Visible  = false;
                chart.Wall(ChartWallType.Right).Visible = false;
                chart.Wall(ChartWallType.Floor).Visible = false;
                NMeshSurfaceSeries surface = null;
                chart.Series.Clear();
                if (chart.Series.Count == 0)
                {
                    surface = (NMeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface);
                }
                else
                {
                    surface = (NMeshSurfaceSeries)chart.Series[0];
                }
                surface.Name          = "Surface";
                surface.PositionValue = 10.0;

                surface.Palette.Clear();
                surface.Data.SetGridSize(dt.Columns.Count, dt.Rows.Count);
                surface.ValueFormatter.FormatSpecifier = "0.00";
                surface.FillMode       = SurfaceFillMode.Zone; // <GS-08032010>
                surface.SmoothPalette  = true;
                surface.FrameColorMode = SurfaceFrameColorMode.Uniform;
                surface.FillStyle.SetTransparencyPercent(25);
                surface.FrameMode = SurfaceFrameMode.MeshContour;

                double diff = m_realMaxValue - m_realMinValue;

                surface.Palette.Add(m_realMinValue, Color.Green);
                surface.Palette.Add(m_realMinValue + 0.25 * diff, Color.Yellow);
                surface.Palette.Add(m_realMinValue + 0.50 * diff, Color.Orange);
                surface.Palette.Add(m_realMinValue + 0.75 * diff, Color.OrangeRed);
                surface.Palette.Add(m_realMinValue + diff, Color.Red);

                surface.PaletteSteps     = 4;
                surface.AutomaticPalette = false;

                FillData(surface, dt);
                // hier
                nChartControl1.Refresh();
            }
            catch (Exception E)
            {
                logger.Debug("Failed to refresh mesh chart: " + E.Message);
            }
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                WebExamplesUtilities.FillComboWithEnumValues(ClusterModeDropDownList, typeof(ClusterMode));
                ClusterModeDropDownList.SelectedIndex = (int)ClusterMode.Enabled;

                for (int i = 0; i < 9; i++)
                {
                    ClusterDistanceFactorDropDownList.Items.Add("0.0" + (i + 1).ToString());
                }

                WebExamplesUtilities.FillComboWithValues(NumberOfPointGroupsDropDownList, 1, 10, 1);
                NumberOfPointGroupsDropDownList.SelectedIndex = 2;

                WebExamplesUtilities.FillComboWithValues(NumberOfPointsInGroupDropDownList, 10000, 30000, 10000);
                NumberOfPointsInGroupDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("XY Scatter Point Cluster Chart");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            scaleY.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // add interlace stripe
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            scaleY.StripStyles.Add(stripStyle);

            // setup X axis
            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            scaleX.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };
            scaleX.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup point series
            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.Name                   = "Point1";
            point.UseXValues             = true;
            point.DataLabelStyle.Visible = false;
            point.MarkerStyle.Visible    = false;
            point.ClusterMode            = (ClusterMode)ClusterModeDropDownList.SelectedIndex;
            point.ClusterDistanceFactor  = (ClusterDistanceFactorDropDownList.SelectedIndex + 1) * 0.01;
            point.FillStyle              = new NColorFillStyle(Color.FromArgb(160, DarkOrange));
            point.BorderStyle.Width      = new NLength(0);
            point.Size                   = new NLength(1.5f);
            point.PointShape             = PointShape.Ellipse;

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

            styleSheet.Apply(nChartControl1.Document);

            // generate some random X values
            GenerateXYData(point);

            NumberOfDataPointsLabel.Text = "Number of Data Points:" + (point.Values.Count / 1000).ToString() + "K";

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
示例#27
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed;

            // set a chart title
            NLabel title = new NLabel("Contour Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Width    = 70.0f;
            chart.Depth    = 70.0f;
            chart.Height   = 0.1f;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop);
            chart.LightModel.EnableLighting = false;

            // hide chart walls
            chart.Wall(ChartWallType.Back).Visible  = false;
            chart.Wall(ChartWallType.Left).Visible  = false;
            chart.Wall(ChartWallType.Floor).Visible = false;

            // setup Y axis
            chart.Axis(StandardAxis.PrimaryY).Visible = false;

            // setup X axis
            NAxis axisX = chart.Axis(StandardAxis.PrimaryX);

            axisX.Anchor = new NDockAxisAnchor(AxisDockZone.FrontTop);
            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

            scaleX.InnerMajorTickStyle.Visible = false;
            scaleX.RoundToTickMin   = false;
            scaleX.RoundToTickMax   = false;
            axisX.ScaleConfigurator = scaleX;

            // setup Z axis
            NAxis axisZ = chart.Axis(StandardAxis.Depth);

            axisZ.Anchor = new NDockAxisAnchor(AxisDockZone.TopRight);
            NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();

            scaleZ.InnerMajorTickStyle.Visible = false;
            scaleZ.MajorGridStyle.ShowAtWalls  = new ChartWallType[0];
            scaleZ.RoundToTickMin   = false;
            scaleZ.RoundToTickMax   = false;
            axisZ.ScaleConfigurator = scaleZ;

            // add a surface series
            NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface);

            surface.Name           = "Contour";
            surface.Legend.Mode    = SeriesLegendMode.SeriesLogic;
            surface.ValueFormatter = new NNumericValueFormatter("0.0");
            surface.FillMode       = SurfaceFillMode.Zone;
            surface.FrameMode      = SurfaceFrameMode.Contour;
            surface.ShadingMode    = ShadingMode.Flat;
            surface.DrawFlat       = true;
            surface.Data.SetGridSize(31, 31);

            // setup a custom palette
            surface.AutomaticPalette = false;
            surface.Palette.Clear();

            surface.Palette.Add(0.0, Color.Purple);
            surface.Palette.Add(1.5, Color.MediumSlateBlue);
            surface.Palette.Add(3.0, Color.CornflowerBlue);
            surface.Palette.Add(4.5, Color.LimeGreen);
            surface.Palette.Add(6.0, Color.LightGreen);
            surface.Palette.Add(7.5, Color.Yellow);
            surface.Palette.Add(9.0, Color.Orange);
            surface.Palette.Add(10.5, Color.Red);
            surface.Palette.Add(100, Color.Red);

            // fill the surface with data
            FillData(surface);

            // apply layout
            ConfigureStandardLayout(chart, title, nChartControl1.Legends[0]);

            // setup form controls
            ShowFillingCheckBox.IsChecked       = true;
            ShowFrameCheckBox.IsChecked         = true;
            PaletteFrameCheckBox.IsChecked      = true;
            SmoothPaletteCheckBox.IsChecked     = true;
            DrawContourBorderCheckBox.IsChecked = true;

            UpdateChart();
        }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(PredefinedStyleSheetDropDownList, typeof(PredefinedStyleSheet));
                PredefinedStyleSheetDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Predefined Style Sheets");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;

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

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Enable3D = true;
            chart.Width    = 60;
            chart.Height   = 25;
            chart.Depth    = 45;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // setup X axis
            NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            scaleX.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Floor, ChartWallType.Back };

            // add the first bar
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.MultiBarMode           = MultiBarMode.Series;
            bar1.Name                   = "Bar1";
            bar1.DataLabelStyle.Visible = true;
            bar1.DataLabelStyle.Format  = "<value>";
            bar1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);

            // add the second bar
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.MultiBarMode           = MultiBarMode.Series;
            bar2.Name                   = "Bar2";
            bar2.DataLabelStyle.Visible = true;
            bar2.DataLabelStyle.Format  = "<value>";
            bar2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);

            // add the third bar
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar3.MultiBarMode           = MultiBarMode.Series;
            bar3.Name                   = "Bar3";
            bar3.DataLabelStyle.Visible = true;
            bar3.DataLabelStyle.Format  = "<value>";
            bar3.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8, NGraphicsUnit.Point);

            // fill with random data
            int barCount = 6;

            bar1.Values.FillRandomRange(Random, barCount, 10, 40);
            bar2.Values.FillRandomRange(Random, barCount, 30, 60);
            bar3.Values.FillRandomRange(Random, barCount, 50, 80);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                FormatDropDownList.Items.Add("[value] [label]");
                FormatDropDownList.Items.Add("[index] [cumulative]");
                FormatDropDownList.Items.Add("[percent] [total]");
                FormatDropDownList.SelectedIndex = 0;

                ModeDropDownList.Items.Add("Disabled");
                ModeDropDownList.Items.Add("Series");
                ModeDropDownList.Items.Add("DataPoints");
                ModeDropDownList.Items.Add("SeriesCustom");
                ModeDropDownList.SelectedIndex = 2;

                WebExamplesUtilities.FillComboWithEnumValues(PointShapeDropDownList, typeof(PointShape));
                PointShapeDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithColorNames(ColorDropDownList, KnownColor.DarkOrange);

                DifferentColorsCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = new NLabel("Series Legend");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            nChartControl1.Panels.Add(title);

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;

            // add interlaced stripe
            NLinearScaleConfigurator linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
            NScaleStripStyle         stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            linearScaleConfigurator.StripStyles.Add(stripStyle);

            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.DataLabelStyle.Visible = false;
            point.InflateMargins         = true;
            point.PointShape             = (PointShape)PointShapeDropDownList.SelectedIndex;
            point.Legend.Mode            = (SeriesLegendMode)ModeDropDownList.SelectedIndex;

            point.AddDataPoint(new NDataPoint(16, "Agriculture"));
            point.AddDataPoint(new NDataPoint(42, "Construction"));
            point.AddDataPoint(new NDataPoint(56, "Manufacturing"));
            point.AddDataPoint(new NDataPoint(23, "Services"));
            point.AddDataPoint(new NDataPoint(47, "Healthcare"));
            point.AddDataPoint(new NDataPoint(38, "Finance"));

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);

            if (DifferentColorsCheckBox.Checked)
            {
                NChartPalette palette = new NChartPalette();
                palette.SetPredefinedPalette(ChartPredefinedPalette.Nevron);

                for (int i = 0; i < point.Values.Count; i++)
                {
                    point.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]);
                }
                ColorDropDownList.Enabled = false;
            }
            else
            {
                point.FillStyle           = new NColorFillStyle(WebExamplesUtilities.ColorFromDropDownList(ColorDropDownList));
                ColorDropDownList.Enabled = true;
            }

            if (ModeDropDownList.SelectedIndex == 2)
            {
                FormatDropDownList.Enabled = true;
                point.Legend.Format        = WebExamplesUtilities.GetXmlFormatString(FormatDropDownList.SelectedItem.Text);
            }
            else
            {
                FormatDropDownList.Enabled = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init form controls
                ZOrderModeCombo.Items.Add("123");
                ZOrderModeCombo.Items.Add("321");
                ZOrderModeCombo.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = new NLabel("Series Z Order");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            nChartControl1.Panels.Add(title);

            // setup chart
            NChart chart = nChartControl1.Charts[0];

            chart.Axis(StandardAxis.Depth).Visible = false;

            // add the first bar
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.WidthPercent = 80;
            bar1.Name         = "Bar1";

            // add the second bar
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.WidthPercent = 60;
            bar2.Name         = "Bar2";

            // add the third bar
            NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar3.WidthPercent = 40;
            bar3.Name         = "Bar3";

            // position data labels in the center of the bars
            bar1.DataLabelStyle.Visible = false;
            bar2.DataLabelStyle.Visible = false;
            bar3.DataLabelStyle.Visible = false;

            // fill some random data
            bar1.Values.FillRandomRange(Random, 6, 20, 100);
            bar2.Values.FillRandomRange(Random, 6, 20, 100);
            bar3.Values.FillRandomRange(Random, 6, 20, 100);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);

            switch (ZOrderModeCombo.SelectedIndex)
            {
            case 0:
                bar1.ZOrder = 1;
                bar2.ZOrder = 2;
                bar3.ZOrder = 3;
                break;

            case 1:
                bar1.ZOrder = 3;
                bar2.ZOrder = 2;
                bar3.ZOrder = 1;
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
示例#31
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Annotation Drag Tool");

            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
            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // configure the x scale
            NLinearScaleConfigurator xScale = new NLinearScaleConfigurator();

            xScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = xScale;

            // configure the y scale
            NLinearScaleConfigurator yScale = new NLinearScaleConfigurator();

            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.SetShowAtWall(ChartWallType.Back, true);
            stripStyle.SetShowAtWall(ChartWallType.Left, true);
            stripStyle.Interlaced = true;
            yScale.StripStyles.Add(stripStyle);

            yScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = yScale;

            // Create a point series
            NPointSeries point = (NPointSeries)chart.Series.Add(SeriesType.Point);

            point.InflateMargins         = true;
            point.UseXValues             = true;
            point.Name                   = "Series 1";
            point.DataLabelStyle.Visible = false;

            // Add some data
            point.Values.Add(31);
            point.Values.Add(67);
            point.Values.Add(12);
            point.Values.Add(84);
            point.Values.Add(90);

            point.XValues.Add(5);
            point.XValues.Add(36);
            point.XValues.Add(51);
            point.XValues.Add(76);
            point.XValues.Add(93);

            m_Callout1 = new NRectangularCallout();
            m_Callout1.UseAutomaticSize = true;
            m_Callout1.Text             = "Annotation 1";
            m_Callout1.Orientation      = 125;
            m_Callout1.ArrowLength      = new NLength(40, NGraphicsUnit.Point);
            m_Callout1.Anchor           = new NScalePointAnchor(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY, (int)StandardAxis.Depth, AxisValueAnchorMode.Clip, new Nevron.GraphicsCore.NVector3DD(36, 67, 0));
            chart.ChildPanels.Add(m_Callout1);

            m_Callout2 = new NRectangularCallout();
            m_Callout2.UseAutomaticSize = true;
            m_Callout2.Text             = "Annotation 2";
            m_Callout1.Orientation      = 45;
            m_Callout2.ArrowLength      = new NLength(40, NGraphicsUnit.Point);
            m_Callout2.Anchor           = new NScalePointAnchor(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY, (int)StandardAxis.Depth, AxisValueAnchorMode.Clip, new Nevron.GraphicsCore.NVector3DD(76, 84, 0));
            chart.ChildPanels.Add(m_Callout2);

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Controller.Tools.Add(new NSelectorTool());
            nChartControl1.Controller.Tools.Add(new NCalloutDragTool());

            AllowDragAnnotation1CheckBox.Checked = true;
            AllowDragAnnotation2CheckBox.Checked = true;
        }
示例#32
0
        public override void Initialize()
        {
            base.Initialize();

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

            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.Enable3D = true;

            // configure the axes
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator    = new NLinearScaleConfigurator();

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

            // add interlaced stripe to the Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;

            // apply predefined lighting and projection
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // apply 1:1:1 aspect
            m_Chart.Depth      = 70;
            m_Chart.Width      = 70;
            m_Chart.Height     = 70;
            m_Chart.BoundsMode = BoundsMode.Fit;

            // Create a point series
            NPointSeries pnt = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);

            pnt.InflateMargins         = true;
            pnt.UseXValues             = true;
            pnt.UseZValues             = true;
            pnt.Name                   = "Series 1";
            pnt.DataLabelStyle.Visible = false;

            // Add some data
            pnt.Values.Add(31);
            pnt.Values.Add(67);
            pnt.Values.Add(12);
            pnt.Values.Add(84);
            pnt.Values.Add(90);

            pnt.XValues.Add(5);
            pnt.XValues.Add(27);
            pnt.XValues.Add(49);
            pnt.XValues.Add(78);
            pnt.XValues.Add(93);

            pnt.ZValues.Add(9);
            pnt.ZValues.Add(57);
            pnt.ZValues.Add(89);
            pnt.ZValues.Add(31);
            pnt.ZValues.Add(49);

            // Add a constline for the left axis
            NAxisConstLine constLine = m_Chart.Axis(StandardAxis.PrimaryY).ConstLines.Add();

            constLine.StrokeStyle.Color = Color.Blue;
            constLine.FillStyle         = new NColorFillStyle(new NArgbColor(125, Color.SteelBlue));
            constLine.Value             = 50.0;

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            LeftStyleCombo.SelectedIndex = (int)ConstLineMode.Plane;
            LeftValue.Value = (int)constLine.Value;

            BeginXScroll.Value   = 10;
            EndXScroll.Value     = 80;
            BeginXScroll.Enabled = false;
            EndXScroll.Enabled   = false;

            BeginZScroll.Value   = 10;
            EndZScroll.Value     = 80;
            BeginZScroll.Enabled = false;
            EndZScroll.Enabled   = false;

            nChartControl1.Refresh();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithValues(PeriodDropDownList, 0, 100, 10);
                PeriodDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            NFunctionCalculator calc = new NFunctionCalculator();

            nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None;

            NChart chart = nChartControl1.Charts[0];

            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(
                new NLength(5, NRelativeUnit.ParentPercentage),
                new NLength(20, NRelativeUnit.ParentPercentage));
            chart.Size = new NSizeL(
                new NLength(90, NRelativeUnit.ParentPercentage),
                new NLength(75, NRelativeUnit.ParentPercentage));

            NLegend legend = nChartControl1.Legends[0];

            legend.Data.ExpandMode = LegendExpandMode.ColsOnly;
            legend.Location        = new NPointL(
                new NLength(98, NRelativeUnit.ParentPercentage),
                new NLength(12, NRelativeUnit.ParentPercentage));

            // align the chart and the legend
            NSideGuideline guideline = new NSideGuideline(PanelSide.Right);

            guideline.Targets.Add(legend);
            guideline.Targets.Add(chart);
            nChartControl1.Document.RootPanel.Guidelines.Add(guideline);

            // setup X axis
            NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator();

            scaleX.FirstRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.FirstRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(225, 225, 225));
            scaleX.FirstRow.UseGridStyle            = true;
            scaleX.FirstRow.InnerTickStyle.Visible  = false;
            scaleX.SecondRow.GridStyle.ShowAtWalls  = new ChartWallType[] { ChartWallType.Back };
            scaleX.SecondRow.GridStyle.LineStyle    = new NStrokeStyle(1, Color.FromArgb(215, 215, 215));
            scaleX.SecondRow.UseGridStyle           = true;
            scaleX.SecondRow.InnerTickStyle.Visible = false;
            scaleX.ThirdRow.GridStyle.ShowAtWalls   = new ChartWallType[] { ChartWallType.Back };
            scaleX.ThirdRow.GridStyle.LineStyle     = new NStrokeStyle(1, Color.FromArgb(205, 205, 205));
            scaleX.ThirdRow.UseGridStyle            = true;
            scaleX.ThirdRow.InnerTickStyle.Visible  = false;
            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // setup primary Y axis
            NAxis axisY1 = chart.Axis(StandardAxis.PrimaryY);

            axisY1.Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 45, 100);

            NLinearScaleConfigurator scaleY1 = (NLinearScaleConfigurator)axisY1.ScaleConfigurator;

            scaleY1.RulerStyle.Height                   = new NLength(2, NGraphicsUnit.Pixel);
            scaleY1.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            scaleY1.InnerMajorTickStyle.LineStyle.Width = new NLength(0);

            // setup secondary Y axis
            NAxis axisY2 = chart.Axis(StandardAxis.SecondaryY);

            axisY2.Visible = true;
            axisY2.Anchor  = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 0, 40);

            NLinearScaleConfigurator scaleY2 = (NLinearScaleConfigurator)axisY2.ScaleConfigurator;

            scaleY2.RulerStyle.Height                   = new NLength(2, NGraphicsUnit.Pixel);
            scaleY2.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            scaleY2.InnerMajorTickStyle.LineStyle.Width = new NLength(0);

            Color color1 = Color.FromArgb(100, 100, 150);
            Color color2 = Color.FromArgb(200, 120, 120);
            Color color3 = Color.FromArgb(100, 150, 100);

            // setup the stock series
            NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock);

            stock.DataLabelStyle.Visible = false;
            stock.CandleStyle            = CandleStyle.Stick;
            stock.UpStrokeStyle.Color    = color1;
            stock.DownStrokeStyle.Color  = color2;
            stock.Legend.Mode            = SeriesLegendMode.None;
            stock.CandleWidth            = new NLength(0.5f, NRelativeUnit.ParentPercentage);
            stock.UseXValues             = true;
            stock.InflateMargins         = true;

            // Add line series for ADX
            NLineSeries lineADX = (NLineSeries)chart.Series.Add(SeriesType.Line);

            lineADX.DisplayOnAxis(StandardAxis.PrimaryY, false);
            lineADX.DisplayOnAxis(StandardAxis.SecondaryY, true);
            lineADX.BorderStyle.Color = Color.LimeGreen;
            lineADX.Name = "ADX";
            lineADX.DataLabelStyle.Visible = false;

            // Add line series for +DI
            NLineSeries lineDIPos = (NLineSeries)chart.Series.Add(SeriesType.Line);

            lineDIPos.MultiLineMode = MultiLineMode.Overlapped;
            lineDIPos.DisplayOnAxis(StandardAxis.PrimaryY, false);
            lineDIPos.DisplayOnAxis(StandardAxis.SecondaryY, true);
            lineDIPos.BorderStyle.Color = Color.Red;
            lineDIPos.Name = "+DI";
            lineDIPos.DataLabelStyle.Visible = false;

            // Add line series for -DI
            NLineSeries lineDINeg = (NLineSeries)chart.Series.Add(SeriesType.Line);

            lineDINeg.MultiLineMode = MultiLineMode.Overlapped;
            lineDINeg.DisplayOnAxis(StandardAxis.PrimaryY, false);
            lineDINeg.DisplayOnAxis(StandardAxis.SecondaryY, true);
            lineDINeg.BorderStyle.Color = Color.Blue;
            lineDINeg.Name = "-DI";
            lineDINeg.DataLabelStyle.Visible = false;

            // add arguments for function calculator
            stock.CloseValues.Name = "close";
            stock.HighValues.Name  = "high";
            stock.LowValues.Name   = "low";
            calc.Arguments.Add(stock.CloseValues);
            calc.Arguments.Add(stock.HighValues);
            calc.Arguments.Add(stock.LowValues);

            // form controls
            lineDIPos.Visible = ShowPosDICheckBox.Checked;
            lineDINeg.Visible = ShowNegDICheckBox.Checked;
            lineADX.Visible   = ShowADXCheckBox.Checked;

            // add header
            NLabel header = nChartControl1.Labels.AddHeader("Directional Movement");

            header.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            header.ContentAlignment           = ContentAlignment.BottomRight;
            header.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            GenerateData(stock);

            UpdateFunctions(stock, lineDIPos, lineDINeg, lineADX, calc);
        }
        /// <summary>
        /// Displays a custom label at the secondary Y axis
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="value"></param>
        /// <param name="label"></param>
        void SetValueLabel(NChart chart, double value, string label, bool showValue)
        {
            NScaleConfigurator scaleY2 = chart.Axis(StandardAxis.SecondaryY).ScaleConfigurator;

            string text = showValue ? string.Format("{0} = {1:0.###}", label, value) : label;

            NCustomValueLabel cl = new NCustomValueLabel(value, text);
            cl.Style.TextStyle.FontStyle = new NFontStyle("Arial", 8);
            cl.Style.ContentAlignment = ContentAlignment.TopCenter;
            scaleY2.CustomLabels.Add(cl);
        }
示例#35
0
文件: Graph.cs 项目: lewis810/HueApp
        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();
        }