Gallery
JS Gantt Dependencies
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// This sample demonstrates InfoGrids on the axis and Gantt dependencies.
// These settings ensure each bar fills the entire space per y axis tick.
Chart.Depth = 0;
Chart.YAxis.DefaultTick.Line.Length = 0;
Chart.YAxis.DefaultTick.GridLine.Color = Color.FromArgb(180, 220, 220, 220);
Chart.YAxis.Line.Color = Color.Transparent;
Chart.YAxis.ClusterColumns = false;
Chart.JS.Enabled = true;
// Specify some styling and other settings
Chart.Type = ChartType.ComboHorizontal;
Chart.Size = "800x400";
Chart.YAxis.CenterTickMarks = false;
Chart.YAxis.SpacingPercentage = 50;
Chart.YAxis.AlternateGridBackground.Color = Color.FromArgb(80, Color.LightGray);
Chart.XAxis.AlternateGridBackground.Color = Color.Empty;
Chart.XAxis.FormatString = "MMM dd";
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.ShadingEffectMode = ShadingEffectMode.Two;
Chart.TitleBox.Label.Text = "Project Dependencies";
Chart.TitleBox.Label.Font = new Font("Arial", 10);
Chart.TitleBox.Position = TitleBoxPosition.FullWithLegend;
Chart.TitleBox.ClearColors();
Chart.LegendBox.Template = "%icon %name";
// The Series.Line object defines gantt dependency line styles.
Chart.DefaultSeries.Line.Color = Color.Black;
Chart.DefaultSeries.Line.EndCap = LineCap.ArrowAnchor;
Chart.DefaultSeries.Line.AnchorCapScale = 3;
SeriesCollection mySC = getRandomData();
// Add the random data.
Chart.SeriesCollection.Add(mySC);
}
SeriesCollection getRandomData()
{
Element e1 = getGanttElement("Project Assignments", new DateTime(2009, 1, 3), 2);
Element e2 = getGanttElement("Outlines / Scope", new DateTime(2009, 1, 5), 2);
Element e3 = getGanttElement("Business Alignment", new DateTime(2009, 1, 7), 2);
Element e4 = getGanttElement("<b>Initiate Project</b>", new DateTime(2009, 1, 3), 6);
e2.Parent = e1;
e3.Parent = e2;
Series s1 = new Series("Initiate Project",e4,e1,e2, e3);
Element f1 = getGanttElement("<b>Plan Project</b>", new DateTime(2009, 1, 10), 10);
Element f2 = getGanttElement("Determine Process", new DateTime(2009, 1, 10), 2);
Element f3 = getGanttElement("Design Layouts", new DateTime(2009, 1, 12), 4);
Element f4 = getGanttElement("Design Structure", new DateTime(2009, 1, 16), 4);
f1.Parent = e1;
f3.Parent = f2;
f4.Parent = f3;
Series s2 = new Series("Plan Project",f1,f2,f3, f4);
Element g1 = getGanttElement("<b>Implement Project</b>", new DateTime(2009, 1, 18), 20);
Element g2 = getGanttElement("Designs", new DateTime(2009, 1, 18), 4);
Element g3 = getGanttElement("Structures", new DateTime(2009, 1, 22), 4);
Element g4 = getGanttElement("D&S Integration", new DateTime(2009, 1, 26), 12);
g2.Parent = f4;
g3.Parent = f4;
Series s3 = new Series("Implement Project",g1,g2,g3, g4);
//Highlight the mainProject bars
decorateMainElement(e4);
decorateMainElement(f1);
decorateMainElement(g1);
//return new SeriesCollection(s3, s2, s1);
return new SeriesCollection(s1,s2,s3);
}
// Applies styling to the main top level gantt elements.
void decorateMainElement(Element e)
{
e.Outline.Color = Color.Black;
e.Outline.Width = 1;
}
// Creates an element based on the specified parameters and applies the y axis tick infoGrid
Element getGanttElement(string name, DateTime start, int durationDays)
{
Element e = new Element(name);
e.YDateTimeStart = start;
e.YDateTime = start.AddDays(durationDays);
return e;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
</head>
<body>
<div align="center">
<dotnet:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' This sample demonstrates InfoGrids on the axis and Gantt dependencies.
' These settings ensure each bar fills the entire space per y axis tick.
Chart.Depth = 0
Chart.YAxis.DefaultTick.Line.Length = 0
Chart.YAxis.DefaultTick.GridLine.Color = Color.FromArgb(180, 220, 220, 220)
Chart.YAxis.Line.Color = Color.Transparent
Chart.YAxis.ClusterColumns = False
Chart.JS.Enabled = True
' Specify some styling and other settings
Chart.Type = ChartType.ComboHorizontal
Chart.Size = "800x400"
Chart.YAxis.CenterTickMarks = False
Chart.YAxis.SpacingPercentage = 50
Chart.YAxis.AlternateGridBackground.Color = Color.FromArgb(80, Color.LightGray)
Chart.XAxis.AlternateGridBackground.Color = Color.Empty
Chart.XAxis.FormatString = "MMM dd"
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.ShadingEffectMode = ShadingEffectMode.Two
Chart.TitleBox.Label.Text = "Project Dependencies"
Chart.TitleBox.Label.Font = New Font("Arial", 10)
Chart.TitleBox.Position = TitleBoxPosition.FullWithLegend
Chart.TitleBox.ClearColors()
Chart.LegendBox.Template = "%icon %name"
' The Series.Line object defines gantt dependency line styles.
Chart.DefaultSeries.Line.Color = Color.Black
Chart.DefaultSeries.Line.EndCap = LineCap.ArrowAnchor
Chart.DefaultSeries.Line.AnchorCapScale = 3
Dim mySC As SeriesCollection = getRandomData()
' Add the random data.
Chart.SeriesCollection.Add(mySC)
End Sub
Function getRandomData() As SeriesCollection
Dim e1 As Element = getGanttElement("Project Assignments", New DateTime(2009, 1, 3), 2)
Dim e2 As Element = getGanttElement("Outlines / Scope", New DateTime(2009, 1, 5), 2)
Dim e3 As Element = getGanttElement("Business Alignment", New DateTime(2009, 1, 7), 2)
Dim e4 As Element = getGanttElement("<b>Initiate Project</b>", New DateTime(2009, 1, 3), 6)
e2.Parent = e1
e3.Parent = e2
Dim s1 As Series = New Series("Initiate Project",e4,e1,e2, e3)
Dim f1 As Element = getGanttElement("<b>Plan Project</b>", New DateTime(2009, 1, 10), 10)
Dim f2 As Element = getGanttElement("Determine Process", New DateTime(2009, 1, 10), 2)
Dim f3 As Element = getGanttElement("Design Layouts", New DateTime(2009, 1, 12), 4)
Dim f4 As Element = getGanttElement("Design Structure", New DateTime(2009, 1, 16), 4)
f1.Parent = e1
f3.Parent = f2
f4.Parent = f3
Dim s2 As Series = New Series("Plan Project",f1,f2,f3, f4)
Dim g1 As Element = getGanttElement("<b>Implement Project</b>", New DateTime(2009, 1, 18), 20)
Dim g2 As Element = getGanttElement("Designs", New DateTime(2009, 1, 18), 4)
Dim g3 As Element = getGanttElement("Structures", New DateTime(2009, 1, 22), 4)
Dim g4 As Element = getGanttElement("D&S Integration", New DateTime(2009, 1, 26), 12)
g2.Parent = f4
g3.Parent = f4
Dim s3 As Series = New Series("Implement Project",g1,g2,g3, g4)
'Highlight the mainProject bars
decorateMainElement(e4)
decorateMainElement(f1)
decorateMainElement(g1)
'return new SeriesCollection(s3, s2, s1);
Return New SeriesCollection(s1,s2,s3)
End Function
' Applies styling to the main top level gantt elements.
Sub decorateMainElement(ByVal e As Element)
e.Outline.Color = Color.Black
e.Outline.Width = 1
End Sub
' Creates an element based on the specified parameters and applies the y axis tick infoGrid
Function getGanttElement(ByVal name As String, ByVal start As DateTime, ByVal durationDays As Integer) As Element
Dim e As Element = New Element(name)
e.YDateTimeStart = start
e.YDateTime = start.AddDays(durationDays)
Return e
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
</head>
<body>
<div align="center">
<dotnet:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsGanttDependencies.aspx
- Version9.3
- Uses DatabaseNo