|
|
Sample: Gallery/a034
|
<%@ 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) { // This sample demonstrates stacked bars with shading effect mode Five. // Set the title. Chart.Title="My Chart";
// Turn 3D on. Chart.Use3D = true;
Chart.DefaultElement.Transparency = 30; Chart.PaletteName = Palette.Autumn;
// Set the x axis label Chart.XAxis.Label.Text="X Axis Label";
// Set the y axis label Chart.YAxis.Label.Text="Y Axis Label";
// Set the y axis scale to stacked. Chart.YAxis.Scale = Scale.Stacked;
// Set the directory where the images will be stored. Chart.TempDirectory="temp";
// Set the bar shading effect Chart.ShadingEffectMode = ShadingEffectMode.Five;
// Set the 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 = 0; a < 4; a++) { Series s = new Series(); s.Name = "Series " + a; for(int b = 0; b < 5; b++) { Element e = new Element(); e.Name = "E " + b; e.YValue = myR.Next(50); s.Elements.Add(e); } SC.Add(s); } // Set Different Colors for our Series SC[0].DefaultElement.Color = Color.FromArgb(49,255,49); SC[1].DefaultElement.Color = Color.FromArgb(255,255,0); SC[2].DefaultElement.Color = Color.FromArgb(255,99,49); SC[3].DefaultElement.Color = Color.FromArgb(0,156,255); return SC; } </script> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head> <body> <div style="text-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) ' This sample demonstrates stacked bars with shading effect mode Five. ' Set the title. Chart.Title="My Chart"
' Turn 3D on. Chart.Use3D = True
Chart.DefaultElement.Transparency = 30 Chart.PaletteName = Palette.Autumn
' Set the x axis label Chart.XAxis.Label.Text="X Axis Label"
' Set the y axis label Chart.YAxis.Label.Text="Y Axis Label"
' Set the y axis scale to stacked. Chart.YAxis.Scale = Scale.Stacked
' Set the directory where the images will be stored. Chart.TempDirectory="temp"
' Set the bar shading effect Chart.ShadingEffectMode = ShadingEffectMode.Five
' Set the chart size. Chart.Size = "600X500" ' 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() Dim a As Integer For a = 1 To 4 Dim s As Series = New Series("Series " & a.ToString()) Dim b As Integer For b= 1 To 5 Dim e As Element = New Element() e.Name = "E " & b e.YValue = myR.Next(50) s.Elements.Add(e) Next b SC.Add(s) Next a ' Set Different Colors for our Series SC(0).DefaultElement.Color = Color.FromArgb(49,255,49) SC(1).DefaultElement.Color = Color.FromArgb(255,255,0) SC(2).DefaultElement.Color = Color.FromArgb(255,99,49) SC(3).DefaultElement.Color = Color.FromArgb(0,156,255) Return SC End Function </script> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head> <body> <div style="text-align:center"> <dotnet:Chart id="Chart" runat="server"/> </div> </body> </html>
|
|