Group: Forum Members
Last Active: 10 Years Ago
Posts: 16,
Visits: 1
|
Hi Team,
How to generate Circular Radar Chart. Right now am getting default Radar Chart i,e fig1 but my final output should be Circular Radar Chart (fig2) as in the attachment
Code am using to generate radar chart is as shown below
protected void Page_Load(object sender, EventArgs e) {
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(0);
// 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); Color color1 = System.Drawing.Color.Red; Color color2 = System.Drawing.Color.Green; // create the radar series Random R = new Random();
NRadarAreaSeries radarLine1 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea); radarLine1.Name = "Series 1"; radarLine1.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarLine1.DataLabelStyle.Format = ""; radarLine1.BorderStyle.Color = color1; radarLine1.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarLine1.MarkerStyle.PointShape = PointShape.Star; 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(R, 8, 0, 100);
NRadarAreaSeries radarLine2 = (NRadarAreaSeries)radarChart.Series.Add(SeriesType.RadarArea); radarLine2.Name = "Series 2"; radarLine2.DataLabelStyle.Visible = ShowDataLabelsCheckBox.Checked; radarLine2.DataLabelStyle.Format = ""; radarLine2.BorderStyle.Color = color2; radarLine2.MarkerStyle.Visible = ShowMarkersCheckBox.Checked; radarLine2.MarkerStyle.PointShape = PointShape.Ellipse; 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(R, 8, 0, 100); }
private void AddAxis(NRadarChart radarChart, string title) { NRadarAxis axis = new NRadarAxis();
// set title //axis.Title = title; axis.Name = title; //axis.TitleAngle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 0);
// setup scale NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)axis.ScaleConfigurator;
linearScale.RulerStyle.BorderStyle.Color = Color.Silver; linearScale.InnerMajorTickStyle.LineStyle.Color = Color.Silver; linearScale.OuterMajorTickStyle.LineStyle.Color = Color.Silver; linearScale.InnerMajorTickStyle.Length = new NLength(2, NGraphicsUnit.Point); linearScale.OuterMajorTickStyle.Length = new NLength(2, NGraphicsUnit.Point);
if (radarChart.Axes.Count == 0) { // if the first axis then configure grid style and stripes linearScale.MajorGridStyle.LineStyle.Color = Color.Gainsboro; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Radar, true); } else { // hide labels linearScale.AutoLabels = false; }
radarChart.Axes.Add(axis);
}
Please tel me how to achieve Circular radar chart
|