Example 50: Gantt Chart in ASP.NET
This sample uses
SeriesFactory class to add bubbles to the
chart using
AddBubble() method.
Steps:
1. Create a new Windows
application project (C#) and name it
Tutorial24_Bubble.
2. Add Super 2d/3d Graph
Library to the toolbox pallete and drag it
to Form1.
3. Add a button.
4. Copy and paste de
following code:
Form Code
using
System;
using
System.Windows.Forms;
using
System.Drawing;
using
Super2d3dGraphLibrary;
namespace
Tutorial24_Bubble
{
public
partial
class
Form1 :
Form
{
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Load(object
sender,
EventArgs
e)
{
// Chart basic setup
super2d3dGraph1.AutoRefresh =
false;
super2d3dGraph1.LicenseeIdentifier =
"PROF";
super2d3dGraph1.Style =
STYLE2D3D.STYLE2D_BUBBLE;
super2d3dGraph1.Title =
"Bubble Chart Sample";
// General look & feel
super2d3dGraph1.CastShadows =
false;
super2d3dGraph1.WallsBackStyle =
STYLEWALLBACKGROUND.STYLEWALLBACKGROUND_GRADIENT_INVERTED;
super2d3dGraph1.WallsBackColorPrincipal =
Color.LightSkyBlue;
super2d3dGraph1.ShowDividerX =
true;
super2d3dGraph1.BackStyle =
STYLEBACKGROUND.STYLEBACKGROUND_GRADIENT_TUBULAR;
// Axis scale setup
super2d3dGraph1.XAxisScaleMinimum
= 0;
super2d3dGraph1.XAxisScaleMaximum = 100;
super2d3dGraph1.XAxisScaleMode =
SCALEMODE.SCALEMODE_FIXED;
super2d3dGraph1.ShowXAxis =
true;
super2d3dGraph1.YAxisScaleMinimum
= 0;
super2d3dGraph1.YAxisScaleMaximum = 100;
super2d3dGraph1.YAxisScaleMode =
SCALEMODE.SCALEMODE_FIXED;
super2d3dGraph1.YAxisNumericFormat =
"0";
// Values setup
super2d3dGraph1.BubbleMaxRadius = 40;
super2d3dGraph1.ShowValues =
false;
// Datatable setup
super2d3dGraph1.DataTableText =
"Bubble Sizes";
super2d3dGraph1.ShowItemsLegend =
true;
super2d3dGraph1.ShowLegendInDataTable =
false;
super2d3dGraph1.ValuesFormat =
"0";
super2d3dGraph1.DataTableFont =
new
Font("Arial",
11);
super2d3dGraph1.DataTableBackColor =
Color.Lavender;
// Legend setup
super2d3dGraph1.ShowLegend =
false;
// Add random values
LoadRandomData();
// Show it
super2d3dGraph1.RefreshChart();
}
private
void
LoadRandomData()
{
SeriesFactory
sf =
new
SeriesFactory();
Random
rnd =
new
Random((int)DateTime.Now.Ticks);
for (int
k = 0; k < 10; k++)
{
sf.AddBubble(rnd.Next(80) + 10, rnd.Next(80)
+ 10, rnd.Next(10));
sf.ItemColor(Color.FromArgb(rnd.Next(255),
rnd.Next(255), rnd.Next(255)));
}
sf.ApplyTo(super2d3dGraph1);
}
private
void
btRandomize_Click(object
sender,
EventArgs
e)
{
LoadRandomData();
}
}
}
Result:

|