Esempio n. 1
0
        public override void Initialize()
        {
            base.Initialize();

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

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

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

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

            chart.BoundsMode = BoundsMode.Stretch;

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

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

            // add interlaced 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);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                   = "Smooth Line";
            line.Legend.Mode            = SeriesLegendMode.Series;
            line.UseXValues             = false;
            line.UseZValues             = false;
            line.DataLabelStyle.Visible = false;
            line.MarkerStyle.Visible    = true;
            line.MarkerStyle.PointShape = PointShape.Cylinder;
            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);

            GenerateYValues(nValuesCount);

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

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            InflateMarginsCheck.Checked = true;
            RoundToTickCheck.Checked    = true;
        }
Esempio n. 2
0
        public void FillGraph(double[] values, double[] injvalues, TurboType turbo)
        {
            DataTable chartdt = new DataTable();

            chartdt.Columns.Add("X", Type.GetType("System.Double"));
            chartdt.Columns.Add("Y", Type.GetType("System.Double"));
            chartdt.Columns.Add("INJDC", Type.GetType("System.Double"));
            for (int i = 0; i < values.Length; i++)
            {
                chartdt.Rows.Add(Convert.ToDouble(x_axisvalues.GetValue(i)), values.GetValue(i), injvalues.GetValue(i));
            }
            NChart chart = nChartControl1.Charts[0];
            //NSeries series = (NSeries)chart.Series[0];
            NSmoothLineSeries line  = null;
            NSmoothLineSeries line2 = null;
            NSmoothLineSeries line3 = null;

            if (chart.Series.Count == 0)
            {
                line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line = (NSmoothLineSeries)chart.Series[0];
            }
            if (chart.Series.Count == 1)
            {
                line2 = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line2 = (NSmoothLineSeries)chart.Series[1];
            }
            if (chart.Series.Count == 2)
            {
                line3 = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line3 = (NSmoothLineSeries)chart.Series[2];
            }
            line.ClearDataPoints();
            line2.ClearDataPoints();
            line3.ClearDataPoints();
            PressureToTorque ptt = new PressureToTorque();

            foreach (DataRow dr in chartdt.Rows)
            {
                double power  = 0;
                double torque = 0;
                torque = ptt.CalculateTorqueFromPressure(Convert.ToDouble(dr["Y"]), turbo);
                power  = TorqueToPower(torque, Convert.ToDouble(dr["X"]));
                //power =
                line.AddDataPoint(new NDataPoint(Convert.ToDouble(dr["X"]), torque));
                line2.AddDataPoint(new NDataPoint(Convert.ToDouble(dr["X"]), power));
                line3.AddDataPoint(new NDataPoint(Convert.ToDouble(dr["X"]), Convert.ToDouble(dr["INJDC"])));
            }
            nChartControl1.Refresh();
        }
        private void InflateMarginsCheckBox_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            line.InflateMargins = (bool)InflateMarginsCheckBox.IsChecked;
            nChartControl1.Refresh();
        }
Esempio n. 4
0
        private void InflateMarginsCheck_CheckedChanged(object sender, System.EventArgs e)
        {
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            line.InflateMargins = InflateMarginsCheck.Checked;
            nChartControl1.Refresh();
        }
        private void checkShowMarkers_CheckedChanged(object sender, System.EventArgs e)
        {
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            line.MarkerStyle.Visible = checkShowMarkers.Checked;

            nChartControl1.Refresh();
        }
Esempio n. 6
0
        private void BorderPropsButton_Click(object sender, System.EventArgs e)
        {
            NStrokeStyle      strokeStyleResult;
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            if (NStrokeStyleTypeEditor.Edit(line.BorderStyle, out strokeStyleResult))
            {
                line.BorderStyle = strokeStyleResult;
                nChartControl1.Refresh();
            }
        }
        protected void nChartControl2_AsyncCustomCommand(object sender, EventArgs e)
        {
            NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs;

            switch (args.Command.Name)
            {
            case "displayDataWindow":
                double dataWindowWidth = double.Parse(args.Command.Arguments["width"] as string);

                NCartesianChart   zoomChart = nChartControl2.Charts[0] as NCartesianChart;
                NSmoothLineSeries zoomLine  = zoomChart.Series[0] as NSmoothLineSeries;

                NCartesianChart previewChart = nChartControl1.Charts[0] as NCartesianChart;
                NAxis           previewXAxis = previewChart.Axis(StandardAxis.PrimaryX);

                NPointF    ptViewPoint   = new NPointF(float.Parse(args.Command.Arguments["x"] as string), 0);
                NVector2DD vecScalePoint = new NVector2DD();

                using (NChartRasterView view = new NChartRasterView(nChartControl1.Document, nChartControl1.Dimensions, NResolution.ScreenResolution))
                {
                    view.RecalcLayout();

                    NViewToScale2DTransformation viewToScale = new NViewToScale2DTransformation(
                        view.Context,
                        previewChart,
                        (int)StandardAxis.PrimaryX,
                        (int)StandardAxis.PrimaryY
                        );

                    if (viewToScale.Transform(ptViewPoint, ref vecScalePoint))
                    {
                        double rangeMin = vecScalePoint.X - dataWindowWidth / 2;
                        rangeMin = previewXAxis.Scale.ViewRange.GetValueInRange(rangeMin);

                        double rangeMax = rangeMin + dataWindowWidth;
                        rangeMax = previewXAxis.Scale.ViewRange.GetValueInRange(rangeMax);

                        rangeMin = rangeMax - dataWindowWidth;

                        // reinitialize data points
                        zoomLine.XValues.Clear();
                        zoomLine.Values.Clear();
                        for (int i = (int)rangeMin; i <= (int)rangeMax; i++)
                        {
                            zoomLine.XValues.Add(i);
                            zoomLine.Values.Add(waveData[i]);
                        }
                    }
                }
                break;
            }
        }
        private void ChangeData(NSmoothLineSeries line)
        {
            line.Values.Clear();
            line.XValues.Clear();
            line.ZValues.Clear();

            double r = 5;

            for (int i = 0; i < 10; i++)
            {
                double dY = r * Math.Sin(i) + Random.NextDouble();
                double dX = r * Math.Cos(i) + Random.NextDouble();;

                line.Values.Add(dY);
                line.XValues.Add(dX);

                r -= 0.3;
            }
        }
        private void ChangeData()
        {
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            float fSpringHeight = 10;
            int   nWindings     = (int)3;
            int   nComplexity   = (int)4;

            double dCurrentAngle = 0;
            double dCurrentHeight = 0;
            double dCurrentRadius = 5;
            double dX = 0, dY = 0, dZ = 0;

            float fHeightStep   = fSpringHeight / (nWindings * nComplexity);
            float fAngleStepRad = (float)(((360 / nComplexity) * 3.1415926535f) / 180.0f);

            line.Values.Clear();
            line.XValues.Clear();
            line.ZValues.Clear();

            while (nWindings > 0)
            {
                for (int i = 0; i < nComplexity; i++)
                {
                    dX = Math.Cos(dCurrentAngle) * dCurrentRadius;
                    dZ = Math.Sin(dCurrentAngle) * dCurrentRadius;
                    dY = dCurrentHeight;

                    line.Values.Add(dY);
                    line.XValues.Add(dX);
                    line.ZValues.Add(dZ);

                    dCurrentAngle  += fAngleStepRad;
                    dCurrentHeight += fHeightStep;
                    dCurrentRadius  = 2 + Random.NextDouble() * 5;
                }

                nWindings--;
            }
        }
Esempio n. 10
0
        private void ChangeData()
        {
            NChart            chart = nChartControl1.Charts[0];
            NSmoothLineSeries line  = (NSmoothLineSeries)chart.Series[0];

            line.Values.Clear();
            line.XValues.Clear();
            line.ZValues.Clear();

            double r = 5;

            for (int i = 0; i < 10; i++)
            {
                double dY = r * Math.Sin(i) + Random.NextDouble();
                double dX = r * Math.Cos(i) + Random.NextDouble();;

                line.Values.Add(dY);
                line.XValues.Add(dX);

                r -= 0.3;
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 7;

                WebExamplesUtilities.FillComboWithValues(LineWidthDropDownList, 0, 5, 1);
                LineWidthDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(LineColorDropDownList, KnownColor.Orange);

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

                ShowMarkersCheckBox.Checked         = true;
                LeftAxisRoundToTickCheckBox.Checked = true;
                InflateMarginsCheckBox.Checked      = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Smooth Line 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 linearScaleConfigurator = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScaleConfigurator.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScaleConfigurator.RoundToTickMin = LeftAxisRoundToTickCheckBox.Checked;
            linearScaleConfigurator.RoundToTickMax = LeftAxisRoundToTickCheckBox.Checked;

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

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                          = "Smooth Line";
            line.UseXValues                    = false;
            line.UseZValues                    = false;
            line.InflateMargins                = InflateMarginsCheckBox.Checked;
            line.DataLabelStyle.Visible        = false;
            line.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            line.MarkerStyle.AutoDepth         = false;
            line.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            line.MarkerStyle.Height            = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Width             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Depth             = new NLength((float)MarkerSizeDropDownList.SelectedIndex, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.BorderStyle.Color = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);
            line.MarkerStyle.FillStyle         = new NColorFillStyle(Red);
            line.BorderStyle.Width             = new NLength(LineWidthDropDownList.SelectedIndex, NGraphicsUnit.Pixel);
            line.BorderStyle.Color             = WebExamplesUtilities.ColorFromDropDownList(LineColorDropDownList);

            if (ShowMarkersCheckBox.Checked)
            {
                MarkerSizeDropDownList.Enabled  = true;
                MarkerShapeDropDownList.Enabled = true;
            }
            else
            {
                MarkerSizeDropDownList.Enabled  = false;
                MarkerShapeDropDownList.Enabled = false;
            }

            GenreateYValues(nValuesCount);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
        void CreateZoomChart()
        {
            if (nChartControl2.RequiresInitialization)
            {
                //	reset the data window width
                HttpContext.Current.Session["DataWindowWidth"] = defaultDataWindowWidth;

                // set up the chart control
                nChartControl2.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl2.Legends.Clear();

                // set a chart title
                NLabel header = nChartControl2.Labels.AddHeader("Wave Details");
                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(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage));

                // setup a Smooth Line chart
                NCartesianChart chart = nChartControl2.Charts[0] as NCartesianChart;
                chart.BoundsMode = BoundsMode.Stretch;
                chart.Location   = new NPointL(
                    new NLength(4, NRelativeUnit.ParentPercentage),
                    new NLength(25, NRelativeUnit.ParentPercentage));
                chart.Size = new NSizeL(
                    new NLength(88, NRelativeUnit.ParentPercentage),
                    new NLength(75, NRelativeUnit.ParentPercentage));

                // setup X axis
                NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
                scaleX.RoundToTickMin = false;
                scaleX.RoundToTickMax = false;

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

                // add interlace stripe to the Y axis
                NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(0xfe, 0xed, 0xe2)), null, true, 0, 0, 1, 1);
                stripStyle.Interlaced = true;
                stripStyle.SetShowAtWall(ChartWallType.Back, true);
                stripStyle.SetShowAtWall(ChartWallType.Left, true);
                scaleY.StripStyles.Add(stripStyle);

                // add the line
                NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);
                line.Name                   = "Wave";
                line.Legend.Mode            = SeriesLegendMode.None;
                line.UseXValues             = true;
                line.InflateMargins         = true;
                line.DataLabelStyle.Visible = false;
                line.MarkerStyle.Visible    = false;
                line.BorderStyle.Width      = new NLength(1, NGraphicsUnit.Pixel);

                // initialize data points
                for (int i = 0; i < defaultDataWindowWidth; i++)
                {
                    line.XValues.Add(i);
                    line.Values.Add(waveData[i]);
                }

                // apply style sheet
                NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh);
                styleSheet.Apply(nChartControl2.Document);
            }
        }
        void CreatePreviewChart()
        {
            nChartControl1.HttpHandlerCallback = new PreviewHttpHandlerCallback();

            if (nChartControl1.RequiresInitialization)
            {
                nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                nChartControl1.Legends.Clear();

                // set a chart title
                NLabel header = nChartControl1.Labels.AddHeader("Wave Preview");
                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(3, NRelativeUnit.ParentPercentage),
                    new NLength(3, NRelativeUnit.ParentPercentage));

                // setup a Smooth Line chart
                NCartesianChart chart = nChartControl1.Charts[0] as NCartesianChart;
                chart.BoundsMode = BoundsMode.Stretch;
                chart.Location   = new NPointL(
                    new NLength(4, NRelativeUnit.ParentPercentage),
                    new NLength(25, NRelativeUnit.ParentPercentage));
                chart.Size = new NSizeL(
                    new NLength(88, NRelativeUnit.ParentPercentage),
                    new NLength(75, NRelativeUnit.ParentPercentage));

                // setup X axis
                NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

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

                // add interlace stripe to the Y axis
                NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.FromArgb(0xfe, 0xed, 0xe2)), null, true, 0, 0, 1, 1);
                stripStyle.Interlaced = true;
                stripStyle.SetShowAtWall(ChartWallType.Back, true);
                stripStyle.SetShowAtWall(ChartWallType.Left, true);
                scaleY.StripStyles.Add(stripStyle);

                // add the line
                NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);
                line.Name                   = "Wave";
                line.Legend.Mode            = SeriesLegendMode.None;
                line.UseXValues             = false;
                line.UseZValues             = false;
                line.InflateMargins         = true;
                line.DataLabelStyle.Visible = false;
                line.MarkerStyle.Visible    = false;
                line.BorderStyle.Width      = new NLength(1, NGraphicsUnit.Pixel);

                // initialize data points
                for (int i = 0; i < waveDataLenth; i++)
                {
                    line.Values.Add(waveData[i]);
                }

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

                // select a default window
                NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron);
                Color         selectionBorderColor = palette.SeriesColors[2];
                Color         selectionFillColor   = Color.FromArgb(64, palette.SeriesColors[1]);

                NRangeSelection selection = new NRangeSelection((int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);
                selection.BorderStyle         = new NStrokeStyle(1, selectionBorderColor);
                selection.FillStyle           = new NColorFillStyle(selectionFillColor);
                selection.HorizontalAxisRange = new NRange1DD(0, defaultDataWindowWidth);
                selection.VerticalAxisRange   = new NRange1DD(-waveDataWave1Factor, waveDataWave1Factor);
                selection.Visible             = true;
                chart.RangeSelections.Add(selection);
            }
        }
        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("XYZ Scatter Smooth Line");

            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 = true;
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            chart.Depth  = 55.0f;
            chart.Width  = 55.0f;
            chart.Height = 55.0f;

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

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

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

            ChangeData(line);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Esempio n. 15
0
        private void Init2dGraph()
        {
            nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighQuality;
            nChartControl1.Legends.Clear(); // no legend
            NChart chart2d = nChartControl1.Charts[0];

            NSmoothLineSeries surface = null;

            if (chart2d.Series.Count == 0)
            {
                surface = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                surface = (NSmoothLineSeries)chart2d.Series[0];
            }

            chart2d.BoundsMode = BoundsMode.Stretch;
            NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart2d.Axis(StandardAxis.PrimaryY).ScaleConfigurator;

            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            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);
            NSmoothLineSeries line = null;

            if (chart2d.Series.Count == 0)
            {
                line = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line = (NSmoothLineSeries)chart2d.Series[0];
            }
            line.Name                   = "Power (bhp)";
            line.Legend.Mode            = SeriesLegendMode.Series;
            line.UseXValues             = true;
            line.UseZValues             = false;
            line.DataLabelStyle.Visible = true;
            line.Values.ValueFormatter  = new Nevron.Dom.NNumericValueFormatter("0");
            line.MarkerStyle.Visible    = true;
            line.MarkerStyle.PointShape = PointShape.Sphere;
            line.MarkerStyle.AutoDepth  = true;
            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.HorizontalAxes = y_axisvalues;

            NSmoothLineSeries line2 = null;

            if (chart2d.Series.Count == 1)
            {
                line2 = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line2 = (NSmoothLineSeries)chart2d.Series[1];
            }
            line2.Name                   = "Torque (Nm)";
            line2.Legend.Mode            = SeriesLegendMode.Series;
            line2.UseXValues             = true;
            line2.UseZValues             = false;
            line2.Values.ValueFormatter  = new Nevron.Dom.NNumericValueFormatter("0");
            line2.MarkerStyle.Visible    = true;
            line2.MarkerStyle.PointShape = PointShape.Sphere;
            line2.MarkerStyle.AutoDepth  = true;
            line2.MarkerStyle.Width      = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line2.MarkerStyle.Height     = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line2.MarkerStyle.Depth      = new NLength(1.4f, NRelativeUnit.ParentPercentage);

            NSmoothLineSeries line3 = null;

            if (chart2d.Series.Count == 2)
            {
                line3 = (NSmoothLineSeries)chart2d.Series.Add(SeriesType.SmoothLine);
            }
            else
            {
                line3 = (NSmoothLineSeries)chart2d.Series[2];
            }
            line3.Name                   = "Injector DC";
            line3.Legend.Mode            = SeriesLegendMode.Series;
            line3.UseXValues             = true;
            line3.UseZValues             = false;
            line3.DataLabelStyle.Visible = true;
            line3.Values.ValueFormatter  = new Nevron.Dom.NNumericValueFormatter("0.0");
            line3.MarkerStyle.Visible    = true;
            line3.MarkerStyle.PointShape = PointShape.Sphere;
            line3.MarkerStyle.AutoDepth  = true;
            line3.MarkerStyle.Width      = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line3.MarkerStyle.Height     = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            line3.MarkerStyle.Depth      = new NLength(1.4f, NRelativeUnit.ParentPercentage);

            surface.Name = "Surface";
            //surface.Legend.Mode = SeriesLegendMode.SeriesLogic;
            //surface.PositionValue = 10.0;
            for (int i = 0; i < x_axisvalues.Length; i++)
            {
                surface.XValues.Add(x_axisvalues.GetValue(i));
            }
            NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Nevron);

            styleSheet.Apply(nChartControl1.Document);
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            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 X axis
            NDateTimeScaleConfigurator scaleX = new NDateTimeScaleConfigurator();

            scaleX.EnableUnitSensitiveFormatting = false;
            scaleX.LabelValueFormatter           = new NDateTimeValueFormatter("dd MMM");
            scaleX.LabelStyle.Angle = new NScaleLabelAngle(90);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // 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.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.StripStyles.Add(stripStyle);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            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 = true;

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

            styleSheet.Apply(nChartControl1.Document);

            GenreateYValues(nValuesCount);
            GenreateXValues(nValuesCount);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);
        }
Esempio n. 17
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            NChart chart = nChartControl1.Charts[0];

            nChartControl1.Controller.Selection.Add(chart);
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // set a chart title
            NLabel title = new NLabel("XY Smooth Line");

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

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

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

            // configure axes
            chart.Axis(StandardAxis.Depth).Visible = false;

            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

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

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

            // add interlaced 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);

            // add the line
            NSmoothLineSeries line = (NSmoothLineSeries)chart.Series.Add(SeriesType.SmoothLine);

            line.Name                           = "Smooth Line";
            line.InflateMargins                 = true;
            line.Legend.Mode                    = SeriesLegendMode.Series;
            line.DataLabelStyle.Visible         = false;
            line.MarkerStyle.Visible            = true;
            line.MarkerStyle.PointShape         = PointShape.Cylinder;
            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();

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

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

            styleSheet.Apply(nChartControl1.Document);
        }