Gallery
Streaming
<%@ Page Language="C#" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// Set the title.
//Chart.Title="My Chart";
//Enable streaming
Chart.UseFile = false;
// Change the shading mode
Chart.ShadingEffectMode = ShadingEffectMode.Two;
// Set the x axis label
Chart.ChartArea.XAxis.Label.Text="X Axis Label";
// Set the y axis label
Chart.ChartArea.YAxis.Label.Text="Y Axis Label";
// Set he chart size.
Chart.Width = 600;
Chart.Height = 350;
// Add the random data.
Chart.SeriesCollection.Add(getRandomData());
}
SeriesCollection getRandomData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random();
for(int a = 1; a < 5; a++)
{
Series s = new Series();
s.Name = "Series " + a.ToString();
for(int b = 1; b < 6; b++)
{
Element e = new Element();
e.Name = "E " + b.ToString();
e.YValue = myR.Next(50);
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Streaming 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" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Set the title.
'Chart.Title="My Chart";
'Enable streaming
Chart.UseFile = False
' Change the shading mode
Chart.ShadingEffectMode = ShadingEffectMode.Two
' Set the x axis label
Chart.ChartArea.XAxis.Label.Text="X Axis Label"
' Set the y axis label
Chart.ChartArea.YAxis.Label.Text="Y Axis Label"
' Set he chart size.
Chart.Width = 600
Chart.Height = 350
' Add the random data.
Chart.SeriesCollection.Add(getRandomData())
End Sub
Function getRandomData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim myR As Random = New Random()
For a As Integer = 1 To 4
Dim s As Series = New Series()
s.Name = "Series " & a.ToString()
For b As Integer = 1 To 5
Dim e As Element = New Element()
e.Name = "E " & b.ToString()
e.YValue = myR.Next(50)
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
Return SC
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Streaming Sample</title></head>
<body style="margin:auto;width:800px;">
<dotnet:Chart id="Chart" runat="server"/>
</body>
</html>
- Sample FilenameStreaming.aspx
- Version5.0
- Uses DatabaseNo