public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Montana County Comparison<br/><font size = '9pt'>Demonstrates how to create a multi measure radar chart</font>"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.TextFormat = TextFormat.XML; title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 5); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(5, 0, 5, 0); nChartControl1.Panels.Add(legend); // setup chart NRadarChart radarChart = new NRadarChart(); radarChart.Margins = new NMarginsL(5, 0, 0, 5); nChartControl1.Panels.Add(radarChart); radarChart.DisplayOnLegend = legend; radarChart.DockMode = PanelDockMode.Fill; radarChart.RadarMode = RadarMode.MultiMeasure; radarChart.InnerRadius = new NLength(10, NRelativeUnit.ParentPercentage); // set some axis labels AddAxis(radarChart, "Population", true); AddAxis(radarChart, "Housing Units", true); AddAxis(radarChart, "Water", false); AddAxis(radarChart, "Land", true); AddAxis(radarChart, "Population\r\nDensity", false); AddAxis(radarChart, "Housing\r\nDensity", false); float angleStep = 180.0f / (radarChart.Axes.Count - 1); for (int i = 0; i < radarChart.Axes.Count; i++) { NRadarAxis radarAxis = (NRadarAxis)radarChart.Axes[i]; ((NRadarAxisAnchor)radarAxis.Anchor).UseCustomAngle = true; ((NRadarAxisAnchor)radarAxis.Anchor).CustomAngle = i * angleStep; } // sample data object[] data = new object[] { "Cascade County", 80357, 35225, 13.75, 2697.90, 29.8, 13.1, "Custer County", 11696, 5360, 10.09, 3783.13, 3.1, 1.4, "Dawson County", 9059, 4168, 9.99, 2373.14, 3.8, 1.8, "Jefferson County", 10049, 4199, 2.19, 1656.64, 6.1, 2.5, "Missoula County", 95802, 41319, 20.37, 2597.97, 36.9, 15.9, "Powell County", 7180, 2930, 6.74, 2325.94, 3.1, 1.3 }; for (int i = 0; i < 6; i++) { NRadarLineSeries radarLine = new NRadarLineSeries(); radarChart.Series.Add(radarLine); int baseIndex = i * 7; radarLine.Name = data[baseIndex].ToString(); baseIndex = baseIndex + 1; for (int j = 0; j < 6; j++) { radarLine.Values.Add(System.Convert.ToDouble(data[baseIndex])); baseIndex = baseIndex + 1; } radarLine.DataLabelStyle.Visible = false; radarLine.MarkerStyle.Width = new NLength(4); radarLine.MarkerStyle.Height = new NLength(4); radarLine.MarkerStyle.Visible = true; radarLine.BorderStyle.Width = new NLength(2); //radarLine.CloseContour = false; } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); }
/// <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]; m_Chart.RadarMode = ENRadarMode.MultiMeasure; m_Chart.InnerRadius = 60; // set some axis labels AddAxis(m_Chart, "Population", true); AddAxis(m_Chart, "Housing Units", true); AddAxis(m_Chart, "Water", false); AddAxis(m_Chart, "Land", true); AddAxis(m_Chart, "Population\r\nDensity", false); AddAxis(m_Chart, "Housing\r\nDensity", false); // sample data object[] data = new object[] { "Cascade County", 80357, 35225, 13.75, 2697.90, 29.8, 13.1, "Custer County", 11696, 5360, 10.09, 3783.13, 3.1, 1.4, "Dawson County", 9059, 4168, 9.99, 2373.14, 3.8, 1.8, "Jefferson County", 10049, 4199, 2.19, 1656.64, 6.1, 2.5, "Missoula County", 95802, 41319, 20.37, 2597.97, 36.9, 15.9, "Powell County", 7180, 2930, 6.74, 2325.94, 3.1, 1.3 }; for (int i = 0; i < 6; i++) { NRadarLineSeries radarLine = new NRadarLineSeries(); m_Chart.Series.Add(radarLine); int baseIndex = i * 7; radarLine.Name = data[baseIndex].ToString(); baseIndex = baseIndex + 1; for (int j = 0; j < 6; j++) { radarLine.DataPoints.Add(new NRadarLineDataPoint(System.Convert.ToDouble(data[baseIndex]))); baseIndex = baseIndex + 1; } radarLine.DataLabelStyle = new NDataLabelStyle(false); NMarkerStyle markerStyle = new NMarkerStyle(); markerStyle.Size = new NSize(4, 4); markerStyle.Visible = true; markerStyle.Fill = new NColorFill(NChartTheme.BrightPalette[i]); radarLine.MarkerStyle = markerStyle; radarLine.Stroke = new NStroke(2, NChartTheme.BrightPalette[i]); } chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false)); return(chartView); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NChartView chartView = CreateRadarChartView(); // configure title chartView.Surface.Titles[0].Text = "Radar Line"; // configure chart m_Chart = (NRadarChart)chartView.Surface.Charts[0]; // set some axis labels AddAxis("Vitamin A"); AddAxis("Vitamin B1"); AddAxis("Vitamin B2"); AddAxis("Vitamin B6"); AddAxis("Vitamin B12"); AddAxis("Vitamin C"); AddAxis("Vitamin D"); AddAxis("Vitamin E"); 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); m_RadarLine1 = new NRadarLineSeries(); m_Chart.Series.Add(m_RadarLine1); m_RadarLine1.Stroke = new NStroke(2, NChartTheme.BrightPalette[0]); m_RadarLine1.Name = "Series 1"; m_RadarLine1.DataLabelStyle = new NDataLabelStyle(false); NMarkerStyle markerStyle1 = new NMarkerStyle(); markerStyle1.Visible = true; markerStyle1.Shape = ENPointShape.Ellipse; markerStyle1.Size = new NSize(10, 10); m_RadarLine1.MarkerStyle = markerStyle1; m_RadarLine2 = new NRadarLineSeries(); m_Chart.Series.Add(m_RadarLine2); m_RadarLine2.Stroke = new NStroke(2, NChartTheme.BrightPalette[1]); m_RadarLine2.Name = "Series 2"; m_RadarLine2.DataLabelStyle = new NDataLabelStyle(false); NMarkerStyle markerStyle2 = new NMarkerStyle(); markerStyle2.Visible = true; markerStyle2.Shape = ENPointShape.Ellipse; markerStyle2.Size = new NSize(10, 10); m_RadarLine2.MarkerStyle = markerStyle2; // fill random data Random random = new Random(); for (int i = 0; i < 8; i++) { m_RadarLine1.DataPoints.Add(new NRadarLineDataPoint(random.Next(50, 90))); m_RadarLine2.DataPoints.Add(new NRadarLineDataPoint(random.Next(0, 100))); } return(chartView); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumValues(MarkerShapeDropDownList, typeof(PointShape)); MarkerShapeDropDownList.SelectedIndex = 1; WebExamplesUtilities.FillComboWithColorNames(RadarAreaColor1DropDownList, KnownColor.Brown); WebExamplesUtilities.FillComboWithColorNames(RadarAreaColor2DropDownList, KnownColor.DarkOrange); ShowMarkersCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Radar Line"); 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); radarChart.InnerRadius = new NLength(15); // 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(RadarAreaColor1DropDownList); Color color2 = WebExamplesUtilities.ColorFromDropDownList(RadarAreaColor2DropDownList); // create the radar series NRadarLineSeries radarLine1 = (NRadarLineSeries)radarChart.Series.Add(SeriesType.RadarLine); radarLine1.Name = "Series 1"; radarLine1.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarLine1.DataLabelStyle.Format = "<value>"; radarLine1.BorderStyle.Color = color1; radarLine1.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarLine1.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; radarLine1.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarLine1.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarLine1.MarkerStyle.FillStyle = new NColorFillStyle(color1); radarLine1.MarkerStyle.BorderStyle.Color = color1; radarLine1.Values.FillRandomRange(Random, 8, 0, 100); NRadarLineSeries radarLine2 = (NRadarLineSeries)radarChart.Series.Add(SeriesType.RadarLine); radarLine2.Name = "Series 2"; radarLine2.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarLine2.DataLabelStyle.Format = "<value>"; radarLine2.BorderStyle.Color = color2; radarLine2.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarLine2.MarkerStyle.PointShape = (PointShape)MarkerShapeDropDownList.SelectedIndex; radarLine2.MarkerStyle.Height = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarLine2.MarkerStyle.Width = new NLength(1.5f, NRelativeUnit.ParentPercentage); radarLine2.MarkerStyle.FillStyle = new NColorFillStyle(color2); radarLine2.MarkerStyle.BorderStyle.Color = color2; radarLine2.Values.FillRandomRange(Random, 8, 0, 100); }