Exemple #1
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

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

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

            // create the radial gauge
            CreateRadialGauge();

            // create the linear gauge
            CreateLinearGauge();

            // update form controls
            NExampleHelpers.BindComboToItemSource(CustomAngleNumericComboBox, 0, 360, 10);
            CustomAngleNumericComboBox.SelectedItem = 0;

            NExampleHelpers.FillComboWithEnumValues(AngleModeComboBox, typeof(ScaleLabelAngleMode));
            AngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.View;

            BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle;
            SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle;

            LinearGaugeOrientationComboBox.Items.Add("Horizontal");
            LinearGaugeOrientationComboBox.Items.Add("Vertical");
            LinearGaugeOrientationComboBox.SelectedIndex = 1;
        }
Exemple #2
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Smooth Area");

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

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

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

            // add the area series
            NSmoothAreaSeries area = (NSmoothAreaSeries)chart.Series.Add(SeriesType.SmoothArea);

            area.DataLabelStyle.Visible = false;
            area.MarkerStyle.Visible    = true;
            area.MarkerStyle.PointShape = PointShape.Cylinder;
            area.MarkerStyle.AutoDepth  = true;
            area.MarkerStyle.Width      = new NLength(1.4f, NRelativeUnit.ParentPercentage);
            area.MarkerStyle.Height     = new NLength(1.4f, NRelativeUnit.ParentPercentage);

            GenreateYValues(nValuesCount);

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

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

            styleSheet.Apply(nChartControl1.Document);

            // configure interactivity
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            // init form controls
            ShowMarkersCheckBox.IsChecked   = true;
            ShowDropLinesCheckBox.IsChecked = false;
            NExampleHelpers.FillComboWithEnumValues(AreaOriginModeComboBox, typeof(SeriesOriginMode));
            AreaOriginModeComboBox.SelectedIndex = 0;
            OriginValueTextBox.Text = "0";
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Dragging Gauge Indicators");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = System.Drawing.ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            nChartControl1.Panels.Add(CreateHorizontalLinearGauge());
            nChartControl1.Panels.Add(CreateVerticalLinearGauge());
            nChartControl1.Panels.Add(CreateRadialGauge());

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

            // Init form controls
            IndicatorsSnapModeComboBox.Items.Add("None");
            IndicatorsSnapModeComboBox.Items.Add("Ruler");
            IndicatorsSnapModeComboBox.Items.Add("Major ticks");
            IndicatorsSnapModeComboBox.Items.Add("Minor ticks");
            IndicatorsSnapModeComboBox.Items.Add("Ruler Min/Max");
            IndicatorsSnapModeComboBox.Items.Add("Numeric");

            IndicatorsSnapModeComboBox.SelectedIndex = 0;

            NExampleHelpers.BindComboToItemSource(OriginNumericComboBox, 0, 20, 1);
            OriginNumericComboBox.SelectedItem = 0;
            NExampleHelpers.BindComboToItemSource(StepNumericComboBox, 1, 20, 1);
            StepNumericComboBox.SelectedItem = 1;
        }
Exemple #4
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Axis Sections");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            NExampleHelpers.BindComboToItemSource(BlueSectionBeginComboBox, 0, 100, 5);
            BlueSectionBeginComboBox.SelectedItem = 0;

            NExampleHelpers.BindComboToItemSource(BlueSectionEndComboBox, 0, 100, 5);
            BlueSectionEndComboBox.SelectedItem = 20;

            NExampleHelpers.BindComboToItemSource(RedSectionBeginComboBox, 0, 100, 5);
            RedSectionBeginComboBox.SelectedItem = 80;

            NExampleHelpers.BindComboToItemSource(RedSectionEndComboBox, 0, 100, 5);
            RedSectionEndComboBox.SelectedItem = 100;

            // init form controls
            InitLinearGauge();
            InitRadialGauge();
            m_Timer          = new DispatcherTimer();
            m_Timer.Tick    += m_Timer_Tick;
            m_Timer.Interval = new TimeSpan(100);
            m_Timer.Start();
        }
Exemple #5
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Radar Line");

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

            // configure the chart
            m_Chart = new NRadarChart();
            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(m_Chart);
            m_Chart.Wall(ChartWallType.Radar).BorderStyle.Color = Color.White;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.DisplayOnLegend = nChartControl1.Legends[0];

            // set some axis labels
            AddAxis("Vitamin A");
            AddAxis("Vitamin B1");
            AddAxis("Vitamin B2");
            AddAxis("Vitamin B6");
            AddAxis("Vitamin B12");
            AddAxis("Vitamin C");
            AddAxis("Vitamin D");
            AddAxis("Vitamin E");

            m_Radar1 = new NRadarLineSeries();
            m_Chart.Series.Add(m_Radar1);
            m_Radar1.Name = "Series 1";
            m_Radar1.Values.FillRandomRange(Random, 8, 50, 90);
            m_Radar1.DataLabelStyle.Visible = false;
            m_Radar1.DataLabelStyle.Format  = "<value>";
            m_Radar1.MarkerStyle.Visible    = true;
            m_Radar1.MarkerStyle.PointShape = PointShape.Cylinder;
            m_Radar1.MarkerStyle.Width      = new NLength(1.6f, NRelativeUnit.ParentPercentage);
            m_Radar1.MarkerStyle.Height     = new NLength(1.6f, NRelativeUnit.ParentPercentage);

            m_Radar2 = new NRadarLineSeries();
            m_Chart.Series.Add(m_Radar2);
            m_Radar2.Name = "Series 2";
            m_Radar2.Values.FillRandomRange(Random, 8, 0, 100);
            m_Radar2.DataLabelStyle.Visible = false;
            m_Radar2.DataLabelStyle.Format  = "<value>";
            m_Radar2.MarkerStyle.Visible    = true;
            m_Radar2.MarkerStyle.PointShape = PointShape.Cylinder;
            m_Radar2.MarkerStyle.Width      = new NLength(1.6f, NRelativeUnit.ParentPercentage);
            m_Radar2.MarkerStyle.Height     = new NLength(1.6f, NRelativeUnit.ParentPercentage);

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

            styleSheet.Apply(nChartControl1.Charts[0].Series);

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

            // init form controls
            BeginAngleScrollBar.Value = 90 / 360.0;
            NExampleHelpers.FillComboWithEnumValues(TitleAngleModeComboBox, typeof(ScaleLabelAngleMode));
            TitleAngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.Scale;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Funnel Chart");

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

            NLegend legend = nChartControl1.Legends[0];

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight);

            NFunnelChart chart = new NFunnelChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);

            NFunnelSeries funnel = (NFunnelSeries)chart.Series.Add(SeriesType.Funnel);

            funnel.BorderStyle.Color      = Color.LemonChiffon;
            funnel.Legend.DisplayOnLegend = legend;
            funnel.Legend.Mode            = SeriesLegendMode.DataPoints;
            funnel.DataLabelStyle.Format  = "<percent>";
            funnel.ShadowStyle.Type       = ShadowType.GaussianBlur;
            funnel.ShadowStyle.Color      = Color.FromArgb(50, 0, 0, 0);
            funnel.ShadowStyle.Offset     = new NPointL(5, 5);
            funnel.ShadowStyle.FadeLength = new NLength(6);

            funnel.Values.Add(20.0);
            funnel.Values.Add(10.0);
            funnel.Values.Add(15.0);
            funnel.Values.Add(7.0);
            funnel.Values.Add(28.0);

            funnel.Labels.Add("Awareness");
            funnel.Labels.Add("First Hear");
            funnel.Labels.Add("Further Learn");
            funnel.Labels.Add("Liking");
            funnel.Labels.Add("Decision");

            // apply palette to funnel segments
            NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Fresh);

            for (int i = 0; i < funnel.Values.Count; i++)
            {
                funnel.FillStyles[i] = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]);
            }

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(FunnelLabelModeComboBox, typeof(FunnelLabelMode));
            FunnelLabelModeComboBox.SelectedIndex = 0;

            FunnelPointGapScrollBar.Value   = funnel.FunnelPointGap / 100.0f;
            NeckWidthScrollBar.Value        = funnel.NeckWidthPercent / 100.0f;
            NeckHeightScrollBar.Value       = funnel.NeckHeightPercent / 100.0f;
            LabelArrowLengthScrollBar.Value = funnel.DataLabelStyle.ArrowLength.Value / 100.0f;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("3D Step Line Chart");

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

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

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

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

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

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

            m_Line                        = (NStepLineSeries)m_Chart.Series.Add(SeriesType.StepLine);
            m_Line.Name                   = "Series 1";
            m_Line.DepthPercent           = 50;
            m_Line.LineSize               = 2;
            m_Line.DataLabelStyle.Visible = false;
            m_Line.DataLabelStyle.Format  = "<value>";
            m_Line.MarkerStyle.Visible    = true;
            m_Line.Values.FillRandom(Random, 8);

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

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

            styleSheet.Apply(nChartControl1.Document);

            // configure interactivity
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

            NExampleHelpers.FillComboWithEnumValues(LineStyleComboBox, typeof(LineSegmentShape));
            LineStyleComboBox.SelectedIndex       = 1;
            LeftAxisRoundToTickCheckBox.IsChecked = true;
            InflateMarginsCheckBox.IsChecked      = true;

            LineDepthScrollBar.Value = m_Line.DepthPercent / 100.0f;
            LineSizeScrollBar.Value  = m_Line.LineSize / 10.0f;
        }
Exemple #8
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("3D Line Chart");

            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.Enable3D = true;
            chart.Width    = 65;
            chart.Height   = 40;
            chart.Axis(StandardAxis.Depth).Visible = false;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective2);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);

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

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

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

            line.Name                   = "Line Series";
            line.InflateMargins         = true;
            line.DataLabelStyle.Visible = false;
            line.MarkerStyle.Visible    = true;
            line.MarkerStyle.PointShape = PointShape.Cylinder;
            line.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            line.Values.FillRandom(new Random(), 8);

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

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

            styleSheet.Apply(nChartControl1.Document);

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

            NExampleHelpers.FillComboWithEnumValues(LineStyleComboBox, typeof(LineSegmentShape));
            LineStyleComboBox.SelectedIndex = (int)line.LineSegmentShape;

            AxisRoundToTickCheckBox.IsChecked = true;
            InflateMarginsCheckBox.IsChecked  = true;
        }
Exemple #9
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("3D Bar Chart");

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

            // configure chart
            NCartesianChart chart = (NCartesianChart)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
            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);

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

            bar.Name = "Bar Series";
            bar.DataLabelStyle.Visible = true;
            bar.HasBottomEdge          = false;

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "C++"));
            bar.AddDataPoint(new NDataPoint(15, "Ruby"));
            bar.AddDataPoint(new NDataPoint(21, "Python"));
            bar.AddDataPoint(new NDataPoint(23, "Java"));
            bar.AddDataPoint(new NDataPoint(27, "Javascript"));
            bar.AddDataPoint(new NDataPoint(29, "C#"));
            bar.AddDataPoint(new NDataPoint(26, "PHP"));

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // create a title
            NLabel title = new NLabel("2D Bar Chart");

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

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

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

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

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

            bar.Name = "Bar Series";
            bar.BorderStyle.Width      = new NLength(0, NGraphicsUnit.Pixel);
            bar.ShadowStyle.Type       = ShadowType.GaussianBlur;
            bar.ShadowStyle.Offset     = new NPointL(2, 2);
            bar.ShadowStyle.Color      = Color.FromArgb(80, 0, 0, 0);
            bar.ShadowStyle.FadeLength = new NLength(5);
            bar.HasBottomEdge          = false;

            // add some data to the bar series
            bar.AddDataPoint(new NDataPoint(18, "C++"));
            bar.AddDataPoint(new NDataPoint(15, "Ruby"));
            bar.AddDataPoint(new NDataPoint(21, "Python"));
            bar.AddDataPoint(new NDataPoint(23, "Java"));
            bar.AddDataPoint(new NDataPoint(27, "Javascript"));
            bar.AddDataPoint(new NDataPoint(29, "C#"));
            bar.AddDataPoint(new NDataPoint(26, "PHP"));

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;

            NExampleHelpers.FillComboWithValues(BarEdgePercentComboBox, 0, 50, 10);
            BarEdgePercentComboBox.SelectedIndex = 5;

            HasTopEdgeCheckBox.IsChecked          = bar.HasTopEdge;
            HasBottomEdgeCheckBox.IsChecked       = bar.HasBottomEdge;
            DifferentFIllStylesCheckBox.IsChecked = true;
            DifferentFillStylesCheckBox_Checked(null, null);
        }
Exemple #11
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Panels.Clear();
            nChartControl1.Controller.Tools.Add(new NTooltipTool());

            // set a chart title
            NLabel title = new NLabel("Tree Map");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);
            title.DockMode            = PanelDockMode.Top;
            nChartControl1.Panels.Add(title);

            m_TreeMap = new NTreeMapChart();
            nChartControl1.Panels.Add(m_TreeMap);
            m_TreeMap.DockMode = PanelDockMode.Fill;

            XmlDocument document = LoadData();

            foreach (XmlElement industry in document.DocumentElement)
            {
                NGroupTreeMapNode treeMapSeries = new NGroupTreeMapNode();

                treeMapSeries.StrokeStyle = new NStrokeStyle(4, Color.Black);
                treeMapSeries.Padding     = new NMarginsL(2.0f);

                m_TreeMap.RootTreeMapNode.ChildNodes.Add(treeMapSeries);

                treeMapSeries.Label = industry.Attributes["Name"].Value;
                treeMapSeries.InteractivityStyle = new NInteractivityStyle(treeMapSeries.Label);

                foreach (XmlElement company in industry.ChildNodes)
                {
                    double value  = double.Parse(company.Attributes["Size"].Value);
                    double change = double.Parse(company.Attributes["Change"].Value);
                    string label  = company.Attributes["Name"].Value;

                    NValueTreeMapNode node = new NValueTreeMapNode(value, change, label);
                    node.InteractivityStyle = new NInteractivityStyle(label);
                    //						node.FillStyle = new NColorFillStyle(Color.Green);
                    treeMapSeries.ChildNodes.Add(node);
                }
            }

            NExampleHelpers.FillComboWithEnumValues(VerticalFillModeComboBox, typeof(TreeMapVerticalFillMode));
            VerticalFillModeComboBox.SelectedIndex = (int)TreeMapVerticalFillMode.Default;

            NExampleHelpers.FillComboWithEnumValues(HorizontalFillModeComboBox, typeof(TreeMapHorizontalFillMode));
            HorizontalFillModeComboBox.SelectedIndex = (int)TreeMapVerticalFillMode.Default;

            ColorFillModeComboBox.Items.Add("Custom");
            ColorFillModeComboBox.Items.Add("Common Palette");
            ColorFillModeComboBox.Items.Add("Group Palette");
            ColorFillModeComboBox.SelectedIndex = 1;
        }
Exemple #12
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Gauge Glass and Gel Effects");

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

            // create the radial gauge
            CreateRadialGauge();

            // create the linear gauge
            CreateLinearGauge();


            // update form controls
            NExampleHelpers.BindComboToItemSource(LeftMarginComboBox, 0, 100, 5);
            LeftMarginComboBox.SelectedItem = 5;

            NExampleHelpers.BindComboToItemSource(TopMarginComboBox, 0, 100, 5);
            TopMarginComboBox.SelectedItem = 5;

            NExampleHelpers.BindComboToItemSource(RightMarginComboBox, 0, 100, 5);
            RightMarginComboBox.SelectedItem = 5;

            NExampleHelpers.BindComboToItemSource(BottomMarginComboBox, 0, 100, 5);
            BottomMarginComboBox.SelectedItem = 80;

            PaintEffectComboBox.Items.Add("None");
            PaintEffectComboBox.Items.Add("Gel");
            PaintEffectComboBox.Items.Add("Glass");
            PaintEffectComboBox.SelectedIndex = 1;             // gel

            PaintEffectShapeComboBox.Items.Add("Region");
            PaintEffectShapeComboBox.Items.Add("Rectangle");
            PaintEffectShapeComboBox.Items.Add("Ellipse");
            PaintEffectShapeComboBox.Items.Add("RoundedRect");
            PaintEffectShapeComboBox.SelectedIndex = 2;             // ellipse

            BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle;
            SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle;

            NExampleHelpers.BindComboToItemSource(DirectionComboBox, 0, 180, 5);
            DirectionComboBox.SelectedItem = 45;
            NExampleHelpers.BindComboToItemSource(SpreadComboBox, -360, 360, 20);
            SpreadComboBox.SelectedItem = 60;

            LinearGaugeOrientationComboBox.Items.Add("Horizontal");
            LinearGaugeOrientationComboBox.Items.Add("Vertical");
            LinearGaugeOrientationComboBox.SelectedIndex = 1;
        }
Exemple #13
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Line Chart");

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

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

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

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

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

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

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

            line.Name                   = "Line Series";
            line.InflateMargins         = true;
            line.DataLabelStyle.Format  = "<value>";
            line.MarkerStyle.Visible    = true;
            line.MarkerStyle.PointShape = PointShape.Cylinder;
            line.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            line.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            line.ShadowStyle.Type       = ShadowType.GaussianBlur;
            line.ShadowStyle.Offset     = new NPointL(3, 3);
            line.ShadowStyle.FadeLength = new NLength(5);
            line.ShadowStyle.Color      = Color.FromArgb(55, 0, 0, 0);
            line.Values.FillRandom(new Random(), 8);

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

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

            styleSheet.Apply(nChartControl1.Document);

            NExampleHelpers.FillComboWithEnumValues(LineStyleComboBox, typeof(LineSegmentShape));
            LineStyleComboBox.SelectedIndex = (int)line.LineSegmentShape;

            AxisRoundToTickCheckBox.IsChecked = true;
            InflateMarginsCheckBox.IsChecked  = true;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Cluster Bar Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.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
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         stripStyle  = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            // add a bar series
            m_Bar1                       = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar1.Name                  = "Bar1";
            m_Bar1.MultiBarMode          = MultiBarMode.Series;
            m_Bar1.DataLabelStyle.Format = "<value>";
            m_Bar1.Values.ValueFormatter = new NNumericValueFormatter("0.###");

            // add another bar series
            m_Bar2                       = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar2.Name                  = "Bar2";
            m_Bar2.MultiBarMode          = MultiBarMode.Clustered;
            m_Bar2.DataLabelStyle.Format = "<value>";
            m_Bar2.Values.ValueFormatter = new NNumericValueFormatter("0.###");

            // fill with random data
            m_Bar1.Values.FillRandomRange(Random, 5, 10, 100);
            m_Bar2.Values.FillRandomRange(Random, 5, 10, 500);

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

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

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

            styleSheet.Apply(nChartControl1.Document);

            NExampleHelpers.FillComboWithEnumValues(BarStyleComboBox, typeof(BarShape));
            BarStyleComboBox.SelectedIndex = 0;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Point Chart");

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

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

            // setup point series
            m_Point                = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);
            m_Point.Name           = "Point Series";
            m_Point.InflateMargins = true;

            m_Point.AddDataPoint(new NDataPoint(23, "Item1"));
            m_Point.AddDataPoint(new NDataPoint(67, "Item2"));
            m_Point.AddDataPoint(new NDataPoint(78, "Item3"));
            m_Point.AddDataPoint(new NDataPoint(12, "Item4"));
            m_Point.AddDataPoint(new NDataPoint(56, "Item5"));
            m_Point.AddDataPoint(new NDataPoint(43, "Item6"));
            m_Point.AddDataPoint(new NDataPoint(37, "Item7"));
            m_Point.AddDataPoint(new NDataPoint(51, "Item8"));

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(PointShapeComboBox, typeof(PointShape));
            PointShapeComboBox.SelectedIndex      = 0;
            InflateMarginsCheckBox.IsChecked      = true;
            LeftAxisRoundToTickCheckBox.IsChecked = true;
            DifferentColorsCheckBox.IsChecked     = true;
            PointSizeScrollBar.Value = m_Point.Size.Value / 20.0f;

            DifferentColorsCheckBox_Checked(null, null);
        }
Exemple #16
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Heat Map Contour");

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

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

            // create the heat map
            m_HeatMap = new NHeatMapSeries();
            chart.Series.Add(m_HeatMap);

            m_HeatMap.Palette.Add(0.0, Color.Purple);
            m_HeatMap.Palette.Add(1.5, Color.MediumSlateBlue);
            m_HeatMap.Palette.Add(3.0, Color.CornflowerBlue);
            m_HeatMap.Palette.Add(4.5, Color.LimeGreen);
            m_HeatMap.Palette.Add(6.0, Color.LightGreen);
            m_HeatMap.Palette.Add(7.5, Color.Yellow);
            m_HeatMap.Palette.Add(9.0, Color.Orange);
            m_HeatMap.Palette.Add(10.5, Color.Red);
            m_HeatMap.XValuesMode = HeatMapValuesMode.OriginAndStep;
            m_HeatMap.YValuesMode = HeatMapValuesMode.OriginAndStep;

            m_HeatMap.ContourDisplayMode = ContourDisplayMode.Contour;
            m_HeatMap.Legend.Mode        = SeriesLegendMode.SeriesLogic;
            m_HeatMap.Legend.Format      = "<zone_value>";

            GenerateData();

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(ContourDisplayModeCombo, typeof(ContourDisplayMode));
            NExampleHelpers.FillComboWithEnumValues(ContourColorModeCombo, typeof(ContourColorMode));

            ContourDisplayModeCombo.SelectedIndex = (int)ContourDisplayMode.Contour;
            ContourColorModeCombo.SelectedIndex   = (int)ContourColorMode.Uniform;

            ShowFillCheckBox.IsChecked      = true;
            SmoothPaletteCheckBox.IsChecked = true;

            UpdateHeatMapSeries();
        }
Exemple #17
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Numeric Display Panel");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.TextStyle.FillStyle = new NColorFillStyle(GreyBlue);
            header.Location            = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));
            nChartControl1.Panels.Add(header);

            NDockPanel dockPanel = new NDockPanel();

            dockPanel.Location         = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            dockPanel.Size             = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            dockPanel.ContentAlignment = ContentAlignment.MiddleCenter;

            nChartControl1.Panels.Add(dockPanel);

            m_NumericDisplay1 = CreateDisplayPanel();
            m_NumericDisplay2 = CreateDisplayPanel();
            m_NumericDisplay3 = CreateDisplayPanel();

            dockPanel.ChildPanels.Add(m_NumericDisplay1);
            dockPanel.ChildPanels.Add(m_NumericDisplay2);
            dockPanel.ChildPanels.Add(m_NumericDisplay3);

            nChartControl1.Refresh();

            // init form controls
            CellSizeComboBox.Items.Add("Small");
            CellSizeComboBox.Items.Add("Normal");
            CellSizeComboBox.Items.Add("Large");
            CellSizeComboBox.SelectedIndex = 1;
            NExampleHelpers.FillComboWithEnumValues(DisplayStyleComboBox, typeof(DisplayStyle));
            DisplayStyleComboBox.SelectedIndex = (int)DisplayStyle.SevenSegmentRounded;

            NExampleHelpers.FillComboWithEnumValues(SignModeComboBox, typeof(DisplaySignMode));
            SignModeComboBox.SelectedIndex = (int)DisplaySignMode.Never;

            DataFeedTimer.Start();
        }
Exemple #18
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // remove all legends
            nChartControl1.Legends.Clear();

            // set a chart title
            NLabel title = new NLabel("Three Line Break");

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

            NChart chart = nChartControl1.Charts[0];

            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);
            scaleY.StripStyles.Add(stripStyle);

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

            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            priceConfigurator.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator   = priceConfigurator;

            // setup line break series
            m_ThreeLineBreak = new NThreeLineBreakSeries();
            chart.Series.Add(m_ThreeLineBreak);
            m_ThreeLineBreak.UseXValues = true;

            GenerateData(m_ThreeLineBreak);

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

            NExampleHelpers.FillComboWithValues(BarWidthPercentComboBox, 0, 100, 10);
            BarWidthPercentComboBox.SelectedIndex = 2;

            NExampleHelpers.FillComboWithValues(NumberOfLinesToBreakComboBox, 1, 10, 1);
            NumberOfLinesToBreakComboBox.SelectedIndex = 4;
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Gauge Borders");

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

            // create the radial gauge
            CreateRadialGauge();

            // create the linear gauge
            CreateLinearGauge();

            BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle;
            SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle;

            NExampleHelpers.BindComboToItemSource(CenterRoundingNumericComboBox, 0, 100, 5);
            CenterRoundingNumericComboBox.SelectedItem = 15;

            NExampleHelpers.BindComboToItemSource(EdgeRoundingNumericComboBox, 0, 100, 5);
            EdgeRoundingNumericComboBox.SelectedItem = 10;

            NExampleHelpers.BindComboToItemSource(RoundRectRoundingComboBox, 0, 100, 5);
            RoundRectRoundingComboBox.SelectedItem = 10;

            LinearGaugeOrientationComboBox.Items.Add("Horizontal");
            LinearGaugeOrientationComboBox.Items.Add("Vertical");
            LinearGaugeOrientationComboBox.SelectedIndex = 1;

            BorderTypeComboBox.Items.Add("Rectangular");
            BorderTypeComboBox.Items.Add("Rounded Rectangular");
            BorderTypeComboBox.Items.Add("Auto");
            BorderTypeComboBox.SelectedIndex = 2;

            RadialGaugeAutoBorderTypeComboBox.Items.Add("Circle");
            RadialGaugeAutoBorderTypeComboBox.Items.Add("Cut Circle");
            RadialGaugeAutoBorderTypeComboBox.Items.Add("Rounded Outline");
            RadialGaugeAutoBorderTypeComboBox.SelectedIndex = 0;
        }
Exemple #20
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Gauge Background Adorner");

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

            // create the radial gauge
            CreateRadialGauge();

            // create the linear gauge
            CreateLinearGauge();

            // update form controls

            NExampleHelpers.BindComboToItemSource(LeftMarginComboBox, 0, 100, 5);
            LeftMarginComboBox.SelectedItem = 0;
            NExampleHelpers.BindComboToItemSource(TopMarginComboBox, 0, 100, 5);
            TopMarginComboBox.SelectedItem = 55;
            NExampleHelpers.BindComboToItemSource(RightMarginComboBox, 0, 100, 5);
            RightMarginComboBox.SelectedItem = 0;
            NExampleHelpers.BindComboToItemSource(BottomMarginComboBox, 0, 100, 5);
            BottomMarginComboBox.SelectedItem = 0;

            NExampleHelpers.FillComboWithEnumValues(AdornerShapeComboBox, typeof(GaugeBackroundAdornerShape));
            AdornerShapeComboBox.SelectedIndex = 0;

            LinearGaugeOrientationComboBox.Items.Add("Horizontal");
            LinearGaugeOrientationComboBox.Items.Add("Vertical");
            LinearGaugeOrientationComboBox.SelectedIndex = 1;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // remove all legends
            nChartControl1.Legends.Clear();

            // set a chart title
            NLabel title = new NLabel("Point and Figure");

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

            const int nInitialBoxSize = 5;

            NChart chart = nChartControl1.Charts[0];

            chart.BoundsMode = BoundsMode.Stretch;

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

            priceConfigurator.LabelValueFormatter                 = new NDateTimeValueFormatter(DateTimeValueFormat.Date);
            priceConfigurator.MajorTickMode                       = MajorTickMode.AutoMaxCount;
            priceConfigurator.MajorGridStyle.ShowAtWalls          = new ChartWallType[] { ChartWallType.Back };
            priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
            priceConfigurator.MaxTickCount = 8;

            NNumericRangeSamplerProvider provider = new NNumericRangeSamplerProvider();

            provider.SamplingMode = SamplingMode.CustomStep;
            provider.CustomStep   = 1;
            provider.UseOrigin    = true;
            provider.Origin       = -0.5;
            priceConfigurator.MajorGridStyle.RangeSamplerProvider = provider;

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

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

            scaleY.MajorTickMode                  = MajorTickMode.CustomStep;
            scaleY.CustomStep                     = nInitialBoxSize;
            scaleY.OuterMajorTickStyle.Width      = new NLength(0);
            scaleY.InnerMajorTickStyle.Width      = new NLength(0);
            scaleY.AutoMinorTicks                 = true;
            scaleY.MinorTickCount                 = 1;
            scaleY.RoundToTickMin                 = false;
            scaleY.RoundToTickMax                 = false;
            scaleY.MajorGridStyle.LineStyle.Width = new NLength(0);
            scaleY.MinorGridStyle.LineStyle.Width = new NLength(1);
            scaleY.MinorGridStyle.ShowAtWalls     = new ChartWallType[] { ChartWallType.Back };

            float[] highValues = new float[20] {
                21.3F, 42.4F, 11.2F, 65.7F, 38.0F, 71.3F, 49.54F, 83.7F, 13.9F, 56.12F, 27.43F, 23.1F, 31.0F, 75.4F, 9.3F, 39.12F, 10.0F, 44.23F, 21.76F, 49.2F
            };
            float[] lowValues = new float[20] {
                12.1F, 14.32F, 8.43F, 36.0F, 13.5F, 47.34F, 24.54F, 68.11F, 6.87F, 23.3F, 12.12F, 14.54F, 25.0F, 37.2F, 3.9F, 23.11F, 1.9F, 14.0F, 8.23F, 34.21F
            };

            // setup Point & Figure series
            m_PointAndFigure            = (NPointAndFigureSeries)chart.Series.Add(SeriesType.PointAndFigure);
            m_PointAndFigure.UseXValues = true;

            // fill data
            m_PointAndFigure.HighValues.AddRange(highValues);
            m_PointAndFigure.LowValues.AddRange(lowValues);

            DateTime dt = new DateTime(2007, 1, 1);

            for (int i = 0; i < 20; i++)
            {
                m_PointAndFigure.XValues.Add(dt);
                dt = dt.AddDays(1);
            }

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

            NExampleHelpers.FillComboWithValues(BoxSizeComboBox, 1, 10, 1);
            BoxSizeComboBox.SelectedIndex = nInitialBoxSize + 1;

            NExampleHelpers.FillComboWithValues(ReversalAmountComboBox, 1, 10, 1);
            ReversalAmountComboBox.SelectedIndex = 3;
        }
Exemple #22
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Controller.Tools.Clear();
            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

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

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

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

            // setup chart
            m_PieChart          = new NPieChart();
            m_PieChart.Enable3D = true;
            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(m_PieChart);
            m_PieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            m_PieChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            m_PieChart.Location = new NPointL(
                new NLength(15, NRelativeUnit.ParentPercentage),
                new NLength(15, NRelativeUnit.ParentPercentage));
            m_PieChart.Size = new NSizeL(
                new NLength(70, NRelativeUnit.ParentPercentage),
                new NLength(70, NRelativeUnit.ParentPercentage));

            // setup pie series
            m_PieSeries                       = (NPieSeries)m_PieChart.Series.Add(SeriesType.Pie);
            m_PieSeries.LabelMode             = PieLabelMode.SpiderNoOverlap;
            m_PieSeries.DataLabelStyle.Format = "<label>\n<percent>";
            m_PieSeries.Values.ValueFormatter = new NNumericValueFormatter("0.##");

            double[] arrValues =
            {
                4.17, 7.19, 5.62, 7.91, 15.28,
                0.97,  1.3, 1.12, 8.54,  9.84,
                2.05, 5.02, 1.42, 0.63, 3.01
            };

            for (int i = 0; i < arrValues.Length; i++)
            {
                m_PieSeries.Values.Add(arrValues[i]);
            }

            SetTexts();

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(PieStyleComboBox, typeof(PieStyle));
            PieStyleComboBox.SelectedIndex = 2;
            PieStyleComboBox_SelectionChanged(null, null);
        }
Exemple #23
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stock Data Grouping");

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

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

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

            chart.BoundsMode = BoundsMode.Stretch;

            NRangeSelection rs = new NRangeSelection();

            rs.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
            chart.RangeSelections.Add(rs);

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

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

            // calendar
            NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All);

            wdr.Saturday = false;
            wdr.Sunday   = false;
            scaleX.Calendar.Rules.Add(wdr);
            scaleX.EnableCalendar = true;

            // set configurator
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX;
            chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;

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

            scaleY.OuterMajorTickStyle.Length  = new NLength(3, NGraphicsUnit.Point);
            scaleY.InnerMajorTickStyle.Visible = false;

            NFillStyle       stripFill  = new NColorFillStyle(Color.FromArgb(234, 233, 237));
            NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1);

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

            // setup stock series
            m_Stock = (NStockSeries)chart.Series.Add(SeriesType.Stock);
            m_Stock.DataLabelStyle.Visible   = false;
            m_Stock.UpFillStyle              = new NColorFillStyle(Color.White);
            m_Stock.UpStrokeStyle.Color      = Color.Black;
            m_Stock.DownFillStyle            = new NColorFillStyle(Color.Crimson);
            m_Stock.DownStrokeStyle.Color    = Color.Crimson;
            m_Stock.HighLowStrokeStyle.Color = Color.Black;
            m_Stock.CandleWidth              = new NLength(1.2f, NRelativeUnit.ParentPercentage);
            m_Stock.UseXValues            = true;
            m_Stock.InflateMargins        = true;
            m_Stock.DataLabelStyle.Format = "open - <open>\r\nclose - <close>";

            // add some stock items
            const int numDataPoints = 10000;

            GenerateOHLCData(m_Stock, 100.0, numDataPoints, new NRange1DD(60, 140));
            FillStockDates(m_Stock, numDataPoints, DateTime.Now - new TimeSpan((int)(numDataPoints * 1.2), 0, 0, 0));

            nChartControl1.Controller.Tools.Add(new NPanelSelectorTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
            nChartControl1.Controller.Tools.Add(new NDataZoomTool());

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

            // update form controls
            CustomDateTimeSpanComboBox.Items.Add("1 Week");
            CustomDateTimeSpanComboBox.Items.Add("2 Weeks");
            CustomDateTimeSpanComboBox.Items.Add("1 Month");
            CustomDateTimeSpanComboBox.Items.Add("3 Months");

            NExampleHelpers.FillComboWithEnumValues(GroupingModeComboBox, typeof(StockGroupingMode));

            CustomDateTimeSpanComboBox.SelectedIndex = 2;
            GroupingModeComboBox.SelectedIndex       = (int)StockGroupingMode.AutoDateTimeSpan;
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Radial Gauge Indicators");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            m_RadialGauge                     = new NRadialGaugePanel();
            m_RadialGauge.PaintEffect         = new NGlassEffectStyle();
            m_RadialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            m_RadialGauge.ContentAlignment    = ContentAlignment.MiddleCenter;
            m_RadialGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage));
            m_RadialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);

            // configure scale
            NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator;

            scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation);
            scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold);
            scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White);
            scale.LabelStyle.Angle             = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

            // add radial gauge indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 20;
            m_Indicator1.FillStyle         = new NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, Color.Yellow, Color.Red);
            m_Indicator1.StrokeStyle.Color = Color.DarkBlue;
            m_Indicator1.EndWidth          = new NLength(20);
            m_RadialGauge.Indicators.Add(m_Indicator1);

            m_Indicator2                         = new NNeedleValueIndicator();
            m_Indicator2.Value                   = 79;
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = Color.Red;
            m_RadialGauge.Indicators.Add(m_Indicator2);
            m_RadialGauge.SweepAngle = 270;

            // add radial gauge
            nChartControl1.Panels.Add(m_RadialGauge);

            // create and configure a numeric display attached to the radial gauge
            m_NumericDisplay                      = new NNumericDisplayPanel();
            m_NumericDisplay.Location             = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage));
            m_NumericDisplay.ContentAlignment     = ContentAlignment.TopCenter;
            m_NumericDisplay.SegmentWidth         = new NLength(2, NGraphicsUnit.Point);
            m_NumericDisplay.SegmentGap           = new NLength(1, NGraphicsUnit.Point);
            m_NumericDisplay.CellSize             = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point));
            m_NumericDisplay.DecimalCellSize      = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point));
            m_NumericDisplay.ShowDecimalSeparator = false;
            m_NumericDisplay.CellAlignment        = VertAlign.Top;
            m_NumericDisplay.BackgroundFillStyle  = new NColorFillStyle(Color.DimGray);
            m_NumericDisplay.LitFillStyle         = new NGradientFillStyle(Color.Lime, Color.Green);
            m_NumericDisplay.CellCountMode        = DisplayCellCountMode.Fixed;
            m_NumericDisplay.CellCount            = 6;
            m_NumericDisplay.Padding              = new NMarginsL(6, 3, 6, 3);
            m_RadialGauge.ChildPanels.Add(m_NumericDisplay);

            // create a sunken border around the display
            NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect);

            borderStyle.OuterBevelWidth  = new NLength(0);
            borderStyle.MiddleBevelWidth = new NLength(0);
            m_NumericDisplay.BorderStyle = borderStyle;

            // init form controls

            NExampleHelpers.BindComboToItemSource(SweepAngleComboBox, -360, 360, 10);
            SweepAngleComboBox.SelectedItem = (int)m_RadialGauge.SweepAngle;

            NExampleHelpers.BindComboToItemSource(BeginAngleComboBox, -360, 360, 10);
            BeginAngleComboBox.SelectedItem = (int)m_RadialGauge.BeginAngle;

            NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape1D));
            ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape1D.Arrow2;

            NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, 0, 100, 1);
            ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value;

            NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, 0, 100, 5);
            RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value;

            NExampleHelpers.FillComboWithEnumValues(RangeIndicatorOriginModeComboBox, typeof(OriginMode));
            RangeIndicatorOriginModeComboBox.SelectedIndex = 0;

            NExampleHelpers.BindComboToItemSource(NeedleWidthComboBox, -20, 60, 5);
            NeedleWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value;

            NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, 0, 100, 5);
            RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin;
        }
Exemple #25
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stacked Bar Chart");

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

            // configure the chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Width    = 65;
            m_Chart.Height   = 40;
            m_Chart.Axis(StandardAxis.Depth).Visible = false;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.BrightCameraLight);

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

            // add the first bar
            m_Bar1              = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar1.Name         = "Bar1";
            m_Bar1.MultiBarMode = MultiBarMode.Series;

            // add the second bar
            m_Bar2              = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar2.Name         = "Bar2";
            m_Bar2.MultiBarMode = MultiBarMode.Stacked;

            // add the third bar
            m_Bar3              = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar);
            m_Bar3.Name         = "Bar3";
            m_Bar3.MultiBarMode = MultiBarMode.Stacked;

            // setup value formatting
            m_Bar1.Values.ValueFormatter = new NNumericValueFormatter("0.###");
            m_Bar2.Values.ValueFormatter = new NNumericValueFormatter("0.###");
            m_Bar3.Values.ValueFormatter = new NNumericValueFormatter("0.###");

            // position data labels in the center of the bars
            m_Bar1.DataLabelStyle.VertAlign = VertAlign.Center;
            m_Bar2.DataLabelStyle.VertAlign = VertAlign.Center;
            m_Bar3.DataLabelStyle.VertAlign = VertAlign.Center;

            m_Bar1.DataLabelStyle.ArrowLength = new NLength(0);
            m_Bar2.DataLabelStyle.ArrowLength = new NLength(0);
            m_Bar3.DataLabelStyle.ArrowLength = new NLength(0);

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

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

            styleSheet.Apply(nChartControl1.Document);

            // init form controls
            InitLabelsCombo(FirstAreaDataLabelsComboBox);
            InitLabelsCombo(SecondAreaDataLabelsComboBox);
            InitLabelsCombo(ThirdAreaDataLabelsComboBox);

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

            NExampleHelpers.FillComboWithEnumValues(BarShapeComboBox, typeof(BarShape));
            BarShapeComboBox.SelectedIndex = 0;

            PositiveDataButton_Click(null, null);
            ShowDataLabelsCheckBox_Checked(null, null);
        }
Exemple #26
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Area Chart");

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

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

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

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

            // 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 for Y axis
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

            stripStyle.Interlaced  = true;
            stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back, ChartWallType.Left };

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

            scaleY.StripStyles.Add(stripStyle);

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

            area.Name = "Area Series";
            area.DataLabelStyle.Visible = false;
            area.DataLabelStyle.Format  = "<value>";
            area.ShadowStyle.Type       = ShadowType.Solid;
            area.ShadowStyle.Offset     = new NPointL(3, 0);
            area.ShadowStyle.Color      = Color.FromArgb(60, 0, 0, 0);

            area.Values.AddRange(monthValues);

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

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

            styleSheet.Apply(nChartControl1.Document);

            // form controls
            NExampleHelpers.FillComboWithEnumValues(OriginModeComboBox, typeof(OriginMode));
            OriginModeComboBox.SelectedIndex = 0;
            OriginValueTextBox.Text          = "0";
        }
Exemple #27
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Axis Scale Appearance");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            nChartControl1.Panels.Add(header);

            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray);
            radialGauge.PaintEffect         = new NGlassEffectStyle();
            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.PositionChildPanelsInContentBounds = true;

            nChartControl1.Panels.Add(radialGauge);

            m_Axis = (NGaugeAxis)radialGauge.Axes[0];
            NStandardScaleConfigurator scale = (NStandardScaleConfigurator)m_Axis.ScaleConfigurator;

            scale.MinorTickCount = 3;

            NRangeIndicator indicator1 = new NRangeIndicator();

            indicator1.Value             = 80;
            indicator1.OriginMode        = OriginMode.ScaleMax;
            indicator1.FillStyle         = new NColorFillStyle(Color.Red);
            indicator1.StrokeStyle.Color = Color.DarkRed;
            radialGauge.Indicators.Add(indicator1);

            NNeedleValueIndicator indicator2 = new NNeedleValueIndicator();

            indicator2.Value                   = 79;
            indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red);
            indicator2.Shape.StrokeStyle.Color = Color.Red;
            radialGauge.Indicators.Add(indicator2);
            radialGauge.SweepAngle = 270;

            m_Updating = true;

            NExampleHelpers.FillComboWithEnumValues(MinorTickShapeComboBox, typeof(ScaleTickShape));
            NExampleHelpers.FillComboWithEnumValues(MajorTickShapeComboBox, typeof(ScaleTickShape));
            NExampleHelpers.FillComboWithEnumValues(PredefinedScaleStyleComboBox, typeof(PredefinedScaleStyle));
            PredefinedScaleStyleComboBox.SelectedIndex = (int)PredefinedScaleStyle.Standard;

            NExampleHelpers.BindComboToItemSource(RulerOffsetComboBox, 0, 20, 1);
            RulerOffsetComboBox.SelectedItem = 0;

            NExampleHelpers.BindComboToItemSource(RulerLengthComboBox, 0, 20, 1);
            RulerLengthComboBox.SelectedItem = 2;

            NExampleHelpers.BindComboToItemSource(MajorTicksLengthComboBox, 0, 20, 1);
            MajorTicksLengthComboBox.SelectedItem = 3;

            NExampleHelpers.BindComboToItemSource(MajorTicksWidthComboBox, 0, 20, 1);
            MajorTicksWidthComboBox.SelectedItem = 2;

            NExampleHelpers.BindComboToItemSource(MajorTicksOffsetComboBox, 0, 20, 1);
            MajorTicksOffsetComboBox.SelectedItem = 0;

            NExampleHelpers.BindComboToItemSource(MinorTicksLengthComboBox, 0, 20, 1);
            MinorTicksLengthComboBox.SelectedItem = 3;

            NExampleHelpers.BindComboToItemSource(MinorTicksWidthComboBox, 0, 20, 1);
            MinorTicksWidthComboBox.SelectedItem = 2;

            NExampleHelpers.BindComboToItemSource(MinorTicksOffsetComboBox, 0, 20, 1);
            MinorTicksOffsetComboBox.SelectedItem = 0;


            m_Updating = false;

            InitFormControls();
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Stacked Radar Area");

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

            // configure the chart
            m_Chart = new NRadarChart();
            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(m_Chart);
            m_Chart.Wall(ChartWallType.Radar).BorderStyle.Color = Color.White;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            m_Chart.DisplayOnLegend = nChartControl1.Legends[0];

            AddAxis("Category A");
            AddAxis("Category B");
            AddAxis("Category C");
            AddAxis("Category D");
            AddAxis("Category E");

            // create the radar series
            NRadarAreaSeries radarArea0 = new NRadarAreaSeries();

            m_Chart.Series.Add(radarArea0);
            radarArea0.Name = "Series 1";
            radarArea0.Values.FillRandomRange(Random, 5, 50, 90);
            radarArea0.DataLabelStyle.Visible = false;
            radarArea0.DataLabelStyle.Format  = "<value>";
            radarArea0.MarkerStyle.AutoDepth  = true;
            radarArea0.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea0.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);

            NRadarAreaSeries radarArea1 = new NRadarAreaSeries();

            m_Chart.Series.Add(radarArea1);
            radarArea1.Name = "Series 2";
            radarArea1.Values.FillRandomRange(Random, 5, 0, 100);
            radarArea1.DataLabelStyle.Visible = false;
            radarArea1.DataLabelStyle.Format  = "<value>";
            radarArea1.MarkerStyle.AutoDepth  = true;
            radarArea1.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea1.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            // stack the second radar area series
            radarArea1.MultiAreaMode = MultiAreaMode.Stacked;

            NRadarAreaSeries radarArea2 = new NRadarAreaSeries();

            m_Chart.Series.Add(radarArea2);
            radarArea2.Name = "Series 3";
            radarArea2.Values.FillRandomRange(Random, 5, 0, 100);
            radarArea2.DataLabelStyle.Visible = false;
            radarArea2.DataLabelStyle.Format  = "<value>";
            radarArea2.MarkerStyle.AutoDepth  = true;
            radarArea2.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea2.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            // stack the third radar area series
            radarArea2.MultiAreaMode = MultiAreaMode.Stacked;

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

            styleSheet.Apply(nChartControl1.Charts[0].Series);

            radarArea0.FillStyle.SetTransparencyPercent(20);
            radarArea1.FillStyle.SetTransparencyPercent(20);
            radarArea2.FillStyle.SetTransparencyPercent(20);

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

            // init form controls
            BeginAngleScrollBar.Value = 90 / 360.0;
            NExampleHelpers.FillComboWithEnumValues(TitleAngleModeComboBox, typeof(ScaleLabelAngleMode));
            TitleAngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.Scale;

            StackModeComboBox.Items.Add("Stacked");
            StackModeComboBox.Items.Add("Stacked %");
            StackModeComboBox.SelectedIndex = 0;
        }
Exemple #29
0
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Radial Gauge Knob Indicators");

            header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            header.ContentAlignment    = ContentAlignment.BottomRight;
            header.DockMode            = PanelDockMode.Top;
            header.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));
            header.Margins             = new NMarginsL(5, 5, 5, 5);

            nChartControl1.Panels.Add(header);

            NDockPanel panelContainer = new NDockPanel();

            panelContainer.DockMode = PanelDockMode.Fill;

            // create the knob indicator
            NKnobIndicator knobIndicator = new NKnobIndicator();

            knobIndicator.OffsetFromScale = new NLength(-5);
            knobIndicator.OuterRimStyle.PatternRepeatCount = 5;
            knobIndicator.InnerRimStyle.PatternRepeatCount = 5;
            //knobIndicator.InnerRimStyle.Offset = new NLength(10);

            // apply fill style to the marker
            NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle();

            advancedGradientFill.BackgroundColor = Color.Red;
            advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle));
            knobIndicator.MarkerShape.FillStyle = advancedGradientFill;
            knobIndicator.ValueChanged         += knobIndicator_ValueChanged;

            m_RadialGauge    = CreateRadialGauge(knobIndicator);
            m_NumericDisplay = CreateNumericDisplay();

            panelContainer.ChildPanels.Add(m_NumericDisplay);
            panelContainer.ChildPanels.Add(m_RadialGauge);

            panelContainer.Margins = new NMarginsL(10, 10, 10, 10);
            nChartControl1.Panels.Add(panelContainer);

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

            m_Updating = true;

            // Init form controls
            NExampleHelpers.FillComboWithEnumValues(MarkerShapeComboBox, typeof(SmartShape2D));
            MarkerShapeComboBox.SelectedIndex = (int)SmartShape2D.Ellipse;

            NExampleHelpers.BindComboToItemSource(MarkerOffsetComboBox, -100, 100, 5);
            MarkerOffsetComboBox.SelectedItem = (int)knobIndicator.OffsetFromScale.Value;

            NExampleHelpers.FillComboWithEnumValues(MarkerPaintOrderComboBox, typeof(KnobMarkerPaintOrder));
            MarkerPaintOrderComboBox.SelectedIndex = (int)knobIndicator.MarkerPaintOrder;

            // outer rim
            NExampleHelpers.FillComboWithEnumValues(OuterRimPatternComboBox, typeof(CircularRimPattern));
            OuterRimPatternComboBox.SelectedIndex = (int)knobIndicator.OuterRimStyle.Pattern;

            NExampleHelpers.BindComboToItemSource(OuterRimPatternRepeatCountComboBox, 0, 100, 5);
            OuterRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.PatternRepeatCount;

            NExampleHelpers.BindComboToItemSource(OuterRimRadiusOffsetComboBox, 0, 100, 5);
            OuterRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.Offset.Value;

            // inner rim
            NExampleHelpers.FillComboWithEnumValues(InnerRimPatternComboBox, typeof(CircularRimPattern));
            InnerRimPatternComboBox.SelectedIndex = (int)knobIndicator.InnerRimStyle.Pattern;

            NExampleHelpers.BindComboToItemSource(InnerRimPatternRepeatCountComboBox, 0, 100, 5);
            InnerRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.PatternRepeatCount;

            NExampleHelpers.BindComboToItemSource(InnerRimRadiusOffsetComboBox, 0, 100, 5);
            InnerRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.Offset.Value;

            m_Updating = false;

            OuterRimPatternRepeatCountComboBox.SelectedItem = 6;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("2D Floating Bars");

            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.Axis(StandardAxis.Depth).Visible = false;

            // 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
            NExampleHelpers.FillComboWithEnumValues(BarShapeComboBox, typeof(BarShape));
            BarShapeComboBox.SelectedIndex = 0;

            WidthPercentScrollBar.Value = floatBar.WidthPercent / 100.0f;
        }