Ejemplo n.º 1
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);
        }
Ejemplo n.º 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 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;
        }
        /// <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);
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 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("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;
        }
Ejemplo n.º 6
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("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;
        }
Ejemplo n.º 7
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();
        }
        /// <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);
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
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("Bar Palette");

            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
            NAxis yAxis = m_Chart.Axis(StandardAxis.PrimaryY);
            NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator;
            NScaleStripStyle         strip       = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);

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

            // setup a bar series
            m_Bar                        = new NBarSeries();
            m_Bar.Name                   = "Bar Series";
            m_Bar.InflateMargins         = true;
            m_Bar.UseXValues             = false;
            m_Bar.DataLabelStyle.Visible = false;

            NPalette palette = new NPalette();

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

            m_Bar.Palette = palette;

            m_AxisRange = new NRange1DD(0, 130);

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

            int indicatorCount = 10;

            m_IndicatorPhase = new double[indicatorCount];

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

            NExampleHelpers.FillComboWithEnumValues(BarPaletteModeComboBox, typeof(PaletteColorMode));
            BarPaletteModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread;
            SmoothPaletteCheckBox.IsChecked      = true;

            m_Timer          = new System.Windows.Threading.DispatcherTimer();
            m_Timer.Tick    += new EventHandler(OnTimerTick);
            m_Timer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            m_Timer.Start();
        }
        /// <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;
        }
Ejemplo n.º 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("Pareto Chart");

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

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

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

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

            scaleX.InnerMajorTickStyle.Visible = false;

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

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

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

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

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

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

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

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

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

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

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

            double[] arrCumulative = new double[count];

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

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

                m_Line.Values.AddRange(arrCumulative);
            }

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

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

            styleSheet.Apply(nChartControl1.Document);

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

            WidthPercentScrollBar.Value = m_Bar.WidthPercent / 100f;
        }
        /// <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;
        }
Ejemplo n.º 15
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("XY Bubble Chart");

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

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

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

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

            // add interlace style
            NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(new NArgbColor(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);

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

            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.Visible = false;
            m_Bubble.Legend.Format          = "<label>";
            m_Bubble.Legend.Mode            = SeriesLegendMode.DataPoints;
            m_Bubble.ShadowStyle.Type       = ShadowType.Solid;
            m_Bubble.ShadowStyle.Offset     = new NPointL(1.2f, 1.2f);
            m_Bubble.ShadowStyle.Color      = Color.FromArgb(60, 0, 0, 0);
            m_Bubble.UseXValues             = true;

            m_Bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada"));

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

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

            styleSheet.Apply(nChartControl1.Document);

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BubbleShapeComboBox, typeof(PointShape));
            BubbleShapeComboBox.SelectedIndex = 6;

            LegendFormatComboBox.Items.Add("Value and Label");
            LegendFormatComboBox.Items.Add("Value");
            LegendFormatComboBox.Items.Add("Label");
            LegendFormatComboBox.Items.Add("Size");
            LegendFormatComboBox.SelectedIndex = 2;

            InflateMarginsCheckBox.IsChecked  = true;
            DifferentColorsCheckBox.IsChecked = true;

            MaxBubbleSizeScrollBar.Value = m_Bubble.MaxSize.Value / 100.0f;
            MinBubbleSizeScrollBar.Value = m_Bubble.MinSize.Value / 100.0f;

            InflateMarginsCheckBox_Checked(null, null);
            DifferentColorsCheckBox_Checked(null, null);
        }
Ejemplo n.º 16
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;
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Linear 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);

            // create a linear gauge
            m_LinearGauge = new NLinearGaugePanel();
            nChartControl1.Panels.Add(m_LinearGauge);
            m_LinearGauge.ContentAlignment    = System.Drawing.ContentAlignment.MiddleCenter;
            m_LinearGauge.Location            = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            m_LinearGauge.PaintEffect         = new NGelEffectStyle();
            m_LinearGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.RoundedRect);
            m_LinearGauge.BackgroundFillStyle = new NGradientFillStyle(System.Drawing.Color.Gray, System.Drawing.Color.Black);

            m_LinearGauge.Axes.Clear();

            NRange1DD celsiusRange = new NRange1DD(-40, 60);

            // add celsius and farenheit axes
            NGaugeAxis celsiusAxis = new NGaugeAxis();

            celsiusAxis.Range  = celsiusRange;
            celsiusAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(-5), VertAlign.Center, RulerOrientation.Left, 0, 100);
            m_LinearGauge.Axes.Add(celsiusAxis);

            NGaugeAxis farenheitAxis = new NGaugeAxis();

            farenheitAxis.Range  = new NRange1DD(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End));
            farenheitAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(5), VertAlign.Center, RulerOrientation.Right, 0, 100);
            m_LinearGauge.Axes.Add(farenheitAxis);

            // configure the scales
            NLinearScaleConfigurator celsiusScale = (NLinearScaleConfigurator)celsiusAxis.ScaleConfigurator;

            ConfigureScale(celsiusScale, "°C");
            celsiusScale.Sections.Add(CreateSection(System.Drawing.Color.Red, System.Drawing.Color.Red, new NRange1DD(40, 60)));
            celsiusScale.Sections.Add(CreateSection(System.Drawing.Color.Blue, System.Drawing.Color.SkyBlue, new NRange1DD(-40, -20)));

            NLinearScaleConfigurator farenheitScale = (NLinearScaleConfigurator)farenheitAxis.ScaleConfigurator;

            ConfigureScale(farenheitScale, "°F");

            farenheitScale.Sections.Add(CreateSection(System.Drawing.Color.Red, System.Drawing.Color.Red, new NRange1DD(CelsiusToFarenheit(40), CelsiusToFarenheit(60))));
            farenheitScale.Sections.Add(CreateSection(System.Drawing.Color.Blue, System.Drawing.Color.SkyBlue, new NRange1DD(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20))));

            // now add two indicators
            m_Indicator1                   = new NRangeIndicator();
            m_Indicator1.Value             = 10;
            m_Indicator1.StrokeStyle.Color = System.Drawing.Color.DarkBlue;
            m_Indicator1.FillStyle         = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant1, System.Drawing.Color.LightBlue, System.Drawing.Color.Blue);
            m_LinearGauge.Indicators.Add(m_Indicator1);

            m_Indicator2                         = new NMarkerValueIndicator();
            m_Indicator2.Value                   = 33;
            m_Indicator2.Shape.FillStyle         = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, System.Drawing.Color.White, System.Drawing.Color.Red);
            m_Indicator2.Shape.StrokeStyle.Color = System.Drawing.Color.DarkRed;
            m_LinearGauge.Indicators.Add(m_Indicator2);

            // init form controls

            NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, -20, 60, 1);
            ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value;

            NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, -20, 60, 1);
            RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value;

            NExampleHelpers.BindComboToItemSource(MarkerWidthComboBox, 1, 40, 1);
            MarkerWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value;

            NExampleHelpers.BindComboToItemSource(MarkerHeightComboBox, 1, 40, 1);
            MarkerHeightComboBox.SelectedItem = (int)m_Indicator2.Height.Value;

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

            NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, -20, 60, 1);
            RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin;

            NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape2D));
            ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape2D.Triangle;

            NExampleHelpers.FillComboWithEnumValues(GaugeOrientationCombo, typeof(LinearGaugeOrientation));
            GaugeOrientationCombo.SelectedIndex = 0;
        }
Ejemplo n.º 18
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("XY 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.Projection.SetPredefinedProjection(PredefinedProjection.Perspective);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            chart.Axis(StandardAxis.Depth).Visible = false;

            // setup axes
            NLinearScaleConfigurator linearScaleX = new NLinearScaleConfigurator();

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

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

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

            // 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);
            linearScaleY.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);
            area.UseXValues             = true;

            GenreateYValues(nValuesCount);
            GenreateXValues(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;
            AxisRoundToTickCheckBox.IsChecked = true;
            ShowDropLinesCheckBox.IsChecked   = false;
            NExampleHelpers.FillComboWithEnumValues(AreaOriginModeComboBox, typeof(SeriesOriginMode));
            AreaOriginModeComboBox.SelectedIndex = 0;
            OriginValueTextBox.Text = "0";
        }
Ejemplo n.º 19
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();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            nChartControl1.Controller.Tools.Add(new NTrackballTool());

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

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

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

            // setup chart
            m_Chart          = nChartControl1.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted);
            m_Chart.Projection.Elevation -= 10;
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Depth  = 55.0f;
            m_Chart.Width  = 55.0f;
            m_Chart.Height = 55.0f;

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

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

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

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

            // add interlaced stripe
            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 Z axis
            NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();

            m_Chart.Axis(StandardAxis.Depth).ScaleConfigurator = scaleZ;
            scaleZ.MajorGridStyle.ShowAtWalls       = new ChartWallType[] { ChartWallType.Left, ChartWallType.Floor };
            scaleZ.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;

            // setup shape series
            m_Shape                        = (NShapeSeries)m_Chart.Series.Add(SeriesType.Shape);
            m_Shape.FillStyle              = new NColorFillStyle(Color.Red);
            m_Shape.BorderStyle.Color      = Color.DarkRed;
            m_Shape.DataLabelStyle.Visible = false;
            m_Shape.UseXValues             = true;
            m_Shape.UseZValues             = true;

            // populate with random data
            m_Shape.Values.FillRandomRange(Random, 10, -100, 100);
            m_Shape.XValues.FillRandomRange(Random, 10, -100, 100);
            m_Shape.ZValues.FillRandomRange(Random, 10, -100, 100);

            m_Shape.YSizes.FillRandomRange(Random, 10, 5, 20);
            m_Shape.XSizes.FillRandomRange(Random, 10, 5, 20);
            m_Shape.ZSizes.FillRandomRange(Random, 10, 5, 20);

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

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(ShapeComboBox, typeof(BarShape));
            ShapeComboBox.SelectedIndex       = 0;
            UseXValuesCheckBox.IsChecked      = true;
            UseZValuesCheckBox.IsChecked      = true;
            DifferentColorsCheckBox.IsChecked = true;

            DifferentColorsCheckBox_Checked(null, null);
        }
Ejemplo n.º 21
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";
        }
Ejemplo n.º 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);
        }
        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;
        }
Ejemplo n.º 24
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 Bubble 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.Orthogonal);
            m_Chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft);
            m_Chart.Axis(StandardAxis.Depth).Visible = false;

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

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

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

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

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

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

            // add a bubble series
            m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble);
            m_Bubble.DataLabelStyle.VertAlign = VertAlign.Center;
            m_Bubble.DataLabelStyle.Visible   = false;
            m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints;
            m_Bubble.MinSize     = new NLength(7.0f, NRelativeUnit.ParentPercentage);
            m_Bubble.MaxSize     = new NLength(16.0f, NRelativeUnit.ParentPercentage);

            m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 10, "Company 1"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 20, "Company 2"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 25, "Company 3"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 15, "Company 4"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(14, 17, "Company 5"));
            m_Bubble.AddDataPoint(new NBubbleDataPoint(11, 12, "Company 6"));

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

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

            // init form controls
            NExampleHelpers.FillComboWithEnumValues(BubbleShapeComboBox, typeof(PointShape));
            BubbleShapeComboBox.SelectedIndex = 6;

            LegendFormatComboBox.Items.Add("Value and Label");
            LegendFormatComboBox.Items.Add("Value");
            LegendFormatComboBox.Items.Add("Label");
            LegendFormatComboBox.Items.Add("Size");
            LegendFormatComboBox.SelectedIndex = 2;

            InflateMarginsCheckBox.IsChecked  = true;
            DifferentColorsCheckBox.IsChecked = true;

            MaxBubbleSizeScrollBar.Value = m_Bubble.MaxSize.Value / 100.0f;
            MinBubbleSizeScrollBar.Value = m_Bubble.MinSize.Value / 100.0f;

            InflateMarginsCheckBox_Checked(null, null);
            DifferentColorsCheckBox_Checked(null, null);
        }
        public override void Create()
        {
            nChartControl1.Panels.Clear();

            // set a chart title
            NLabel header = new NLabel("Gauge Indicator Palette");

            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 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, 0);
            scale.MinorTickCount               = 4;
            scale.RulerStyle.BorderStyle.Width = new NLength(0);
            scale.RulerStyle.FillStyle         = new NColorFillStyle(Color.DarkGray);

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

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

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

            m_Palette = new NPalette();
            m_Palette.SmoothPalette = true;
            m_Palette.PositiveColor = Color.Green;
            m_Palette.NegativeColor = Color.Red;

            m_NeedleIndicator.Palette         = (NPalette)m_Palette.Clone();
            m_RangeIndicator.Palette          = (NPalette)m_Palette.Clone();
            m_RangeIndicator.PaletteColorMode = PaletteColorMode.Spread;

            NExampleHelpers.FillComboWithEnumValues(PaletteSpreadModeComboBox, typeof(PaletteColorMode));
            PaletteSpreadModeComboBox.SelectedIndex = (int)PaletteColorMode.Spread;

            EnableIndicatorPaletteCheckBox.IsChecked = true;
            IndicatorsValueScrollBar.Value           = m_NeedleIndicator.Value;
        }
Ejemplo n.º 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("3D Funnel Chart");

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic);
            title.TextStyle.FillStyle = new NColorFillStyle(Color.SteelBlue);
            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();

            chart.Enable3D = true;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights);
            chart.Projection.Elevation = 4;

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

            FunnelRadiusScrollBar.Value     = chart.Width / 100.0f;
            FunnelPointGapScrollBar.Value   = funnel.FunnelPointGap / 10.0f;
            NeckWidthScrollBar.Value        = funnel.NeckWidthPercent / 100.0f;
            NeckHeightScrollBar.Value       = funnel.NeckHeightPercent / 100.0f;
            LabelArrowLengthScrollBar.Value = funnel.DataLabelStyle.ArrowLength.Value / 100.0f;
        }
Ejemplo n.º 27
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);
        }
Ejemplo n.º 28
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("3D Pie Chart Shapes");

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

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

            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.BottomRight);

            NPieChart pieChart = new NPieChart();

            pieChart.Enable3D = true;

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

            NPointLightSource ls = new NPointLightSource();

            ls.CoordinateMode = LightSourceCoordinateMode.Camera;
            ls.Position       = new NVector3DF(0, 0, 50);
            ls.Ambient        = Color.FromArgb(30, 30, 30);
            ls.Diffuse        = Color.FromArgb(180, 180, 180);
            ls.Specular       = Color.FromArgb(100, 100, 100);

            pieChart.LightModel.LightSources.Clear();
            pieChart.LightModel.LightSources.Add(ls);

            pieChart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
            pieChart.Depth           = 10;
            pieChart.DisplayOnLegend = nChartControl1.Legends[0];
            pieChart.Location        = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage));
            pieChart.Size            = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage));
            pieChart.InnerRadius     = new NLength(20, NRelativeUnit.ParentPercentage);

            NPieSeries pieSeries = (NPieSeries)pieChart.Series.Add(SeriesType.Pie);

            pieSeries.BorderStyle.Color                 = Color.LemonChiffon;
            pieSeries.DataLabelStyle.ArrowLength        = new NLength(10, NGraphicsUnit.Point);
            pieSeries.DataLabelStyle.ArrowPointerLength = new NLength(0, NGraphicsUnit.Point);

            pieSeries.Legend.Mode   = SeriesLegendMode.DataPoints;
            pieSeries.Legend.Format = "<label> <percent>";

            pieSeries.AddDataPoint(new NDataPoint(24, "Cars", new NColorFillStyle(Color.FromArgb(169, 121, 11))));
            pieSeries.AddDataPoint(new NDataPoint(18, "Airplanes", new NColorFillStyle(Color.FromArgb(157, 157, 92))));
            pieSeries.AddDataPoint(new NDataPoint(32, "Trains", new NColorFillStyle(Color.FromArgb(98, 152, 92))));
            pieSeries.AddDataPoint(new NDataPoint(23, "Ships", new NColorFillStyle(Color.FromArgb(111, 134, 181))));
            pieSeries.AddDataPoint(new NDataPoint(19, "Buses", new NColorFillStyle(Color.FromArgb(179, 63, 92))));

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

            styleSheet.Apply(nChartControl1.Document);

            // init controls
            NExampleHelpers.FillComboWithEnumValues(PieShapeComboBox, typeof(PieStyle));
            PieShapeComboBox.SelectedIndex = (int)PieStyle.Ring;

            NExampleHelpers.FillComboWithEnumValues(LabelModeComboBox, typeof(PieLabelMode));
            LabelModeComboBox.SelectedIndex = 0;

            EdgePercentScrollBar.Value = pieSeries.PieEdgePercent / 100.0f;
            OuterRadiusScrollBar.Value = pieChart.Radius.Value / 100.0f;
            InnerRadiusScrollBar.Value = pieChart.InnerRadius.Value / 100.0f;

            ArrowLengthScrollBar.Value          = pieSeries.DataLabelStyle.ArrowLength.Value / 100.0f;
            ArrowPointerLengthScrollBar.Value   = pieSeries.DataLabelStyle.ArrowPointerLength.Value / 100.0f;
            LabelConnectorLengthScrollBar.Value = pieSeries.ConnectorLength.Value / 100.0f;
            LeadOffArrowLengthScrollBar.Value   = pieSeries.LeadOffArrowLength.Value / 100.0f;

            BeginAngleScrollBar.Value = pieChart.BeginAngle / 360.0;
            TotalAngleScrollBar.Value = pieChart.TotalAngle / 360.0;
        }
Ejemplo n.º 29
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;
        }
        /// <summary>
        /// Called to initialize the example
        /// </summary>
        /// <param name="chartControl"></param>
        public override void Create()
        {
            // set a chart title
            NLabel title = new NLabel("Triangulated Heat Map");

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

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

            chart.RangeSelections.Add(new NRangeSelection());

            chart.BoundsMode = BoundsMode.Stretch;

            NLinearScaleConfigurator scaleX = new NLinearScaleConfigurator();

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

            NLinearScaleConfigurator scaleY = new NLinearScaleConfigurator();

            scaleY.RoundToTickMin = false;
            scaleY.RoundToTickMax = false;
            chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = scaleY;

            // create a point series (used to show the incoming points XY values)
            m_Points = new NPointSeries();
            chart.Series.Add(m_Points);
            m_Points.UseXValues        = true;
            m_Points.BorderStyle.Width = new NLength(0);
            m_Points.FillStyle         = new NColorFillStyle(Color.Black);
            m_Points.Size = new NLength(2);
            m_Points.DataLabelStyle.Visible = false;

            // create the heat map
            m_HeatMap = new NTriangulatedHeatMapSeries();
            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.ContourDisplayMode = ContourDisplayMode.Contour;
            m_HeatMap.Legend.Mode        = SeriesLegendMode.SeriesLogic;
            m_HeatMap.Legend.Format      = "<zone_value>";

            NExampleHelpers.FillComboWithEnumValues(ContourDisplayModeComboBox, typeof(ContourDisplayMode));
            NExampleHelpers.FillComboWithEnumValues(ContourColorModeComboBox, typeof(ContourColorMode));

            GenerateData();

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

            ContourDisplayModeComboBox.SelectedIndex = (int)ContourDisplayMode.Contour;
            ContourColorModeComboBox.SelectedIndex   = (int)ContourColorMode.Uniform;
            ShowFillCheckBox.IsChecked      = true;
            SmoothPaletteCheckBox.IsChecked = true;

            UpdateChart();
        }