Пример #1
0
        private void SetupVolumeChart(NCartesianChart chart)
        {
            // setup Y axis
            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            scaleY.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            scaleY.InnerMajorTickStyle.Length = new NLength(0);

            NAxis axisY = chart.Axis(StandardAxis.SecondaryY);

            axisY.Anchor            = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 25, 45);
            axisY.ScaleConfigurator = scaleY;
            axisY.Visible           = true;

            // setup the volume series
            m_Volume                        = (NAreaSeries)chart.Series.Add(SeriesType.Area);
            m_Volume.Name                   = "Volume";
            m_Volume.Legend.Mode            = SeriesLegendMode.None;
            m_Volume.FillStyle              = new NColorFillStyle(Color.YellowGreen);
            m_Volume.DataLabelStyle.Visible = false;
            m_Volume.Values.Name            = "volume";
            m_Volume.DisplayOnAxis(StandardAxis.PrimaryY, false);
            m_Volume.DisplayOnAxis(axisY.AxisId, true);
            m_Volume.UseXValues = true;
        }
Пример #2
0
        public override void Initialize()
        {
            base.Initialize();

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

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

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

            // add interlace stripe
            NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         strip       = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            //linearScale.Strips.Add(strip);

            // setup a area series
            m_Area = new NAreaSeries();
            m_Area.InflateMargins         = true;
            m_Area.DataLabelStyle.Visible = false;
            m_Area.BorderStyle.Width      = new NLength(0);
            m_Area.Legend.Mode            = SeriesLegendMode.None;

            NPalette palette = new NPalette();

            palette.Clear();
            palette.Mode = PaletteMode.Custom;
            palette.Add(0, Color.Green);
            palette.Add(60, Color.Yellow);
            palette.Add(120, Color.Red);

            m_Area.Palette = palette;

            m_AxisRange = new NRange1DD(0, 130);

            // limit the axis range to 0, 130
            yAxis.View = new NRangeAxisView(m_AxisRange, true, true);
            m_Chart.Series.Add(m_Area);

            int indicatorCount = 10;

            m_IndicatorPhase = new double[indicatorCount];

            // add some data to the area series
            for (int i = 0; i < indicatorCount; i++)
            {
                m_IndicatorPhase[i] = i * 30;
                m_Area.Values.Add(0);
            }

            SmoothPaletteCheckBox.Checked = true;

            timer1.Start();
        }
Пример #3
0
        private void DropLinesCheck_CheckedChanged(object sender, System.EventArgs e)
        {
            NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            area.DropLines = DropLinesCheck.Checked;
            nChartControl1.Refresh();
        }
Пример #4
0
        public override void Initialize()
        {
            base.Initialize();

            m_ImageFrameStyle = new NImageFrameStyle();
            nChartControl1.BackgroundStyle.FrameStyle = m_ImageFrameStyle;
            ImageFrameStyleEditorUC.Style             = m_ImageFrameStyle;

            nChartControl1.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant2, Color.AliceBlue, Color.LightGray);

            NLabel title = new NLabel("Image Background Frame");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.Navy);
            title.TextStyle.BackplaneStyle.Visible = false;

            NChart chart = nChartControl1.Charts[0];

            NAreaSeries area = (NAreaSeries)chart.Series.Add(SeriesType.Area);

            area.DataLabelStyle.Visible = false;
            area.FillStyle = new NColorFillStyle(DarkOrange);
            area.Values.AddRange(monthValues);

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

            BackgroundFillStyleComboBox.Items.Add("Solid color");
            BackgroundFillStyleComboBox.Items.Add("Gradient");
            BackgroundFillStyleComboBox.Items.Add("Image");
            BackgroundFillStyleComboBox.Items.Add("Pattern");
            BackgroundFillStyleComboBox.Items.Add("AdvancedGradient");
            BackgroundFillStyleComboBox.SelectedIndex = 1;
        }
Пример #5
0
        private void DepthScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e)
        {
            NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            area.DepthPercent = DepthScroll.Value;
            nChartControl1.Refresh();
        }
Пример #6
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("Multi Series Area Chart");

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

            // apply predefined projection and lighting
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Width  = 65.0f;
            m_Chart.Height = 40.0f;
            m_Chart.Depth  = 40.0f;

            // add interlace stripe
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(), 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 area
            m_Area1 = (NAreaSeries)m_Chart.Series.Add(SeriesType.Area);
            m_Area1.MultiAreaMode          = MultiAreaMode.Series;
            m_Area1.DataLabelStyle.Visible = false;
            m_Area1.Name = "Area 1";
            m_Area1.Values.FillRandomRange(Random, 15, 10, 40);

            // add the second area
            m_Area2 = (NAreaSeries)m_Chart.Series.Add(SeriesType.Area);
            m_Area2.MultiAreaMode          = MultiAreaMode.Series;
            m_Area2.DataLabelStyle.Visible = false;
            m_Area2.Name = "Area 2";
            m_Area2.Values.FillRandomRange(Random, 15, 30, 60);

            // add the third area
            m_Area3 = (NAreaSeries)m_Chart.Series.Add(SeriesType.Area);
            m_Area3.MultiAreaMode          = MultiAreaMode.Series;
            m_Area3.DataLabelStyle.Visible = false;
            m_Area3.Name = "Area 3";
            m_Area3.Values.FillRandomRange(Random, 15, 50, 80);

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Пример #7
0
        private void SetupDataLabels(NAreaSeries area)
        {
            NDataLabelStyle dataLabel = area.DataLabelStyle;

            dataLabel.ArrowLength = 0;
            dataLabel.VertAlign   = ENVerticalAlignment.Center;
            dataLabel.TextStyle.Background.Padding = new NMargins(5);
            dataLabel.TextStyle.Font = new NFont("Arial", 8, ENFontStyle.Bold);
        }
Пример #8
0
        private void ThirdAreaDataLabelsCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NChart      chart = nChartControl1.Charts[0];
            NAreaSeries area2 = (NAreaSeries)chart.Series[2];

            area2.DataLabelStyle.Format = GetFormatStringFromIndex(ThirdAreaDataLabelsCombo.SelectedIndex);

            nChartControl1.Refresh();
        }
Пример #9
0
        private void GenerateDataButton_Click(object sender, System.EventArgs e)
        {
            NChart      chart  = nChartControl1.Charts[0];
            NAreaSeries series = (NAreaSeries)chart.Series[0];

            GenerateData(series);

            nChartControl1.Refresh();
        }
Пример #10
0
        private void SecondAreaDataLabelsComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            NChart      chart = nChartControl1.Charts[0];
            NAreaSeries area1 = (NAreaSeries)chart.Series[1];

            area1.DataLabelStyle.Format = GetFormatStringFromIndex(SecondAreaDataLabelsComboBox.SelectedIndex);

            nChartControl1.Refresh();
        }
Пример #11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel header = nChartControl1.Labels.AddFooter("Volume Indicators");

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

            // setup charts
            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;
            chart.Location   = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            chart.Size       = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

            SetupTimeScale(chart.Axis(StandardAxis.PrimaryX));
            NStockSeries stock  = SetupStockChart(chart);
            NAreaSeries  volume = SetupVolumeChart(chart);
            NLineSeries  line   = SetupIndicatorChart(chart);

            // form controls
            if (!IsPostBack)
            {
                FunctionDropDownList.Items.Add("Accumulation Distribution");
                FunctionDropDownList.Items.Add("Chaikin Oscillator");
                FunctionDropDownList.Items.Add("Ease of Movement");
                FunctionDropDownList.Items.Add("Money Flow Index");
                FunctionDropDownList.Items.Add("Negative Volume Index");
                FunctionDropDownList.Items.Add("On Balance Volume");
                FunctionDropDownList.Items.Add("Positive Volume Index");
                FunctionDropDownList.Items.Add("Price and Volume Trend");

                FunctionDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithValues(ParameterDropDownList, 0, 100, 10);
                ParameterDropDownList.SelectedIndex = 1;
            }

            NFunctionCalculator function = new NFunctionCalculator();

            // generate data
            GenerateData(stock, volume, line);
            GenerateVolumeData(volume, prevVolumeValue, numDataPoits);

            UpdateFunction(stock, volume, line, function);

            line.Values    = function.Calculate();
            line.XValues   = (NDataSeriesDouble)stock.XValues.Clone();
            volume.XValues = (NDataSeriesDouble)stock.XValues.Clone();
        }
Пример #12
0
        private void OriginModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            area.OriginMode = (SeriesOriginMode)OriginModeComboBox.SelectedIndex;

            nChartControl1.Refresh();

            OriginValueTextBox.IsEnabled = (area.OriginMode == SeriesOriginMode.CustomOrigin);
        }
Пример #13
0
        private void SetupDataLabels(NAreaSeries area)
        {
            NDataLabelStyle dataLabel = area.DataLabelStyle;

            dataLabel.ArrowLength = new NLength(0);
            dataLabel.VertAlign   = VertAlign.Center;
            dataLabel.TextStyle.BackplaneStyle.Shape   = BackplaneShape.Ellipse;
            dataLabel.TextStyle.BackplaneStyle.Inflate = new NSizeL(5, 5);
            dataLabel.TextStyle.FontStyle = new NFontStyle("Arial", new NLength(8, NGraphicsUnit.Point), FontStyle.Bold);
        }
Пример #14
0
        private void OriginModeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            area.OriginMode = (SeriesOriginMode)OriginModeCombo.SelectedIndex;

            nChartControl1.Refresh();

            OriginValueTextBox.Enabled = (area.OriginMode == SeriesOriginMode.CustomOrigin);
        }
Пример #15
0
        private void GenerateXYData(NAreaSeries area)
        {
            int numberOfTurns        = NumberOfTurnsDropDownList.SelectedIndex + 3;
            int numberOfPointsInTurn = (NumberOfPointsInTurnDropDownList.SelectedIndex + 1) * 10000;

            for (int i = 0; i < numberOfTurns; i++)
            {
                AddTurn(area, numberOfPointsInTurn);
            }
        }
Пример #16
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Sampled Area Chart");

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

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

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

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

            // apply linear scaling to the x axis
            linearScale = new NLinearScaleConfigurator();
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale;

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

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

            // add the area series
            m_Area      = (NAreaSeries)m_Chart.Series.Add(SeriesType.Area);
            m_Area.Name = "Area Series";
            m_Area.DataLabelStyle.Visible = false;
            m_Area.MarkerStyle.Visible    = false;
            m_Area.SamplingMode           = SeriesSamplingMode.Enabled;
            m_Area.UseXValues             = true;

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

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

            styleSheet.Apply(nChartControl1.Document);

            UseXValuesCheckBox.Checked = true;

            Add40KDataButton_Click(null, null);
        }
        private void CreateSampleChart()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Tracking Mouse Events");

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

            NChart chart = nChartControl1.Charts[0];

            // add interlace stripe
            NLinearScaleConfigurator linearScale = 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);

            // apply lighting and projection
            chart.Enable3D = true;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre);

            // add line series
            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);

            line.Name                   = "Line";
            line.LineSegmentShape       = LineSegmentShape.Tape;
            line.DataLabelStyle.Visible = false;
            line.Values.FillRandomRange(Random, 10, 10, 30);

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

            bar.Name = "Bar";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 10, 40, 60);

            // add area series
            NAreaSeries area = (NAreaSeries)chart.Series.Add(SeriesType.Area);

            area.Name = "Area";
            area.DataLabelStyle.Visible = false;
            area.Values.FillRandomRange(Random, 10, 60, 100);

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

            styleSheet.Apply(nChartControl1.Document);

            nChartControl1.Refresh();
        }
Пример #18
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Standard Area";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // setup X axis
            NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            scaleX.InflateContentRange           = false;
            scaleX.MajorTickMode                 = ENMajorTickMode.AutoMaxCount;
            scaleX.DisplayDataPointsBetweenTicks = false;
            scaleX.Labels.Visible                = false;

            for (int i = 0; i < monthLetters.Length; i++)
            {
                scaleX.CustomLabels.Add(new NCustomValueLabel(i, monthLetters[i]));
            }

            // add interlaced stripe for Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;

            NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;

            scaleY.Strips.Add(stripStyle);

            // setup area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible = true;
            dataLabelStyle.Format  = "<value>";

            m_Area.DataLabelStyle = dataLabelStyle;

            for (int i = 0; i < monthValues.Length; i++)
            {
                m_Area.DataPoints.Add(new NAreaDataPoint(monthValues[i]));
            }

            chart.Series.Add(m_Area);

            return(chartView);
        }
Пример #19
0
        private void AreaBorderButton_Click(object sender, System.EventArgs e)
        {
            NStrokeStyle strokeStyleResult;
            NAreaSeries  area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            if (NStrokeStyleTypeEditor.Edit(area.BorderStyle, out strokeStyleResult))
            {
                area.BorderStyle = strokeStyleResult;
                nChartControl1.Refresh();
            }
        }
Пример #20
0
        private void AreaFEButton_Click(object sender, System.EventArgs e)
        {
            NFillStyle  fillStyleResult;
            NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];

            if (NFillStyleTypeEditor.Edit(area.FillStyle, out fillStyleResult))
            {
                area.FillStyle = fillStyleResult;
                nChartControl1.Refresh();
            }
        }
Пример #21
0
        internal void GenerateOHLCData(NAreaSeries areaSeries, double prevValue, int nCount)
        {
            double    value, open;
            DateTime  dt    = DateTime.Now;
            NRange1DD range = new NRange1DD(10, 1000);

            for (int nIndex = 0; nIndex < nCount; nIndex++)
            {
                open = prevValue;
                bool upward = false;

                if (range.Begin > prevValue)
                {
                    upward = true;
                }
                else if (range.End < prevValue)
                {
                    upward = false;
                }
                else
                {
                    upward = Random.NextDouble() > 0.5;
                }

                if (upward)
                {
                    // upward price change
                    value = open + (2 + (Random.NextDouble() * 20));
                }
                else
                {
                    // downward price change
                    value = open - (2 + (Random.NextDouble() * 20));
                }

                if (value < 1)
                {
                    value = 1;
                }

                prevValue = value;

                areaSeries.Values.Add(value);

                while (dt.DayOfWeek == DayOfWeek.Saturday || dt.DayOfWeek == DayOfWeek.Sunday)
                {
                    dt = dt.AddDays(1);
                }

                areaSeries.XValues.Add(nIndex);
//                areaSeries.XValues.Add(dt.ToOADate());
                dt = dt.AddDays(1);
            }
        }
Пример #22
0
 private void OriginValueTextBox_TextChanged(object sender, EventArgs e)
 {
     try
     {
         NAreaSeries area = (NAreaSeries)nChartControl1.Charts[0].Series[0];
         area.Origin = Double.Parse(OriginValueTextBox.Text);
         nChartControl1.Refresh();
     }
     catch
     {
     }
 }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "XY Scatter Area";

            // configure chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];

            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // add interlace stripe
            NLinearScale linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
            NScaleStrip  stripStyle  = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced = true;
            linearScale.Strips.Add(stripStyle);

            // show the x axis grid lines
            linearScale = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale;

            NScaleGridLines majorGrid = new NScaleGridLines();

            majorGrid.Visible          = true;
            linearScale.MajorGridLines = majorGrid;

            // add the area series
            m_Area      = new NAreaSeries();
            m_Area.Name = "Area Series";

            NDataLabelStyle dataLabelStyle = new NDataLabelStyle();

            dataLabelStyle.Visible           = true;
            dataLabelStyle.ArrowStroke.Width = 0;
            dataLabelStyle.Format            = "<value>";
            m_Area.DataLabelStyle            = dataLabelStyle;

            m_Area.UseXValues = true;

            // add xy values
            m_Area.DataPoints.Add(new NAreaDataPoint(12, 10));
            m_Area.DataPoints.Add(new NAreaDataPoint(25, 23));
            m_Area.DataPoints.Add(new NAreaDataPoint(45, 12));
            m_Area.DataPoints.Add(new NAreaDataPoint(55, 24));
            m_Area.DataPoints.Add(new NAreaDataPoint(61, 16));
            m_Area.DataPoints.Add(new NAreaDataPoint(69, 19));
            m_Area.DataPoints.Add(new NAreaDataPoint(78, 17));

            chart.Series.Add(m_Area);

            return(chartView);
        }
Пример #24
0
        private void GenerateData(NStockSeries stock, NAreaSeries volume, NLineSeries line)
        {
            WebExamplesUtilities.GenerateOHLCData(stock, prevCloseValue, numDataPoits);
            FillStockDates(stock, numDataPoits, new DateTime(2010, 1, 11));
            GenerateVolumeData(volume, prevVolumeValue, numDataPoits);

            volume.XValues.Clear();
            volume.XValues.AddRange(stock.XValues);

            line.XValues.Clear();
            line.XValues.AddRange(stock.XValues);
        }
Пример #25
0
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateCartesianChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Area Palette";

            // configure chart
            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear);

            // add interlace stripe
            NLinearScale linearScale = m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale as NLinearScale;
            NScaleStrip  strip       = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

            strip.Interlaced = true;
            linearScale.Strips.Add(strip);

            // setup an area series
            m_Area                = new NAreaSeries();
            m_Area.Name           = "Area Series";
            m_Area.InflateMargins = true;
            m_Area.UseXValues     = false;
            m_Area.DataLabelStyle = new NDataLabelStyle(false);

            m_Area.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(0, NColor.Green), new NColorValuePair(60, NColor.Yellow), new NColorValuePair(120, NColor.Red) });

            m_AxisRange = new NRange(0, 130);

            // limit the axis range to 0, 130
            NCartesianAxis yAxis = m_Chart.Axes[ENCartesianAxis.PrimaryY];

            yAxis.ViewRangeMode     = ENAxisViewRangeMode.FixedRange;
            yAxis.MinViewRangeValue = m_AxisRange.Begin;
            yAxis.MaxViewRangeValue = m_AxisRange.End;
            m_Chart.Series.Add(m_Area);

            int indicatorCount = 10;

            m_IndicatorPhase = new double[indicatorCount];

            // add some data to the area series
            for (int i = 0; i < indicatorCount; i++)
            {
                m_IndicatorPhase[i] = i * 30;
                m_Area.DataPoints.Add(new NAreaDataPoint(0));
            }

            return(chartView);
        }
Пример #26
0
        void GenerateData(NAreaSeries series)
        {
            series.Values.Clear();
            series.XValues.Clear();

            double xvalue = 10;

            for (int i = 0; i < 24; i++)
            {
                double value = Math.Sin(i * 0.4) * 5 + Random.NextDouble() * 3;
                xvalue += 1 + Random.NextDouble() * 20;

                series.Values.Add(value);
                series.XValues.Add(xvalue);
            }
        }
Пример #27
0
        private void ShowDataLabelsCheck_CheckedChanged(object sender, EventArgs e)
        {
            NChart      chart = nChartControl1.Charts[0];
            NAreaSeries area0 = (NAreaSeries)chart.Series[0];
            NAreaSeries area1 = (NAreaSeries)chart.Series[1];
            NAreaSeries area2 = (NAreaSeries)chart.Series[2];

            area0.DataLabelStyle.Visible = ShowDataLabelsCheck.Checked;
            area1.DataLabelStyle.Visible = ShowDataLabelsCheck.Checked;
            area2.DataLabelStyle.Visible = ShowDataLabelsCheck.Checked;

            FirstAreaDataLabelsCombo.Enabled  = ShowDataLabelsCheck.Checked;
            SecondAreaDataLabelsCombo.Enabled = ShowDataLabelsCheck.Checked;
            ThirdAreaDataLabelsCombo.Enabled  = ShowDataLabelsCheck.Checked;

            nChartControl1.Refresh();
        }
Пример #28
0
        private void ShowDataLabelsCheckBox_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            NChart      chart = nChartControl1.Charts[0];
            NAreaSeries area0 = (NAreaSeries)chart.Series[0];
            NAreaSeries area1 = (NAreaSeries)chart.Series[1];
            NAreaSeries area2 = (NAreaSeries)chart.Series[2];

            area0.DataLabelStyle.Visible = (bool)ShowDataLabelsCheckBox.IsChecked;
            area1.DataLabelStyle.Visible = (bool)ShowDataLabelsCheckBox.IsChecked;
            area2.DataLabelStyle.Visible = (bool)ShowDataLabelsCheckBox.IsChecked;

            FirstAreaDataLabelsComboBox.IsEnabled  = (bool)ShowDataLabelsCheckBox.IsChecked;
            SecondAreaDataLabelsComboBox.IsEnabled = (bool)ShowDataLabelsCheckBox.IsChecked;
            ThirdAreaDataLabelsComboBox.IsEnabled  = (bool)ShowDataLabelsCheckBox.IsChecked;

            nChartControl1.Refresh();
        }
Пример #29
0
        void GenerateData(NAreaSeries series)
        {
            int    randSeed = int.Parse(HiddenField1.Value);
            Random rand     = new Random(randSeed);

            series.Values.Clear();
            series.XValues.Clear();

            double xvalue = 10;

            for (int i = 0; i < 16; i++)
            {
                double value = Math.Sin(i * 0.6) * 5 + rand.NextDouble() * 3;
                xvalue += 1 + rand.NextDouble() * 20;

                series.Values.Add(value);
                series.XValues.Add(xvalue);
            }
        }
Пример #30
0
        private void AddTurn(NAreaSeries area, int count)
        {
            Random rand     = new Random();
            double prevYVal = 2;
            double prevXVal = 2;

            double angle     = 0;
            double phase     = (Math.PI * 2 * rand.NextDouble()) / count + 0.0001;
            double magnitude = rand.NextDouble() * 5;

            double[] xValues = new double[count];
            double[] yValues = new double[count];

            int valueCount = area.Values.Count;

            if (valueCount > 0)
            {
                prevYVal = (double)area.Values[valueCount - 1];
                prevXVal = (double)area.XValues[valueCount - 1];
            }

            for (int i = 0; i < count; i++)
            {
                double yStep = Math.Sin(angle) * magnitude;
                double xStep = rand.NextDouble() * magnitude;

                if (xStep < 0)
                {
                    xStep = 0;
                }

                angle    += phase;
                prevXVal += xStep;

                yValues[i] = prevYVal + yStep;
                xValues[i] = prevXVal;
            }

            area.Values.AddRange(yValues);
            area.XValues.AddRange(xValues);
        }