private void InitializeRadarChart() { this.radChartView3.AreaType = ChartAreaType.Polar; this.radChartView3.Axes.Add(new PolarAxis()); PolarArea area = this.radChartView3.Area as PolarArea; PolarAxis polarAxis = area.Axes.Get <PolarAxis>()[0]; polarAxis.Minimum = 0d; polarAxis.Maximum = 5d; polarAxis.TickLength = 5; area.ShowGrid = true; PolarGrid grid = (PolarGrid)area.Grid; grid.DrawPolarFills = false; grid.DrawRadialFills = false; grid.BackColor = Color.LightGray; grid.BackColor2 = Color.LightGray; int valuesPerSeries = 8; List <RadarSeries> radarSeries = new List <RadarSeries>(); RadarLineSeries radarLineSeries1 = new RadarLineSeries(); radarLineSeries1.PolarAxis = polarAxis; RadarLineSeries radarLineSeries2 = new RadarLineSeries(); radarLineSeries2.PolarAxis = polarAxis; RadarAreaSeries radarAreaSeries1 = new RadarAreaSeries(); radarAreaSeries1.PolarAxis = polarAxis; radarSeries.Add(radarLineSeries1); radarSeries.Add(radarLineSeries2); radarSeries.Add(radarAreaSeries1); for (int i = 0; i < radarSeriesValues.Length; i++) { int seriesNumber = i / valuesPerSeries; radarSeries[seriesNumber].DataPoints.Add(new CategoricalDataPoint(radarSeriesValues[i])); } radarLineSeries1.PointSize = new SizeF(1f, 1f); radarLineSeries2.PointSize = new SizeF(1f, 1f); radarAreaSeries1.PointSize = new SizeF(1f, 1f); this.radChartView3.Series.Add(radarAreaSeries1); this.radChartView3.Series.Add(radarLineSeries2); this.radChartView3.Series.Add(radarLineSeries1); this.radChartView3.View.Margin = new Padding(20); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); RadarLineSeries hotel1DataList = new RadarLineSeries(new SizeF(6f, 6f)); RadarLineSeries hotel2DataList = new RadarLineSeries(new SizeF(6f, 6f)); RadarLineSeries hotel3DataList = new RadarLineSeries(new SizeF(6f, 6f)); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.1d, "Price")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.5d, "Accommodation")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.8d, "Cleanness")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(4.5d, "Bar/Cafe")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.5d, "Restaurant")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.6d, "Spa center")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.0d, "Kids facilities")); hotel1DataList.DataPoints.Add(new CategoricalDataPoint(3.3d, "Overall")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(3.8d, "Price")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(4.5d, "Accommodation")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(4.3d, "Cleanness")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(3.8d, "Bar/Cafe")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(4.7d, "Restaurant")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(3.9d, "Spa center")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(3.8d, "Kids facilities")); hotel2DataList.DataPoints.Add(new CategoricalDataPoint(4.0d, "Overall")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(4.6d, "Price")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(4.3d, "Accommodation")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(4.7d, "Cleanness")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(3.5d, "Bar/Cafe")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(3.9d, "Restaurant")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(3.2d, "Spa center")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(4.0d, "Kids facilities")); hotel3DataList.DataPoints.Add(new CategoricalDataPoint(4.8d, "Overall")); this.radChartView1.Series.Add(hotel1DataList); this.radChartView1.Series.Add(hotel2DataList); this.radChartView1.Series.Add(hotel3DataList); hotel1DataList.BorderWidth = 2f; hotel2DataList.BorderWidth = 2f; hotel3DataList.BorderWidth = 2f; hotel1DataList.PolarAxis.Minimum = 0d; hotel1DataList.PolarAxis.Maximum = 5d; hotel1DataList.PolarAxis.TickLength = 5; hotel1DataList.RadialAxis.TickLength = 0; PolarArea area = this.radChartView1.Area as PolarArea; area.ShowGrid = true; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.set = new DataSet(); DataTable cardioid = new DataTable("Cardioid"); cardioid.Columns.Add("Value", typeof(double)); cardioid.Columns.Add("Angle", typeof(double)); DataTable shotgunFront = new DataTable("ShotgunFront"); shotgunFront.Columns.Add("Value", typeof(double)); shotgunFront.Columns.Add("Angle", typeof(double)); DataTable shotgunSide = new DataTable("ShotgunSide"); shotgunSide.Columns.Add("Value", typeof(double)); shotgunSide.Columns.Add("Angle", typeof(double)); set.Tables.Add(cardioid); set.Tables.Add(shotgunFront); set.Tables.Add(shotgunSide); int count = 720; double angleStep = 2 * Math.PI / count; for (int i = 0; i < count; i++) { double factor = i > 0.25 * count && i < 0.75 * count ? 0.7 : 1; double angle = i * angleStep; cardioid.Rows.Add(0.5 + 0.5 * (Math.Cos(angle)), angle * 180 / Math.PI); shotgunFront.Rows.Add(factor * Math.Pow(Math.Abs(Math.Cos(angle)), 8), angle * 180 / Math.PI); shotgunSide.Rows.Add(0.48 * Math.Pow(Math.Abs(Math.Sin(angle)), 20), angle * 180 / Math.PI); } this.BindChartToLineSeries(); this.radChartView1.DataSource = this.set; PolarArea area = this.radChartView1.Area as PolarArea; area.StartAngle = 90; area.ShowGrid = true; }