Example #1
0
        private void GenerateDataButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            GenerateData(floatBar);
            nChartControl1.Refresh();
        }
Example #2
0
            public void ConfigureChart(NCartesianChart chart)
            {
                NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

                ordinalScale.MajorTickMode = MajorTickMode.CustomStep;
                ordinalScale.LabelStyle.ContentAlignment = ContentAlignment.TopCenter;
                ordinalScale.CustomStep = 1;
                ordinalScale.AutoLabels = false;

                NFloatBarSeries floatBar = new NFloatBarSeries();

                floatBar.DataLabelStyle.Visible = false;
                floatBar.WidthPercent           = 50;
                chart.Series.Add(floatBar);

                for (int i = 0; i < m_Tasks.Count; i++)
                {
                    Task task = m_Tasks[i];

                    ordinalScale.Labels.Add(task.Label);
                    floatBar.BeginValues.Add(task.Begin.ToOADate());
                    floatBar.EndValues.Add(task.End.ToOADate());

                    if (task.NextTasks != null)
                    {
                        floatBar.NextTasks.Add(i, task.NextTasks);
                    }
                }
            }
Example #3
0
        private void FloatbarDepthScroll_Scroll(object sender, Nevron.UI.WinForm.Controls.ScrollBarEventArgs e)
        {
            NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[1];

            floatbar.DepthPercent = FloatbarDepthScroll.Value;
            nChartControl1.Refresh();
        }
        private void WidthPercentScrollBar_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs <double> e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatBar.WidthPercent = (float)WidthPercentScrollBar.Value * 100.0f;
            nChartControl1.Refresh();
        }
Example #5
0
        private void ShowGanttConnectorLinesCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatBar.ShowGanttConnectorLines = ShowGanttConnectorLinesCheckBox.Checked;
            nChartControl1.Refresh();
        }
        private void GenerateData(NFloatBarSeries floatBar)
        {
            const int nCount = 6;

            floatBar.Values.Clear();
            floatBar.EndValues.Clear();
            floatBar.XValues.Clear();

            // generate Y values
            for (int i = 0; i < nCount; i++)
            {
                double dBeginValue = Random.NextDouble() * 5;
                double dEndValue   = dBeginValue + 2 + Random.NextDouble();
                floatBar.Values.Add(dBeginValue);
                floatBar.EndValues.Add(dEndValue);
            }

            // generate X values
            DateTime dt = new DateTime(2007, 5, 24, 11, 0, 0);

            for (int i = 0; i < nCount; i++)
            {
                dt = dt.AddHours(12 + Random.NextDouble() * 60);

                floatBar.XValues.Add(dt);
            }
        }
Example #7
0
        private void BarStyleCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatBar.BarShape = (BarShape)BarShapeCombo.SelectedIndex;
            nChartControl1.Refresh();
        }
        private void BarShapeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatBar.BarShape = (BarShape)BarShapeComboBox.SelectedIndex;
            nChartControl1.Refresh();
        }
Example #9
0
        private void InitChart()
        {
            m_Chart = nChartControl1.Charts[0];

            nChartControl1.Controller.Selection.Add(m_Chart);

            nChartControl1.Controller.Tools.Add(new NDataPanTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Multi Page Printing");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.MiddleCenter;
            title.DockMargins         = new NMarginsL(5, 5, 5, 5);
            title.DockMode            = PanelDockMode.Top;

            nChartControl1.Legends[0].Mode = LegendMode.Disabled;

            // setup chart
            m_Chart.BoundsMode  = BoundsMode.Stretch;
            m_Chart.DockMode    = PanelDockMode.Fill;
            m_Chart.DockMargins = new NMarginsL(15, 20, 30, 20);

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

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2;
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator             = dateTimeScale;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible             = true;
            m_Chart.Axis(StandardAxis.PrimaryX).ScrollBar.ResetButton.Visible = false;
            m_Chart.BringToFront();

            // create the float bar series
            m_FloatBar                        = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar);
            m_FloatBar.UseXValues             = true;
            m_FloatBar.UseZValues             = false;
            m_FloatBar.InflateMargins         = true;
            m_FloatBar.DataLabelStyle.Visible = false;

            // bar appearance
            m_FloatBar.BorderStyle.Color = Color.Bisque;
            m_FloatBar.FillStyle         = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightGray, Color.DarkBlue);
            m_FloatBar.ShadowStyle.Type  = ShadowType.Solid;
            m_FloatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0);

            m_FloatBar.Values.ValueFormatter    = new NNumericValueFormatter("0.00");
            m_FloatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00");

            // show the begin end values in the legend
            m_FloatBar.Legend.Format = "<begin> - <end>";
            m_FloatBar.Legend.Mode   = SeriesLegendMode.DataPoints;

            GenerateData();

            m_PrintManager = new NPrintManager(nChartControl1.Document);
        }
        private void btnChangeData_Click(object sender, System.EventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            GenerateData(floatBar);

            nChartControl1.Refresh();
        }
Example #11
0
/*		protected Label Label1;
 *              protected Label Label2;
 *              protected Label Label3;
 *              protected DropDownList BarStyleDropDownList;
 *              protected DropDownList WidthPercentDropDownList;
 *              protected DropDownList DepthPercentDropDownList;*/

        protected void Page_Load(object sender, EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            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.BoundsMode = BoundsMode.Stretch;

            // setup Y axis
            NLinearScaleConfigurator scaleY = (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);
            scaleY.StripStyles.Add(stripStyle);

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

            scaleX.LabelStyle.Angle = new NScaleLabelAngle(90);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;

            // create the float bar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.UseXValues               = true;
            floatBar.UseZValues               = false;
            floatBar.InflateMargins           = true;
            floatBar.DataLabelStyle.Visible   = false;
            floatBar.ShadowStyle.Type         = ShadowType.Solid;
            floatBar.ShadowStyle.Color        = Color.FromArgb(30, 0, 0, 0);
            floatBar.Values.ValueFormatter    = new NNumericValueFormatter("0.0");
            floatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.0");

            // show the begin end values in the legend
            floatBar.Legend.Format = "<begin> - <end>";
            floatBar.Legend.Mode   = SeriesLegendMode.DataPoints;

            GenerateData(floatBar);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
Example #12
0
        private void InitChart()
        {
            m_Chart = nChartControl1.Charts[0];

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

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

            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.Width      = 90;
            m_Chart.BoundsMode = BoundsMode.Stretch;
            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(70, NRelativeUnit.ParentPercentage));

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

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

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;
            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2;

            // create the float bar series
            m_FloatBar                        = (NFloatBarSeries)m_Chart.Series.Add(SeriesType.FloatBar);
            m_FloatBar.UseXValues             = true;
            m_FloatBar.UseZValues             = false;
            m_FloatBar.InflateMargins         = true;
            m_FloatBar.DataLabelStyle.Visible = false;

            // bar appearance
            m_FloatBar.BorderStyle.Color = Color.Bisque;
            m_FloatBar.FillStyle         = new NGradientFillStyle(Nevron.GraphicsCore.GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightGray, Color.DarkBlue);
            m_FloatBar.ShadowStyle.Type  = ShadowType.Solid;
            m_FloatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0);

            m_FloatBar.Values.ValueFormatter    = new NNumericValueFormatter("0.00");
            m_FloatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00");

            // show the begin end values in the legend
            m_FloatBar.Legend.Format = "<begin> - <end>";
            m_FloatBar.Legend.Mode   = SeriesLegendMode.DataPoints;

            m_PrintManager = new NPrintManager(nChartControl1.Document);

            GenerateData();
        }
        private void GanntConnectLinesStrokeButton_Click(object sender, EventArgs e)
        {
            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];
            NStrokeStyle    strokeStyleResult;

            if (NStrokeStyleTypeEditor.Edit(floatBar.GanttConnectorLineStrokeStyle, out strokeStyleResult))
            {
                floatBar.GanttConnectorLineStrokeStyle = strokeStyleResult;
                nChartControl1.Refresh();
            }
        }
Example #14
0
        private void BarShapeCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];
            NBarSeries      bar1     = (NBarSeries)nChartControl1.Charts[0].Series[1];
            NBarSeries      bar2     = (NBarSeries)nChartControl1.Charts[0].Series[2];

            BarShape selectedShape = (BarShape)BarShapeCombo.SelectedIndex;

            floatbar.BarShape = selectedShape;
            bar1.BarShape     = selectedShape;
            bar2.BarShape     = selectedShape;

            nChartControl1.Refresh();
        }
Example #15
0
        private void GenerateXData()
        {
            NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatbar.XValues.Clear();

            // generate X values
            DateTime dt = new DateTime(2007, 5, 24, 11, 0, 0);

            for (int i = 0; i < dataPointCount; i++)
            {
                dt = dt.AddHours(12 + Random.NextDouble() * 60);

                floatbar.XValues.Add(dt);
            }
        }
Example #16
0
        private void GeneratePosNegData()
        {
            NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];
            NBarSeries      bar1     = (NBarSeries)nChartControl1.Charts[0].Series[1];
            NBarSeries      bar2     = (NBarSeries)nChartControl1.Charts[0].Series[2];

            floatbar.BeginValues.Clear();
            floatbar.EndValues.Clear();
            bar1.Values.Clear();
            bar2.Values.Clear();

            for (int i = 0; i < dataPointCount; i++)
            {
                floatbar.BeginValues.Add(GetRandValue(-10, 10));
                floatbar.EndValues.Add(SetRandSign(GetRandValue(10, 20)));
                bar1.Values.Add(SetRandSign(GetRandValue(5, 10)));
                bar2.Values.Add(SetRandSign(GetRandValue(5, 10)));
            }
        }
Example #17
0
        private void GeneratePosData()
        {
            NFloatBarSeries floatbar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];
            NBarSeries      bar1     = (NBarSeries)nChartControl1.Charts[0].Series[1];
            NBarSeries      bar2     = (NBarSeries)nChartControl1.Charts[0].Series[2];

            floatbar.BeginValues.Clear();
            floatbar.EndValues.Clear();
            bar1.Values.Clear();
            bar2.Values.Clear();

            for (int i = 0; i < dataPointCount; i++)
            {
                floatbar.BeginValues.Add(GetRandValue(1, 4));
                floatbar.EndValues.Add(GetRandValue(6, 9));
                bar1.Values.Add(GetRandValue(3, 7));
                bar2.Values.Add(GetRandValue(3, 7));
            }
        }
Example #18
0
        private void InitChart()
        {
            NChart chart = nChartControl1.Charts[0];

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

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

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Custom Printing");

            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 the bar series
            NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar.Name      = "Bar series";
            bar.FillStyle = new NColorFillStyle(Color.Green);
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 8, 7, 15);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered;
            floatbar.Name      = "Floatbar series";
            floatbar.FillStyle = new NColorFillStyle(Color.SandyBrown);
            floatbar.DataLabelStyle.Visible = false;

            floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3));
            floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2));
        }
        private void SeriesTypeCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (nChartControl1 == null)
            {
                return;
            }

            NChart  chart  = nChartControl1.Charts[0];
            NSeries series = null;

            chart.Series.Clear();

            switch (SeriesTypeCombo.SelectedIndex)
            {
            case 0:
                series = (NSeries)chart.Series.Add(SeriesType.FloatBar);
                NFloatBarSeries bar = (NFloatBarSeries)series;
                GenerateData(bar.Values, bar.EndValues, 10, 3);
                break;

            case 1:
                series = (NSeries)chart.Series.Add(SeriesType.HighLow);
                NHighLowSeries highLow = (NHighLowSeries)series;
                GenerateData(highLow.HighValues, highLow.LowValues, 10, 3);
                break;
            }

            series.Values.ValueFormatter = new NNumericValueFormatter("0.00");
            series.Legend.Mode           = SeriesLegendMode.DataPoints;

            nChartControl1.Refresh();

            ValueModeCombo.SelectedIndex      = 0;
            AppearanceModeCombo.SelectedIndex = 0;
            MarkerModeCombo.SelectedIndex     = 0;
            ShowLabelsCheck.Checked           = false;
            CustomValue.Text = "0";
        }
Example #20
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Floating Bars");

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

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

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

            chart.Enable3D = true;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft);

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

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

            // add interlaced stripe to the 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.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };
            stripStyle.Interlaced  = true;
            linearScale.StripStyles.Add(stripStyle);

            // create the float bar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.DataLabelStyle.Visible   = false;
            floatBar.DataLabelStyle.VertAlign = VertAlign.Center;
            floatBar.DataLabelStyle.Format    = "<begin> - <end>";

            // add bars
            floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10));
            floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16));
            floatBar.AddDataPoint(new NFloatBarDataPoint(9, 17));
            floatBar.AddDataPoint(new NFloatBarDataPoint(12, 21));
            floatBar.AddDataPoint(new NFloatBarDataPoint(8, 18));
            floatBar.AddDataPoint(new NFloatBarDataPoint(7, 18));
            floatBar.AddDataPoint(new NFloatBarDataPoint(3, 11));
            floatBar.AddDataPoint(new NFloatBarDataPoint(5, 12));
            floatBar.AddDataPoint(new NFloatBarDataPoint(8, 17));
            floatBar.AddDataPoint(new NFloatBarDataPoint(6, 15));
            floatBar.AddDataPoint(new NFloatBarDataPoint(3, 10));
            floatBar.AddDataPoint(new NFloatBarDataPoint(1, 7));

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

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            BarShapeCombo.FillFromEnum(typeof(BarShape));
            BarShapeCombo.SelectedIndex = 0;
        }
Example #21
0
        private void ChartTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            NChart chart = nChartControl1.Charts[0];

            chart.Series.Clear();
            const int numDataPoints = 50;

            switch (ChartTypeComboBox.SelectedIndex)
            {
            case 0:                     // Area
            {
                NAreaSeries area = new NAreaSeries();
                area.DataLabelStyle.Visible = false;
                area.VerticalAxisRangeMode  = AxisRangeMode.ViewRange;

                GenerateData(area, 100.0, numDataPoints, new NRange1DD(60, 140));
                chart.Series.Add(area);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NValueTimelineScaleConfigurator();
            }
            break;

            case 1:                     // Bar
            {
                NBarSeries bar = new NBarSeries();
                bar.DataLabelStyle.Visible = false;
                bar.VerticalAxisRangeMode  = AxisRangeMode.ViewRange;

                GenerateData(bar, 100.0, numDataPoints, new NRange1DD(60, 140));
                chart.Series.Add(bar);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NValueTimelineScaleConfigurator();
            }
            break;

            case 2:                     // Box And Whiskers
            {
                NBoxAndWhiskersSeries boxAndWhiskers = new NBoxAndWhiskersSeries();
                boxAndWhiskers.VerticalAxisRangeMode = AxisRangeMode.ViewRange;

                for (int i = 0; i < 40; i++)
                {
                    double boxLower      = 1000 + Random.NextDouble() * 200;
                    double boxUpper      = boxLower + 200 + Random.NextDouble() * 200;
                    double whiskersLower = boxLower - (20 + Random.NextDouble() * 300);
                    double whiskersUpper = boxUpper + (20 + Random.NextDouble() * 300);

                    double IQR     = (boxUpper - boxLower);
                    double median  = boxLower + IQR * 0.25 + Random.NextDouble() * IQR * 0.5;
                    double average = boxLower + IQR * 0.25 + Random.NextDouble() * IQR * 0.5;

                    boxAndWhiskers.UpperBoxValues.Add(boxUpper);
                    boxAndWhiskers.LowerBoxValues.Add(boxLower);
                    boxAndWhiskers.UpperWhiskerValues.Add(whiskersUpper);
                    boxAndWhiskers.LowerWhiskerValues.Add(whiskersLower);
                    boxAndWhiskers.MedianValues.Add(median);
                    boxAndWhiskers.AverageValues.Add(average);

                    int outliersCount = Random.Next(5);

                    NDoubleList outliers = new NDoubleList();

                    for (int k = 0; k < outliersCount; k++)
                    {
                        double dOutlier = 0;

                        if (Random.NextDouble() > 0.5)
                        {
                            dOutlier = boxUpper + IQR * 1.5 + Random.NextDouble() * 100;
                        }
                        else
                        {
                            dOutlier = boxLower - IQR * 1.5 - Random.NextDouble() * 100;
                        }

                        outliers.Add(dOutlier);
                    }

                    boxAndWhiskers.OutlierValues.Add(outliers);
                }

                chart.Series.Add(boxAndWhiskers);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
            }
            break;

            case 3:                     // Error Bar
            {
                NErrorBarSeries errorBar = new NErrorBarSeries();
                errorBar.VerticalAxisRangeMode = AxisRangeMode.ViewRange;

                double y;
                double x = 50.0;

                for (int i = 0; i < 50; i++)
                {
                    y  = 20 + Random.NextDouble() * 30;
                    x += 2.0 + Random.NextDouble() * 2;

                    errorBar.Values.Add(y);
                    errorBar.LowerErrorsY.Add(1 + Random.NextDouble());
                    errorBar.UpperErrorsY.Add(1 + Random.NextDouble());

                    errorBar.XValues.Add(x);
                    errorBar.LowerErrorsX.Add(1 + Random.NextDouble());
                    errorBar.UpperErrorsX.Add(1 + Random.NextDouble());
                }

                chart.Series.Add(errorBar);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
            }
            break;

            case 4:                     // "Float Bar");
            {
                NFloatBarSeries floatBar = new NFloatBarSeries();

                floatBar.VerticalAxisRangeMode = AxisRangeMode.ViewRange;

                // generate Y values
                for (int i = 0; i < 100; i++)
                {
                    double dBeginValue = Random.NextDouble() * 5;
                    double dEndValue   = dBeginValue + 2 + Random.NextDouble();
                    floatBar.Values.Add(dBeginValue);
                    floatBar.EndValues.Add(dEndValue);
                }

                // generate X values
                DateTime dt = new DateTime(2007, 5, 24, 11, 0, 0);

                for (int i = 0; i < 100; i++)
                {
                    dt = dt.AddHours(12 + Random.NextDouble() * 60);

                    floatBar.XValues.Add(dt);
                }

                chart.Series.Add(floatBar);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NValueTimelineScaleConfigurator();
            }
            break;

            case 5:                     // Line
            {
                NLineSeries line = new NLineSeries();
                line.DataLabelStyle.Visible = false;
                line.VerticalAxisRangeMode  = AxisRangeMode.ViewRange;

                GenerateData(line, 100.0, numDataPoints, new NRange1DD(60, 140));
                chart.Series.Add(line);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NValueTimelineScaleConfigurator();
            }
            break;

            case 6:                     // Point
            {
                NPointSeries point = new NPointSeries();
                point.DataLabelStyle.Visible = false;
                point.VerticalAxisRangeMode  = AxisRangeMode.ViewRange;
                point.Size = new NLength(5);

                GenerateData(point, 100.0, numDataPoints, new NRange1DD(60, 140));
                chart.Series.Add(point);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
            }
            break;

            case 7:                     // Stock
            {
                // setup stock series
                NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock);
                stock.DataLabelStyle.Visible   = false;
                stock.UpFillStyle              = new NColorFillStyle(Color.White);
                stock.UpStrokeStyle.Color      = Color.Black;
                stock.DownFillStyle            = new NColorFillStyle(Color.Crimson);
                stock.DownStrokeStyle.Color    = Color.Crimson;
                stock.HighLowStrokeStyle.Color = Color.Black;
                stock.CandleWidth              = new NLength(1.2f, NRelativeUnit.ParentPercentage);
                stock.UseXValues            = true;
                stock.InflateMargins        = true;
                stock.VerticalAxisRangeMode = AxisRangeMode.ViewRange;

                // add some stock items
                GenerateOHLCData(stock, 100.0, numDataPoints, new NRange1DD(60, 140));
                FillStockDates(stock, numDataPoints);
                chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NValueTimelineScaleConfigurator();
            }
            break;
            }

            nChartControl1.Refresh();
        }
Example #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;
            nChartControl1.Settings.JitterMode = JitterMode.Enabled;

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

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

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

            chart.Enable3D = true;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

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

            scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;

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

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

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

            bar.Name = "Bar";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 8, 7, 15);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered;
            floatbar.Name = "Floatbar";
            floatbar.DataLabelStyle.Visible = false;

            floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3));
            floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2));

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Gantt");

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

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

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

            chart.BoundsMode = BoundsMode.Stretch;
            chart.Projection.ViewerRotation        = 270;
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the value axis
            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelValueFormatter        = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };

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

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

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale;
            chart.Axis(StandardAxis.PrimaryY).Anchor            = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100);

            // label the X axis
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.AutoLabels = false;
            ordinalScale.Labels.Add("Market Research");
            ordinalScale.Labels.Add("Specifications");
            ordinalScale.Labels.Add("Architecture");
            ordinalScale.Labels.Add("Project Planning");
            ordinalScale.Labels.Add("Detailed Design");
            ordinalScale.Labels.Add("Development");
            ordinalScale.Labels.Add("Test Plan");
            ordinalScale.Labels.Add("Testing and QA");
            ordinalScale.Labels.Add("Documentation");

            // create a floatbar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.BeginValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.EndValues.ValueFormatter   = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.DataLabelStyle.Visible     = false;

            AddDataPoint(floatBar, new DateTime(2009, 2, 2), new DateTime(2009, 2, 16));
            AddDataPoint(floatBar, new DateTime(2009, 2, 16), new DateTime(2009, 3, 2));
            AddDataPoint(floatBar, new DateTime(2009, 3, 2), new DateTime(2009, 3, 16));
            AddDataPoint(floatBar, new DateTime(2009, 3, 9), new DateTime(2009, 3, 23));
            AddDataPoint(floatBar, new DateTime(2009, 3, 16), new DateTime(2009, 3, 30));
            AddDataPoint(floatBar, new DateTime(2009, 3, 23), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 13), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 20), new DateTime(2009, 5, 4));
            AddDataPoint(floatBar, new DateTime(2009, 4, 27), new DateTime(2009, 5, 4));

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
 private void AddDataPoint(NFloatBarSeries floatBar, DateTime dtBegin, DateTime dtEnd)
 {
     floatBar.BeginValues.Add(dtBegin.ToOADate());
     floatBar.EndValues.Add(dtEnd.ToOADate());
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithPercents(WidthPercentDropDownList, 10);
                WidthPercentDropDownList.SelectedIndex = 7;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            // setup legend
            NLegend legend = nChartControl1.Legends[0];

            legend.HorizontalBorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel);
            legend.VerticalBorderStyle.Width   = new NLength(0, NGraphicsUnit.Pixel);

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

            chart.BoundsMode = BoundsMode.Stretch;
            chart.Projection.ViewerRotation = 270;

            // setup the value axis
            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.EnableUnitSensitiveFormatting = false;
            dateTimeScale.LabelValueFormatter           = new NDateTimeValueFormatter("d MMM");
            dateTimeScale.MajorTickMode = MajorTickMode.CustomStep;
            dateTimeScale.CustomStep    = new NDateTimeSpan(1, NDateTimeUnit.Week);
            dateTimeScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);
            dateTimeScale.LabelStyle.Angle           = new NScaleLabelAngle(90);
            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };

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

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

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale;
            chart.Axis(StandardAxis.PrimaryY).Anchor            = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100);

            // label the X axis
            NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

            ordinalScale.MajorGridStyle.ShowAtWalls            = new ChartWallType[] { ChartWallType.Back };
            ordinalScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);
            ordinalScale.MajorTickMode = MajorTickMode.AutoMaxCount;
            ordinalScale.AutoLabels    = false;
            ordinalScale.Labels.Add("Market Research");
            ordinalScale.Labels.Add("Specifications");
            ordinalScale.Labels.Add("Architecture");
            ordinalScale.Labels.Add("Project Planning");
            ordinalScale.Labels.Add("Detailed Design");
            ordinalScale.Labels.Add("Development");
            ordinalScale.Labels.Add("Test Plan");
            ordinalScale.Labels.Add("Testing and QA");
            ordinalScale.Labels.Add("Documentation");

            // create a floatbar series
            NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatBar.BeginValues.ValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.EndValues.ValueFormatter   = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            floatBar.DataLabelStyle.Visible     = false;

            AddDataPoint(floatBar, new DateTime(2009, 2, 2), new DateTime(2009, 2, 16));
            AddDataPoint(floatBar, new DateTime(2009, 2, 16), new DateTime(2009, 3, 2));
            AddDataPoint(floatBar, new DateTime(2009, 3, 2), new DateTime(2009, 3, 16));
            AddDataPoint(floatBar, new DateTime(2009, 3, 9), new DateTime(2009, 3, 23));
            AddDataPoint(floatBar, new DateTime(2009, 3, 16), new DateTime(2009, 3, 30));
            AddDataPoint(floatBar, new DateTime(2009, 3, 23), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 13), new DateTime(2009, 4, 27));
            AddDataPoint(floatBar, new DateTime(2009, 4, 20), new DateTime(2009, 5, 4));
            AddDataPoint(floatBar, new DateTime(2009, 4, 27), new DateTime(2009, 5, 4));

            floatBar.WidthPercent = WidthPercentDropDownList.SelectedIndex * 10;

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

            styleSheet.Apply(nChartControl1.Document);

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

            // set a chart title
            NLabel title = new NLabel("DateTime Float Bar");

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            // setup Y axis
            NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator();

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

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

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

            // setup x axis
            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

            // create the float bar series
            NFloatBarSeries floatBar = new NFloatBarSeries();

            chart.Series.Add(floatBar);
            floatBar.UseXValues             = true;
            floatBar.UseZValues             = false;
            floatBar.InflateMargins         = true;
            floatBar.DataLabelStyle.Visible = false;

            // bar appearance
            floatBar.BorderStyle.Color = Color.Bisque;
            floatBar.ShadowStyle.Type  = ShadowType.Solid;
            floatBar.ShadowStyle.Color = Color.FromArgb(30, 0, 0, 0);

            floatBar.Values.ValueFormatter    = new NNumericValueFormatter("0.00");
            floatBar.EndValues.ValueFormatter = new NNumericValueFormatter("0.00");

            // show the begin end values in the legend
            floatBar.Legend.Format = "<begin> - <end>";
            floatBar.Legend.Mode   = SeriesLegendMode.DataPoints;

            GenerateData(floatBar);

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Example #27
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Cluster Float Bar");

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

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

            chart.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

            // add interlaced stripe to the Y axis
            NLinearScaleConfigurator scaleY     = 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;
            scaleY.StripStyles.Add(stripStyle);

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

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

            bar.Name = "Bar series";
            bar.DataLabelStyle.Visible = false;
            bar.Values.FillRandomRange(Random, 8, 7, 15);

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Clustered;
            floatbar.Name = "Floatbar series";
            floatbar.DataLabelStyle.Visible = false;

            floatbar.AddDataPoint(new NFloatBarDataPoint(3.1, 5.2));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 6.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.0, 6.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.3, 7.3));
            floatbar.AddDataPoint(new NFloatBarDataPoint(3.8, 8.4));
            floatbar.AddDataPoint(new NFloatBarDataPoint(4.0, 7.7));
            floatbar.AddDataPoint(new NFloatBarDataPoint(2.9, 4.1));
            floatbar.AddDataPoint(new NFloatBarDataPoint(5.0, 7.2));

            // init form controls
            BarGapScroll.Value        = (int)bar.GapPercent;
            BarWidthScroll.Value      = (int)bar.WidthPercent;
            BarDepthScroll.Value      = (int)bar.DepthPercent;
            FloatbarGapScroll.Value   = (int)floatbar.GapPercent;
            FloatbarDepthScroll.Value = (int)floatbar.DepthPercent;

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

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

            styleSheet.Apply(nChartControl1.Document);
        }
Example #28
0
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Date Time Stack Float Bar");

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            // add interlaced stripe
            NLinearScaleConfigurator linearScale = 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;
            linearScale.StripStyles.Add(stripStyle);
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale;

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();

            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Series;
            floatbar.Name = "Floatbar series";
            floatbar.DataLabelStyle.Visible = false;
            floatbar.UseXValues             = true;
            floatbar.InflateMargins         = true;

            // setup the bar series
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.Name                   = "Bar series";
            bar1.MultiBarMode           = MultiBarMode.Stacked;
            bar1.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.Name                   = "Bar series";
            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.DataLabelStyle.Visible = false;

            GeneratePosData();
            GenerateXData();

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

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            BarShapeCombo.FillFromEnum(typeof(BarShape));
            BarShapeCombo.SelectedIndex = 0;
        }
        public override void Initialize()
        {
            base.Initialize();

            // set a chart title
            NLabel title = new NLabel("Stack Float Bar");

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

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

            chart.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

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

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

            // setup the floatbar series
            NFloatBarSeries floatbar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);

            floatbar.MultiFloatBarMode = MultiFloatBarMode.Series;
            floatbar.Name      = "Floatbar series";
            floatbar.FillStyle = new NColorFillStyle(Color.SandyBrown);
            floatbar.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar1.Name                   = "Bar series";
            bar1.MultiBarMode           = MultiBarMode.Stacked;
            bar1.FillStyle              = new NColorFillStyle(Color.Green);
            bar1.DataLabelStyle.Visible = false;

            // setup the bar series
            NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);

            bar2.Name                   = "Bar series";
            bar2.MultiBarMode           = MultiBarMode.Stacked;
            bar2.FillStyle              = new NColorFillStyle(Color.CornflowerBlue);
            bar2.DataLabelStyle.Visible = false;

            GeneratePosData();

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

            // init form controls
            BarShapeCombo.FillFromEnum(typeof(BarShape));
            BarShapeCombo.SelectedIndex = 0;

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

            styleSheet.Apply(nChartControl1.Document);
        }
        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("Float Bar Connector Lines");

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

            chart.BoundsMode = BoundsMode.Stretch;
            chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup the value axis
            NRangeTimelineScaleConfigurator dateTimeScale = new NRangeTimelineScaleConfigurator();

            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };

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

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

            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = dateTimeScale;
            chart.Axis(StandardAxis.PrimaryY).Anchor            = new NDockAxisAnchor(AxisDockZone.FrontRight, true, 0, 100);

            // fill data
            DateTime start = DateTime.Now;
            DateTime end   = start + new TimeSpan(10, 0, 0, 0);

            TaskCollection tasks = new TaskCollection();

            tasks.Add(new Task("Write Proposal",
                               new DateTime(2001, 4, 1),
                               new DateTime(2001, 4, 5),
                               new uint[] { 1, 2 }));

            tasks.Add(new Task("Obtain Approval",
                               new DateTime(2001, 4, 12),
                               new DateTime(2001, 9, 4),
                               new uint[] { 9 }));

            tasks.Add(new Task("Requirements Analysis",
                               new DateTime(2001, 4, 9),
                               new DateTime(2001, 5, 5),
                               new uint[] { 3 }));

            tasks.Add(new Task("Design Phase",
                               new DateTime(2001, 5, 6),
                               new DateTime(2001, 5, 30),
                               new uint[] { 4 }));

            tasks.Add(new Task("Design Signoff",
                               new DateTime(2001, 6, 2),
                               new DateTime(2001, 6, 2),
                               new uint[] { 5 }));

            tasks.Add(new Task("Alpha Implementation",
                               new DateTime(2001, 6, 3),
                               new DateTime(2001, 7, 31),
                               new uint[] { 6 }));

            tasks.Add(new Task("Design Review",
                               new DateTime(2001, 8, 1),
                               new DateTime(2001, 8, 8),
                               new uint[] { 7 }));

            tasks.Add(new Task("Revised Design Signoff",
                               new DateTime(2001, 8, 10),
                               new DateTime(2001, 8, 10),
                               new uint[] { 8 }));

            tasks.Add(new Task("Beta Implementation",
                               new DateTime(2001, 8, 12),
                               new DateTime(2001, 9, 12),
                               new uint[] { 9 }));

            tasks.Add(new Task("Testing",
                               new DateTime(2001, 9, 13),
                               new DateTime(2001, 10, 31),
                               new uint[] { 10 }));

            tasks.Add(new Task("Final Implementation",
                               new DateTime(2001, 11, 1),
                               new DateTime(2001, 11, 15),
                               new uint[] { 11 }));

            tasks.Add(new Task("Signoff",
                               new DateTime(2001, 11, 28),
                               new DateTime(2001, 11, 30),
                               new uint[] { 12 }));

            tasks.ConfigureChart(chart);

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

            styleSheet.Apply(nChartControl1.Document);

            // apply layout
            ApplyLayoutTemplate(0, nChartControl1, chart, title, null);

            NFloatBarSeries floatBar = (NFloatBarSeries)nChartControl1.Charts[0].Series[0];

            floatBar.ShowGanttConnectorLines = ShowGanttConnectorLinesCheckBox.Checked;
        }