Gallery
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// Demonstrates a simple Gantt chart with JSCharting.
// Set the chart type
Chart.Type = ChartType.ComboHorizontal;
//Enable JSCharting
Chart.JS.Enabled = true;
// Set the size
Chart.Width = 580;
Chart.Height = 350;
// Set the temp directory
Chart.TempDirectory = "temp";
// Debug mode. ( Will show generated errors if any )
Chart.Debug = false;
Chart.Title = "Project Alpha";
Chart.LegendBox.Visible = false;
Chart.DefaultElement.ShowValue = true;
Chart.DefaultElement.SmartLabel.Text = "%name";
Chart.DefaultElement.ToolTip = "<b>%name</b> <br/>%low - %high<br/>{days(%high-%low)} days";
Chart.DefaultSeries.Type = SeriesType.Column;
Chart.XAxis.Markers.Add(new AxisMarker("Now", Color.Red, new DateTime(2017, 4, 20)));
Chart.XAxis.Markers.Add(new AxisMarker("Vacation", Color.Orange, new DateTime(2017, 5, 12), new DateTime(2017, 6, 1)));
// *DYNAMIC DATA NOTE*
// This sample uses random data to populate the chart. To populate
// a chart with database data see the following resources:
// - Classic samples folder
// - Help File > Data Tutorials
// - Sample: features/DataEngine.aspx
SeriesCollection mySC = getRandomData();
// Add the random data.
Chart.SeriesCollection.Add(mySC);
}
SeriesCollection getRandomData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random();
Series s1 = new Series();
Element e1 = new Element();
e1.YDateTime = new DateTime(2017, 3, 15);
e1.YDateTimeStart = new DateTime(2017, 1, 1);
e1.Name = "Preparations";
s1.Elements.Add(e1);
e1 = new Element();
e1.YDateTime = new DateTime(2017, 4, 20);
e1.YDateTimeStart = new DateTime(2017, 3, 15);
e1.Name = "Execution";
s1.Elements.Add(e1);
e1 = new Element();
e1.YDateTime = new DateTime(2017, 5, 12);
e1.YDateTimeStart = new DateTime(2017, 4, 10);
e1.Name = "Cleanup";
s1.Elements.Add(e1);
e1 = new Element();
e1.YDateTime = new DateTime(2017, 7, 15);
e1.YDateTimeStart = new DateTime(2017, 6, 1);
e1.Name = "Presentation";
s1.Elements.Add(e1);
SC.Add(s1);
return SC;
}
</script>
</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" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates a simple Gantt chart with JSCharting.
' Set the chart type
Chart.Type = ChartType.ComboHorizontal
'Enable JSCharting
Chart.JS.Enabled = True
' Set the size
Chart.Width = 580
Chart.Height = 350
' Set the temp directory
Chart.TempDirectory = "temp"
' Debug mode. ( Will show generated errors if any )
Chart.Debug = False
Chart.Title = "Project Alpha"
Chart.LegendBox.Visible = False
Chart.DefaultElement.ShowValue = True
Chart.DefaultElement.SmartLabel.Text = "%name"
Chart.DefaultElement.ToolTip = "<b>%name</b> <br/>%low - %high<br/>{days(%high-%low)} days"
Chart.DefaultSeries.Type = SeriesType.Column
Chart.XAxis.Markers.Add(New AxisMarker("Now", Color.Red, New DateTime(2017, 4, 20)))
Chart.XAxis.Markers.Add(New AxisMarker("Vacation", Color.Orange, New DateTime(2017, 5, 12), New DateTime(2017, 6, 1)))
' *DYNAMIC DATA NOTE*
' This sample uses random data to populate the chart. To populate
' a chart with database data see the following resources:
' - Classic samples folder
' - Help File > Data Tutorials
' - Sample: features/DataEngine.aspx
Dim mySC As SeriesCollection = getRandomData()
' Add the random data.
Chart.SeriesCollection.Add(mySC)
End Sub
Function getRandomData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim myR As Random = New Random()
Dim s1 As Series = New Series()
Dim e1 As Element = New Element()
e1.YDateTime = New DateTime(2017, 3, 15)
e1.YDateTimeStart = New DateTime(2017, 1, 1)
e1.Name = "Preparations"
s1.Elements.Add(e1)
e1 = New Element()
e1.YDateTime = New DateTime(2017, 4, 20)
e1.YDateTimeStart = New DateTime(2017, 3, 15)
e1.Name = "Execution"
s1.Elements.Add(e1)
e1 = New Element()
e1.YDateTime = New DateTime(2017, 5, 12)
e1.YDateTimeStart = New DateTime(2017, 4, 10)
e1.Name = "Cleanup"
s1.Elements.Add(e1)
e1 = New Element()
e1.YDateTime = New DateTime(2017, 7, 15)
e1.YDateTimeStart = New DateTime(2017, 6, 1)
e1.Name = "Presentation"
s1.Elements.Add(e1)
SC.Add(s1)
Return SC
End Function
</script>
</head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server"/>
</div>
</body>
</html>
- Sample FilenameJsGantt.aspx
- Version8.4
- Uses DatabaseNo