Gallery
JS Accessible Line
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// This sample deomonstrates Accessible line chart with default offset error bars and a grid view.
// 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", "Line series with default offset error bars");
Chart.JS.Settings.Add("title_tabIndex", "auto");
Chart.JS.Settings.Add("defaultSeries_tabIndex", "auto");
Chart.JS.Settings.Add("defaultPoint_description", "%xValue %percentOfSeries% of %seriesName");
Chart.JS.Settings.Add("legend_defaultEntry_tabIndex", "auto");
Chart.JS.Settings.Add("toolbar_items_export_description", "export menu");
Chart.JS.Settings.Add("annotations.0.description", "Data Accuracy: +/- 5");
Chart.JS.DataGrid.Enabled = true;
Chart.Type = ChartType.Combo;
Chart.Size = "800x350";
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.Title = "Projected Sales [2016]";
Chart.DefaultSeries.Type = SeriesType.Line;
Chart.DefaultSeries.PaletteName = Palette.Bright;
Chart.DefaultElement.ErrorOffset = 5;
Chart.DefaultElement.Marker.Size = 10;
Chart.XAxis.FormatString = "MMM";
Chart.XAxis.Scale = Scale.Time;
Chart.XAxis.TimeInterval = TimeInterval.Month;
Chart.LegendBox.Visible = false;
Annotation an = new Annotation();
an.Label.Text = "Data Accuracy: +/- 5";
an.ClearColors();
an.Position = new Point(20, 25);
Chart.Annotations.Add(an);
// *DYNAMIC DATA NOTE*
// This sample uses random data to populate the chart. To populate
// a chart with database data see the following resources:
// - Classic samples folder
// - Help File > Data Tutorials
// - Sample: features/DataEngine.aspx
SeriesCollection mySC = getRandomData();
// Add the random data.
Chart.SeriesCollection.Add(mySC);
}
SeriesCollection getRandomData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random(1);
DateTime dt = new DateTime(2018, 12, 1);
Series s = new Series();
s.Name = "Projected Sales";
for (int b = 1; b < 13; b++)
{
Element e = new Element();
e.YValue = myR.Next(40, 80);
e.XDateTime = dt = dt.AddMonths(1);
s.Elements.Add(e);
}
SC.Add(s);
return SC;
}
</script>
<style type="text/css">
.dnc {
margin: 0px auto;
max-width: 800px;
}
</style>
</head>
<body>
<dotnet:Chart ID="Chart" runat="server" CssClass="dnc" Width="800" Height="350">
</dotnet:Chart>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' This sample deomonstrates Accessible line chart with default offset error bars and a grid view.
' 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", "Line series with default offset error bars")
Chart.JS.Settings.Add("title_tabIndex", "auto")
Chart.JS.Settings.Add("defaultSeries_tabIndex", "auto")
Chart.JS.Settings.Add("defaultPoint_description", "%xValue %percentOfSeries% of %seriesName")
Chart.JS.Settings.Add("legend_defaultEntry_tabIndex", "auto")
Chart.JS.Settings.Add("toolbar_items_export_description", "export menu")
Chart.JS.Settings.Add("annotations.0.description", "Data Accuracy: +/- 5")
Chart.JS.DataGrid.Enabled = True
Chart.Type = ChartType.Combo
Chart.Size = "800x350"
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.Title = "Projected Sales [2016]"
Chart.DefaultSeries.Type = SeriesType.Line
Chart.DefaultSeries.PaletteName = Palette.Bright
Chart.DefaultElement.ErrorOffset = 5
Chart.DefaultElement.Marker.Size = 10
Chart.XAxis.FormatString = "MMM"
Chart.XAxis.Scale = Scale.Time
Chart.XAxis.TimeInterval = TimeInterval.Month
Chart.LegendBox.Visible = False
Dim an As Annotation = New Annotation()
an.Label.Text = "Data Accuracy: +/- 5"
an.ClearColors()
an.Position = New Point(20, 25)
Chart.Annotations.Add(an)
' *DYNAMIC DATA NOTE*
' This sample uses random data to populate the chart. To populate
' a chart with database data see the following resources:
' - Classic samples folder
' - Help File > Data Tutorials
' - Sample: features/DataEngine.aspx
Dim mySC As SeriesCollection = getRandomData()
' Add the random data.
Chart.SeriesCollection.Add(mySC)
End Sub
Function getRandomData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim myR As Random = New Random(1)
Dim dt As DateTime = New DateTime(2018, 12, 1)
Dim s As Series = New Series()
s.Name = "Projected Sales"
For b As Integer = 1 To 12
Dim e As Element = New Element()
e.YValue = myR.Next(40, 80)
dt = dt.AddMonths(1)
e.XDateTime = dt
s.Elements.Add(e)
Next b
SC.Add(s)
Return SC
End Function
</script>
<style type="text/css">
.dnc {
margin: 0px auto;
max-width: 800px;
}
</style>
</head>
<body>
<dotnet:Chart ID="Chart" runat="server" CssClass="dnc" Width="800" Height="350">
</dotnet:Chart>
</body>
</html>
- Sample FilenameJsAccessibleLine.aspx
- Version9.3
- Uses DatabaseNo