コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected override NWidget CreateExampleContent()
        {
            NChartView chartView = CreateRadarChartView();

            // configure title
            chartView.Surface.Titles[0].Text = "Radar Axis Titles";

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

            AddAxis("Vitamin A");
            AddAxis("Vitamin B1");
            AddAxis("Vitamin B2");
            AddAxis("Vitamin B6");
            AddAxis("Vitamin B12");
            AddAxis("Vitamin C");
            AddAxis("Vitamin D");
            AddAxis("Vitamin E");

            NLinearScale radarScale = (NLinearScale)m_Chart.Axes[0].Scale;

            radarScale.MajorGridLines.Visible = true;

            NScaleStrip strip = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);

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

            // create the radar series
            m_RadarArea1 = new NRadarAreaSeries();
            m_Chart.Series.Add(m_RadarArea1);
            m_RadarArea1.Name                  = "Series 1";
            m_RadarArea1.DataLabelStyle        = new NDataLabelStyle(false);
            m_RadarArea1.DataLabelStyle.Format = "<value>";

            m_RadarArea2 = new NRadarAreaSeries();
            m_Chart.Series.Add(m_RadarArea2);
            m_RadarArea2.Name           = "Series 2";
            m_RadarArea2.DataLabelStyle = new NDataLabelStyle(false);

            // fill random data
            Random random = new Random();

            for (int i = 0; i < 8; i++)
            {
                m_RadarArea1.DataPoints.Add(new NRadarAreaDataPoint(random.Next(50, 90)));
                m_RadarArea2.DataPoints.Add(new NRadarAreaDataPoint(random.Next(0, 100)));
            }

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false));

            return(chartView);
        }
コード例 #2
0
        private void StackRadarAreasCheck_CheckedChanged(object sender, EventArgs e)
        {
            NChart           chart     = nChartControl1.Charts[0];
            NRadarAreaSeries radarArea = (NRadarAreaSeries)chart.Series[1];

            if (StackRadarAreasCheck.Checked)
            {
                radarArea.MultiAreaMode = MultiAreaMode.Stacked;
            }
            else
            {
                radarArea.MultiAreaMode = MultiAreaMode.Series;
            }

            nChartControl1.Refresh();
        }
コード例 #3
0
        private void StackModeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            NRadarChart                chart   = (NRadarChart)nChartControl1.Charts[0];
            NRadarAreaSeries           series1 = (NRadarAreaSeries)chart.Series[1];
            NRadarAreaSeries           series2 = (NRadarAreaSeries)chart.Series[2];
            NStandardScaleConfigurator scale   = (NStandardScaleConfigurator)m_Chart.Axis(StandardAxis.Radar).ScaleConfigurator;

            switch (StackModeComboBox.SelectedIndex)
            {
            case 0:
                series1.MultiAreaMode     = MultiAreaMode.Stacked;
                series2.MultiAreaMode     = MultiAreaMode.Stacked;
                scale.LabelValueFormatter = new NNumericValueFormatter(NumericValueFormat.General);
                break;

            case 1:
                series1.MultiAreaMode     = MultiAreaMode.StackedPercent;
                series2.MultiAreaMode     = MultiAreaMode.StackedPercent;
                scale.LabelValueFormatter = new NNumericValueFormatter(NumericValueFormat.Percentage);
                break;
            }

            nChartControl1.Refresh();
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StackModeDropDownList.Items.Clear();
                StackModeDropDownList.Items.Add("Stacked");
                StackModeDropDownList.Items.Add("Stacked %");
                StackModeDropDownList.SelectedIndex = 0;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

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

            // configure the chart
            NRadarChart radarChart = new NRadarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(radarChart);
            radarChart.Wall(ChartWallType.Radar).BorderStyle.Color = Color.White;
            radarChart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            radarChart.DisplayOnLegend = nChartControl1.Legends[0];

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

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

            radarChart.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();

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

            NRadarAreaSeries radarArea2 = new NRadarAreaSeries();

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

            // set the stack mode
            if (StackModeDropDownList.SelectedIndex == 0)
            {
                radarArea1.MultiAreaMode = MultiAreaMode.Stacked;
                radarArea2.MultiAreaMode = MultiAreaMode.Stacked;
            }
            else
            {
                radarArea1.MultiAreaMode = MultiAreaMode.StackedPercent;
                radarArea2.MultiAreaMode = MultiAreaMode.StackedPercent;
            }

            // 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 template
            ApplyLayoutTemplate(0, nChartControl1, radarChart, title, nChartControl1.Legends[0]);
        }
コード例 #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("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;
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape));
                MarkerShapeDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithColorNames(RadarColor1DropDownList, KnownColor.SlateBlue);
                WebExamplesUtilities.FillComboWithColorNames(RadarColor2DropDownList, KnownColor.Crimson);

                ShowMarkersCheckBox.Checked = true;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

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

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.ContentAlignment           = ContentAlignment.BottomRight;
            title.Location = new NPointL(
                new NLength(2, NRelativeUnit.ParentPercentage),
                new NLength(2, NRelativeUnit.ParentPercentage));

            // create and configure a radar chart
            NRadarChart radarChart = new NRadarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(radarChart);
            radarChart.BoundsMode = BoundsMode.Fit;
            radarChart.Location   = new NPointL(new NLength(0, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
            radarChart.Size       = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
            radarChart.Padding    = new NMarginsL(7, 7, 7, 7);

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

            Color color1 = WebExamplesUtilities.ColorFromDropDownList(RadarColor1DropDownList);
            Color color2 = WebExamplesUtilities.ColorFromDropDownList(RadarColor2DropDownList);

            // setup radar series 1
            NRadarAreaSeries radarArea1 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea);

            radarArea1.Name = "Series 1";
            radarArea1.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;
            radarArea1.DataLabelStyle.Format  = "<value>";
            radarArea1.BorderStyle.Color      = color1;
            radarArea1.FillStyle                     = new NColorFillStyle(Color.FromArgb(125, color1));
            radarArea1.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            radarArea1.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            radarArea1.MarkerStyle.Height            = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea1.MarkerStyle.Width             = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea1.MarkerStyle.FillStyle         = new NColorFillStyle(color1);
            radarArea1.MarkerStyle.BorderStyle.Color = color1;
            radarArea1.Values.FillRandomRange(Random, 8, 0, 100);

            // setup radar series 2
            NRadarAreaSeries radarArea2 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea);

            radarArea2.Name = "Series 2";
            radarArea2.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked;
            radarArea2.DataLabelStyle.Format  = "<value>";
            radarArea2.BorderStyle.Color      = color2;
            radarArea2.FillStyle                     = new NColorFillStyle(Color.FromArgb(125, color2));
            radarArea2.MarkerStyle.Visible           = ShowMarkersCheckBox.Checked;
            radarArea2.MarkerStyle.PointShape        = (PointShape)MarkerShapeDropDownList.SelectedIndex;
            radarArea2.MarkerStyle.Height            = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea2.MarkerStyle.Width             = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            radarArea2.MarkerStyle.FillStyle         = new NColorFillStyle(color2);
            radarArea2.MarkerStyle.BorderStyle.Color = color2;
            radarArea2.Values.FillRandomRange(Random, 8, 0, 100);
        }
コード例 #7
0
        public override void Initialize()
        {
            base.Initialize();

            nChartControl1.Panels.Clear();

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

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

            // configure the chart
            NRadarChart chart = new NRadarChart();

            nChartControl1.Charts.Add(chart);

            AddRadarAxis(chart, "Category A");
            AddRadarAxis(chart, "Category B");
            AddRadarAxis(chart, "Category C");
            AddRadarAxis(chart, "Category D");
            AddRadarAxis(chart, "Category E");
            AddRadarAxis(chart, "Category F");
            AddRadarAxis(chart, "Category G");

            // radar area series 1
            NRadarAreaSeries series1 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea);

            series1.FillStyle                = new NColorFillStyle(DarkOrange);
            series1.BorderStyle.Color        = DarkOrange;
            series1.DataLabelStyle.Visible   = true;
            series1.DataLabelStyle.VertAlign = VertAlign.Top;
            series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange;
            series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange;

            // radar area series 2
            NRadarAreaSeries series2 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea);

            series2.FillStyle                = new NColorFillStyle(LightOrange);
            series2.BorderStyle.Color        = LightOrange;
            series2.DataLabelStyle.Visible   = true;
            series2.DataLabelStyle.VertAlign = VertAlign.Top;
            series2.DataLabelStyle.ArrowStrokeStyle.Color = LightOrange;
            series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = LightOrange;

            // label layout settings
            chart.LabelLayout.EnableInitialPositioning = true;
            chart.LabelLayout.EnableLabelAdjustment    = true;

            NSizeL safeguardSize = new NSizeL(
                new NLength(1.3f, NRelativeUnit.ParentPercentage),
                new NLength(1.3f, NRelativeUnit.ParentPercentage));

            series1.LabelLayout.EnableDataPointSafeguard = true;
            series1.LabelLayout.UseLabelLocations        = true;
            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = false;
            series1.LabelLayout.DataPointSafeguardSize   = safeguardSize;

            series2.LabelLayout.EnableDataPointSafeguard = true;
            series2.LabelLayout.UseLabelLocations        = true;
            series2.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series2.LabelLayout.InvertLocationsIfIgnored = false;
            series2.LabelLayout.DataPointSafeguardSize   = safeguardSize;

            // fill with random data
            GenerateData(series1, series2);

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

            // init form controls
            EnableInitialPositioningCheck.Checked = true;
            EnableLabelAdjustmentCheck.Checked    = true;
            StackRadarAreasCheck.Checked          = false;
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EnableInitialPositioningCheckBox.Checked = true;
                EnableLabelAdjustmentCheckBox.Checked    = true;
                StackRadarAreasCheckBox.Checked          = false;

                HiddenField1.Value = Random.Next().ToString();
            }

            nChartControl1.Settings.JitterMode = JitterMode.Enabled;
            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            nChartControl1.Panels.Clear();

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

            title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.ContentAlignment    = ContentAlignment.BottomRight;
            title.Location            = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage));

            // configure the chart
            NRadarChart chart = new NRadarChart();

            chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage));
            chart.Size     = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage));
            nChartControl1.Charts.Add(chart);

            AddRadarAxis(chart, "Category A");
            AddRadarAxis(chart, "Category B");
            AddRadarAxis(chart, "Category C");
            AddRadarAxis(chart, "Category D");
            AddRadarAxis(chart, "Category E");
            AddRadarAxis(chart, "Category F");
            AddRadarAxis(chart, "Category G");

            // radar area series 1
            NRadarAreaSeries series1 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea);

            series1.FillStyle                = new NColorFillStyle(DarkOrange);
            series1.BorderStyle.Color        = DarkOrange;
            series1.DataLabelStyle.Visible   = true;
            series1.DataLabelStyle.VertAlign = VertAlign.Top;
            series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange;
            series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange;
            series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);

            // radar area series 2
            NRadarAreaSeries series2 = (NRadarAreaSeries)chart.Series.Add(SeriesType.RadarArea);

            series2.FillStyle                = new NColorFillStyle(Red);
            series2.BorderStyle.Color        = Red;
            series2.BorderStyle.Width        = new NLength(0);
            series2.DataLabelStyle.Visible   = true;
            series2.DataLabelStyle.VertAlign = VertAlign.Top;
            series2.DataLabelStyle.ArrowStrokeStyle.Color = Red;
            series2.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = Red;
            series2.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8);

            // stack / unstack the second radar area series
            if (StackRadarAreasCheckBox.Checked)
            {
                series2.MultiAreaMode = MultiAreaMode.Stacked;
            }
            else
            {
                series2.MultiAreaMode = MultiAreaMode.Series;
            }

            // label layout settings
            chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked;
            chart.LabelLayout.EnableLabelAdjustment    = EnableLabelAdjustmentCheckBox.Checked;

            NSizeL safeguardSize = new NSizeL(
                new NLength(1.3f, NRelativeUnit.ParentPercentage),
                new NLength(1.3f, NRelativeUnit.ParentPercentage));

            series1.LabelLayout.EnableDataPointSafeguard = true;
            series1.LabelLayout.UseLabelLocations        = true;
            series1.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series1.LabelLayout.InvertLocationsIfIgnored = false;
            series1.LabelLayout.DataPointSafeguardSize   = safeguardSize;

            series2.LabelLayout.EnableDataPointSafeguard = true;
            series2.LabelLayout.UseLabelLocations        = true;
            series2.LabelLayout.OutOfBoundsLocationMode  = OutOfBoundsLocationMode.PushWithinBounds;
            series2.LabelLayout.InvertLocationsIfIgnored = false;
            series2.LabelLayout.DataPointSafeguardSize   = safeguardSize;

            // fill with random data
            GenerateData(series1, series2);
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                // init example controls
                WebExamplesUtilities.FillComboWithValues(TitleOffsetDropDownList, 0, 50, 5);
                TitleOffsetDropDownList.SelectedIndex = 1;

                WebExamplesUtilities.FillComboWithEnumValues(TitleAngleModeDropDownList, typeof(ScaleLabelAngleMode));
                TitleAngleModeDropDownList.SelectedIndex = (int)ScaleLabelAngleMode.View;

                WebExamplesUtilities.FillComboWithValues(TitleAngleDropDownList, 0, 360, 10);
                TitleAngleDropDownList.SelectedIndex = 0;

                WebExamplesUtilities.FillComboWithEnumValues(TitlePositionModeDropDownList, typeof(RadarTitlePositionMode));
                TitlePositionModeDropDownList.SelectedIndex = (int)RadarTitlePositionMode.Center;

                WebExamplesUtilities.FillComboWithEnumValues(TitleFitModeDropDownList, typeof(RadarTitleFitMode));
                TitleFitModeDropDownList.SelectedIndex = (int)RadarTitleFitMode.Wrap;

                WebExamplesUtilities.FillComboWithValues(TitleMaxWidthDropDownList, 30, 200, 10);
                TitleMaxWidthDropDownList.SelectedIndex = 2;
            }

            nChartControl1.BackgroundStyle.FrameStyle.Visible = false;

            // set a chart title
            NLabel title = nChartControl1.Labels.AddHeader("Radar Axis Titles");

            title.TextStyle.FontStyle        = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
            title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
            title.DockMode = PanelDockMode.Top;
            title.Margins  = new NMarginsL(10, 10, 10, 10);

            // hide the legend
            nChartControl1.Legends[0].Visible = false;

            // configure the chart
            NRadarChart chart = new NRadarChart();

            nChartControl1.Charts.Clear();
            nChartControl1.Charts.Add(chart);
            chart.DockMode = PanelDockMode.Fill;
            chart.Margins  = new NMarginsL(10, 0, 10, 10);
            chart.Wall(ChartWallType.Radar).BorderStyle.Color = Color.White;
            chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal);
            chart.DisplayOnLegend = nChartControl1.Legends[0];

            AddAxis(chart, "<b>Vitamin A</b><br/><font size='7pt'>etinol or retinal</font>");
            AddAxis(chart, "<b>Vitamin B1</b><br/><font size='7pt'>thiamin or vitamin B1</font>");
            AddAxis(chart, "<b>Vitamin B12</b><br/><font size='7pt'>also called cobalamin</font>");
            AddAxis(chart, "<b>Vitamin C</b><br/><font size='7pt'>L-ascorbic acid or L-ascorbate</font>");
            AddAxis(chart, "<b>Vitamin D</b><br/><font size='7pt'>group of fat-soluble secosteroids</font>");
            AddAxis(chart, "<b>Vitamin E</b><br/><font size='7pt'>group of eight fat-soluble compounds</font>");

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

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

            NRadarAreaSeries m_RadarArea2 = new NRadarAreaSeries();

            chart.Series.Add(m_RadarArea2);
            m_RadarArea2.Name = "Series 2";
            m_RadarArea2.Values.FillRandomRange(Random, 8, 0, 100);
            m_RadarArea2.DataLabelStyle.Visible = false;
            m_RadarArea2.DataLabelStyle.Format  = "<value>";
            m_RadarArea2.MarkerStyle.AutoDepth  = true;
            m_RadarArea2.MarkerStyle.Width      = new NLength(1.5f, NRelativeUnit.ParentPercentage);
            m_RadarArea2.MarkerStyle.Height     = new NLength(1.5f, NRelativeUnit.ParentPercentage);

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

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

            m_RadarArea1.FillStyle.SetTransparencyPercent(50);
            m_RadarArea2.FillStyle.SetTransparencyPercent(60);

            // update title labels
            ScaleLabelAngleMode mode = (ScaleLabelAngleMode)TitleAngleModeDropDownList.SelectedIndex;
            float angle = (float)TitleAngleDropDownList.SelectedIndex * 10;

            for (int i = 0; i < chart.Axes.Count; i++)
            {
                NRadarAxis axis = (NRadarAxis)chart.Axes[i];

                axis.TitleAngle              = new NScaleLabelAngle(mode, angle);
                axis.TitleOffset             = new NLength((float)TitleOffsetDropDownList.SelectedIndex * 5);
                axis.TitlePositionMode       = (RadarTitlePositionMode)TitlePositionModeDropDownList.SelectedIndex;
                axis.TitleFitMode            = (RadarTitleFitMode)TitleFitModeDropDownList.SelectedIndex;
                axis.TitleMaxWidth           = new NLength((float)TitleMaxWidthDropDownList.SelectedIndex * 10 + 30);
                axis.TitleAutomaticAlignment = TitleAutomaticAlignmentCheck.Checked;
            }

            TitleMaxWidthDropDownList.Enabled = TitleFitModeDropDownList.SelectedIndex == (int)RadarTitleFitMode.Wrap;
        }