Gallery
JS Gridless Gridlines
<%@ 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 adding markers to series that dont use them by default.
Chart.Size = "600x400";
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.JS.Enabled = true;
Chart.JS.Buttons.EnableExportButton = false;
Chart.JS.Buttons.EnablePrintButton = false;
Chart.JS.ControlID = "myJSC";
Chart.LegendBox.Visible = false;
Chart.TitleBox.Visible = false;
Chart.ChartArea.ClearColors();
Chart.YAxis.Line.Width = 0;
Chart.YAxis.DefaultTick.GridLine.Color = Color.LightGray;
// *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);
for (int a = 1; a < 2; a++)
{
Series s = new Series();
s.Name = "Series " + a.ToString();
for (int b = 1; b <7; b++)
{
Element e = new Element();
e.Name = "Element " + b.ToString();
e.YValue = myR.Next(30,100);
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script>
function changeOnTop(val) {
myJSC.axes('y').options({
onTop: val.checked,
defaultTick_gridLine: { color: val.checked ? "white" : "lightgray", }
});
}
</script>
</head>
<body>
<div align="center">
<label style=" font-family:Arial; font-size:small;"><input type="checkbox" name="checkbox" onchange="changeOnTop(this)" onclick="changeOnTop(this)" value="value">Grid lines on top</label>
<br />
<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 adding markers to series that dont use them by default.
Chart.Size = "600x400"
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.JS.Enabled = True
Chart.JS.Buttons.EnableExportButton = False
Chart.JS.Buttons.EnablePrintButton = False
Chart.JS.ControlID = "myJSC"
Chart.LegendBox.Visible = False
Chart.TitleBox.Visible = False
Chart.ChartArea.ClearColors()
Chart.YAxis.Line.Width = 0
Chart.YAxis.DefaultTick.GridLine.Color = Color.LightGray
' *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)
For a As Integer = 1 To 1
Dim s As Series = New Series()
s.Name = "Series " & a.ToString()
For b As Integer = 1 To 6
Dim e As Element = New Element()
e.Name = "Element " & b.ToString()
e.YValue = myR.Next(30,100)
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
Return SC
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script>
function changeOnTop(val) {
myJSC.axes('y').options({
onTop: val.checked,
defaultTick_gridLine: { color: val.checked ? "white" : "lightgray", }
});
}
</script>
</head>
<body>
<div align="center">
<label style=" font-family:Arial; font-size:small;"><input type="checkbox" name="checkbox" onchange="changeOnTop(this)" onclick="changeOnTop(this)" value="value">Grid lines on top</label>
<br />
<dotnet:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsGridlessGridlines.aspx
- Version9.1
- Uses DatabaseNo