Gallery
JS VariwideWithoutZ
<%@ 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 = "Unit Sales by Representative";
Chart.TitleBox.ClearColors();
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.Type = ChartType.Variwide;
Chart.Size = "750x450";
Chart.LegendBox.Visible = false;
Chart.JS.Enabled = true;
Chart.ChartArea.ClearColors();
Chart.YAxis.Label.Text = "Unit Count";
Chart.YAxis.Line.Width = 0;
Chart.DefaultElement.ShowValue = true;
// *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()
{
Series reps = new Series("Representatives");
Element e1 = new Element("Chris",8);
Element e2 = new Element("David",6);
Element e3 = new Element("Arthur",5);
Element e4 = new Element("Angie",3);
reps.AddElements(e1, e2, e3, e4);
reps.PaletteName = Palette.Default;
return new SeriesCollection(reps);
}
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 = "Unit Sales by Representative"
Chart.TitleBox.ClearColors()
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.Type = ChartType.Variwide
Chart.Size = "750x450"
Chart.LegendBox.Visible = False
Chart.JS.Enabled = True
Chart.ChartArea.ClearColors()
Chart.YAxis.Label.Text = "Unit Count"
Chart.YAxis.Line.Width = 0
Chart.DefaultElement.ShowValue = True
' *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 reps As Series = New Series("Representatives")
Dim e1 As Element = New Element("Chris",8)
Dim e2 As Element = New Element("David",6)
Dim e3 As Element = New Element("Arthur",5)
Dim e4 As Element = New Element("Angie",3)
reps.AddElements(e1, e2, e3, e4)
reps.PaletteName = Palette.Default
Return New SeriesCollection(reps)
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 FilenameJsVariwideWithoutZ.aspx
- Version9.2
- Uses DatabaseNo