Gallery
JS Accessible Column
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dnc" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Demonstrates Column chart with hatch patterns and accessibility features.
// Set tabIndex chart control and adding description
Chart.JS.Enabled = true;
Chart.JS.Buttons.EnableExportButton=true;
Chart.JS.Buttons.EnablePrintButton = true;
Chart.JS.Settings.Add("description", "%type chart with hatch patterns for accessibility");
Chart.JS.Settings.Add("defaultSeries_tabIndex", "auto");
Chart.JS.Settings.Add("defaultPoint_tabIndex", "auto");
Chart.JS.Settings.Add("legend_defaultEntry_tabIndex", "auto");
Chart.JS.Settings.Add("toolbar_items_export_description", "export menu");
Chart.DefaultSeries.Type = SeriesType.Column;
Chart.Size = "600x480";
Chart.DefaultSeries.PaletteName = Palette.Autumn;
Chart.HatchStylePaletteName = HatchStylePalette.One;
Chart.TempDirectory = "temp";
Chart.Debug = false;
//Chart.LegendBox.Template = "%value %icon %name";
Chart.DefaultElement.SmartLabel.Text = "<b>%Name</b>";
// *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
// Add the random data.
Chart.SeriesCollection.Add(getRandomData());
}
SeriesCollection getRandomData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random(1);
for (int a = 1; a < 2; a++)
{
Series s = new Series();
s.Name = "Series " + a.ToString();
for (int b = 1; b < 6; b++)
{
Element e = new Element();
e.Name = "Element " + b.ToString();
e.YValue = myR.Next(40, 90);
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
SeriesCollection getLiveData()
{
DataEngine de = new DataEngine(ConfigurationManager.AppSettings["DNCConnectionString"]);
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">
<dnc:Chart ID="Chart" Width="600" Height="480" runat="server" />
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dnc" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates Column chart with hatch patterns and accessibility features.
' Set tabIndex chart control and adding description
Chart.JS.Enabled = True
Chart.JS.Buttons.EnableExportButton=True
Chart.JS.Buttons.EnablePrintButton = True
Chart.JS.Settings.Add("description", "%type chart with hatch patterns for accessibility")
Chart.JS.Settings.Add("defaultSeries_tabIndex", "auto")
Chart.JS.Settings.Add("defaultPoint_tabIndex", "auto")
Chart.JS.Settings.Add("legend_defaultEntry_tabIndex", "auto")
Chart.JS.Settings.Add("toolbar_items_export_description", "export menu")
Chart.DefaultSeries.Type = SeriesType.Column
Chart.Size = "600x480"
Chart.DefaultSeries.PaletteName = Palette.Autumn
Chart.HatchStylePaletteName = HatchStylePalette.One
Chart.TempDirectory = "temp"
Chart.Debug = False
'Chart.LegendBox.Template = "%value %icon %name";
Chart.DefaultElement.SmartLabel.Text = "<b>%Name</b>"
' *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
' 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(1)
For a As Integer = 1 To 1
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 = "Element " & b.ToString()
e.YValue = myR.Next(40, 90)
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
Return SC
End Function
Function getLiveData() As SeriesCollection
Dim de As DataEngine = New DataEngine(ConfigurationManager.AppSettings("DNCConnectionString"))
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">
<dnc:Chart ID="Chart" Width="600" Height="480" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsAccessibleColumn.aspx
- Version9.3
- Uses DatabaseNo