Gallery
JS VariwideStWithoutZ
<%@ 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)
{
// Demonstrates a Variwide chart without z values. Y values are used.
Chart.Title = "Sales by quarter";
Chart.TitleBox.ClearColors();
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.Type = ChartType.Variwide;
Chart.Size = "750x450";
Chart.LegendBox.Position = LegendBoxPosition.ChartArea;
Chart.YAxis.Scale = Scale.Stacked;
Chart.JS.Enabled = true;
Chart.YAxis.Label.Text = "USD";
Chart.DefaultElement.ShowValue = false;
// *DYNAMIC DATA NOTE*
// This sample uses random data to populate the chart. To populate
// a chart with database data see the following resources:
// - Use the getLiveData() method using the dataEngine to query a database.
// - Help File > Getting Started > Data Tutorials
// - DataEngine Class in the help file
// - Sample: features/DataEngine.aspx
SeriesCollection mySC = getData();
// Add the random data.
Chart.SeriesCollection.Add(mySC);
}
SeriesCollection getData()
{
SeriesCollection sc = new SeriesCollection();
Series reps = new Series("Gross Sales");
Element e1 = new Element( "Q1", 20120);
Element e2 = new Element( "Q2", 53465);
Element e3 = new Element( "Q3", 66165);
Element e4 = new Element("Q4", 52156);
reps.AddElements(e1, e2, e3, e4);
sc.Add(reps);
reps = new Series("Net Sales");
e1 = new Element("Q1", 12654);
e2 = new Element ("Q2", 25645);
e3 = new Element ("Q3", 52651);
e4 = new Element ("Q4", 30153);
reps.AddElements(e1, e2, e3, e4);
sc.Add(reps);
return sc;
}
SeriesCollection getLiveData()
{
DataEngine de = new DataEngine("ConnectionString goes here");
de.ChartObject = Chart; // Necessary to view any errors the dataEngine may throw.
de.SqlStatement = "SELECT XAxisColumn, YAxisColumn FROM ....";
return de.GetSeries();
}
</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)
' Demonstrates a Variwide chart without z values. Y values are used.
Chart.Title = "Sales by quarter"
Chart.TitleBox.ClearColors()
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.Type = ChartType.Variwide
Chart.Size = "750x450"
Chart.LegendBox.Position = LegendBoxPosition.ChartArea
Chart.YAxis.Scale = Scale.Stacked
Chart.JS.Enabled = True
Chart.YAxis.Label.Text = "USD"
Chart.DefaultElement.ShowValue = False
' *DYNAMIC DATA NOTE*
' This sample uses random data to populate the chart. To populate
' a chart with database data see the following resources:
' - Use the getLiveData() method using the dataEngine to query a database.
' - Help File > Getting Started > Data Tutorials
' - DataEngine Class in the help file
' - Sample: features/DataEngine.aspx
Dim mySC As SeriesCollection = getData()
' Add the random data.
Chart.SeriesCollection.Add(mySC)
End Sub
Function getData() As SeriesCollection
Dim sc As SeriesCollection = New SeriesCollection()
Dim reps As Series = New Series("Gross Sales")
Dim e1 As Element = New Element("Q1", 20120)
Dim e2 As Element = New Element("Q2", 53465)
Dim e3 As Element = New Element("Q3", 66165)
Dim e4 As Element = New Element("Q4", 52156)
reps.AddElements(e1, e2, e3, e4)
sc.Add(reps)
reps = New Series("Net Sales")
e1 = New Element("Q1", 12654)
e2 = New Element ("Q2", 25645)
e3 = New Element ("Q3", 52651)
e4 = New Element ("Q4", 30153)
reps.AddElements(e1, e2, e3, e4)
sc.Add(reps)
Return sc
End Function
Function getLiveData() As SeriesCollection
Dim de As DataEngine = New DataEngine("ConnectionString goes here")
de.ChartObject = Chart ' Necessary to view any errors the dataEngine may throw.
de.SqlStatement = "SELECT XAxisColumn, YAxisColumn FROM ...."
Return de.GetSeries()
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 FilenameJsVariwideStWithoutZ.aspx
- Version9.2
- Uses DatabaseNo