Home
.NET components

 

 
Overview Features Gallery Free Trial Support Purchase
         

Tutorials index / Example 26: Radar chart

Radar chart sample:

Steps:

1. Create a new Windows application project (C#). Name it "Tutorial26_RadarChart".

2. Add Super 2d/3d Graph Library to the toolbox pallete and drag it to Form1.

3. Copy and paste de following code:

 

 Form Code

using System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Drawing.Drawing2D;
using
System.Text;
using
System.Windows.Forms;
using
Super2d3dGraphLibrary;

namespace Tutorial26_RadarChart
{

public partial class Form1 : Form
{

   public Form1()
  
{
  
   InitializeComponent();
  
}

   private void Form1_Load(object sender, EventArgs e)
   {
      // Main settings
      super2d3dGraph1.LicenseeIdentifier = "PROF";
      super2d3dGraph1.Style = STYLE2D3D.STYLE2D_RADAR;
      super2d3dGraph1.Title = "St. Marie Homes Expenses";

      // Background style
      super2d3dGraph1.BackColor = Color.LightSkyBlue;
      super2d3dGraph1.BackStyle = STYLEBACKGROUND.STYLEBACKGROUND_GRADIENT_TUBULAR_INVERTED;

      // Radar grid style
      super2d3dGraph1.WallsBackColorPrincipal = Color.FromArgb(255, 255, 255);
      super2d3dGraph1.WallsBackColorSecondary = Color.FromArgb(220, 220, 220);
      super2d3dGraph1.GridLineStyle = new Pen(Color.DarkGray);
      super2d3dGraph1.ShowPoints = false;

      // Y-axis style
     
super2d3dGraph1.YAxisScaleMaximum = 100;
      super2d3dGraph1.YAxisScaleMinimum = 0;
      super2d3dGraph1.YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED;
     
super2d3dGraph1.YAxisDividersCount = 5;
      super2d3dGraph1.YAxisNumericFormat = "c0"; // currency format, no decimals
      super2d3dGraph1.YAxisLocation = STYLEYAXISLOCATION.STYLEYAXISLOCATION_LEFT;
      super2d3dGraph1.YAxisValuesFont = new Font("Arial", 11, FontStyle.Bold);

      // Series customization
      super2d3dGraph1.SeriesColor = new Color[] { Color.Red, Color.Blue };
      super2d3dGraph1.SeriesLineStyle = new Pen[] { new Pen(Color.Red, 2), new Pen(Color.Blue, 2) };
      super2d3dGraph1.SeriesFillStyle = new HatchBrush[] {
new HatchBrush( HatchStyle.BackwardDiagonal, Color.FromArgb(128, Color.Red), Color.FromArgb(128, Color.White)), new HatchBrush(HatchStyle.Vertical, Color.FromArgb(128, Color.Blue), Color.FromArgb(128, Color.White)) };
      super2d3dGraph1.ShowLegend = false;
      super2d3dGraph1.SeriesLegend = new String[] { "2006", "2007" };

   // Items customization
      super2d3dGraph1.ItemsLegend = new String[] { "Maintenance", "Salaries", "Advertising", "Taxes & Debt", "Laundry", "Services" };
      super2d3dGraph1.XAxisColor = Color.Brown;
      super2d3dGraph1.XAxisValuesFont = new Font("Arial", 10);

      // Data (2 series of 6 random values each)
      Random rnd = new Random((int)System.DateTime.Now.Ticks);
      SeriesFactory sf = new SeriesFactory();
      for (int series=0;series<2;series++) {
         sf.NewSerie();
         for (int values=0;values<6;values++) {
            sf.AddValue(rnd.NextDouble()*100);
         }
      }

      // Datatable customization
     
super2d3dGraph1.Series = sf.Series;
      super2d3dGraph1.DataTableText = "";
      super2d3dGraph1.ValuesFormat = "c";
      super2d3dGraph1.ShowItemsLegend = true;
      super2d3dGraph1.DataTableFont = new Font("Arial", 11);

      // Refresh chart
     
super2d3dGraph1.RefreshChart();

   }

}

}

 Result:


 

 

 
Top