Gallery
JS Axis Tick Line Caps
<%@ 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 axis tick line caps.
Chart.Type = ChartType.Combo;
Chart.Size = "700x500";
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.JS.Enabled = true;
Chart.DefaultSeries.Type = SeriesType.Line;
Chart.DefaultElement.Marker.Type = ElementMarkerType.None;
Chart.XAxis.Scale = Scale.Time;
Chart.XAxis.TimeInterval = TimeInterval.Month;
Chart.LegendBox.Visible = false;
Chart.YAxis.FormatString = "c:0";
Chart.YAxis.DefaultTick.Line.DashStyle = DashStyle.Dash;
Chart.YAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor;
Chart.YAxis.DefaultTick.Line.Length = 30;
Chart.XAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor;
Chart.XAxis.DefaultTick.Line.Length = 30;
Chart.XAxis.Orientation = dotnetCHARTING.Orientation.Top;
Chart.DefaultAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor;
Chart.DefaultAxis.DefaultTick.Line.Length = 30;
// Setup the shadow axis and add it.
Axis shadow = Chart.YAxis.Calculate("");
shadow.JsID = "mainY";
shadow.DefaultTick.Line.EndCap = LineCap.ArrowAnchor;
shadow.DefaultTick.Line.Length = 30;
shadow.Orientation = dotnetCHARTING.Orientation.Right;
shadow.ClearValues = true;
shadow.DefaultTick.GridLine.Color = Color.Gray;
shadow.DefaultTick.GridLine.DashStyle = DashStyle.DashDotDot;
shadow.DefaultTick.GridLine.Width= 1;
AxisTick at = new AxisTick();
at.Label.Text = "Average<br/>{%value:c}";
at.Value = "'%average'";
shadow.ExtraTicks.Add(at);
at = new AxisTick();
at.Label.Text = "Max<br/>{%value:c}";
at.Value = "'%max'";
shadow.ExtraTicks.Add(at);
at = new AxisTick();
at.Label.Text = "Min<br/>{%value:c}";
at.Value = "'%min'";
shadow.ExtraTicks.Add(at);
at = new AxisTick();
at.Label.Text = "Range<br/>{%max - %min:c}";
at.Value = "['%min','%max']";
shadow.ExtraTicks.Add(at);
Chart.AxisCollection.Add(shadow);
// *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(2020,1,1);
for(int a = 1; a < 2; a++)
{
Series s = new Series();
s.Name = "Purchases";
for(int b = 1; b < 40; b++)
{
Element e = new Element();
e.YValue = myR.Next(20, 30);
e.XDateTime = dt = dt.AddDays(1);
s.Elements.Add(e);
}
for(int b = 40; b < 66; b++)
{
Element e = new Element();
e.YValue = myR.Next(28, 40);
e.XDateTime = dt = dt.AddDays(1);
s.Elements.Add(e);
}
for(int b = 66; b < 106; b++)
{
Element e = new Element();
e.YValue = myR.Next(20, 40);
e.XDateTime = dt = dt.AddDays(1);
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
</script>
</head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server" Width="700px" Height="500px">
</dotnet:Chart>
</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" %>
<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 axis tick line caps.
Chart.Type = ChartType.Combo
Chart.Size = "700x500"
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.JS.Enabled = True
Chart.DefaultSeries.Type = SeriesType.Line
Chart.DefaultElement.Marker.Type = ElementMarkerType.None
Chart.XAxis.Scale = Scale.Time
Chart.XAxis.TimeInterval = TimeInterval.Month
Chart.LegendBox.Visible = False
Chart.YAxis.FormatString = "c:0"
Chart.YAxis.DefaultTick.Line.DashStyle = DashStyle.Dash
Chart.YAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor
Chart.YAxis.DefaultTick.Line.Length = 30
Chart.XAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor
Chart.XAxis.DefaultTick.Line.Length = 30
Chart.XAxis.Orientation = dotnetCHARTING.Orientation.Top
Chart.DefaultAxis.DefaultTick.Line.EndCap = LineCap.ArrowAnchor
Chart.DefaultAxis.DefaultTick.Line.Length = 30
' Setup the shadow axis and add it.
Dim shadow As Axis = Chart.YAxis.Calculate("")
shadow.JsID = "mainY"
shadow.DefaultTick.Line.EndCap = LineCap.ArrowAnchor
shadow.DefaultTick.Line.Length = 30
shadow.Orientation = dotnetCHARTING.Orientation.Right
shadow.ClearValues = True
shadow.DefaultTick.GridLine.Color = Color.Gray
shadow.DefaultTick.GridLine.DashStyle = DashStyle.DashDotDot
shadow.DefaultTick.GridLine.Width= 1
Dim at As AxisTick = New AxisTick()
at.Label.Text = "Average<br/>{%value:c}"
at.Value = "'%average'"
shadow.ExtraTicks.Add(at)
at = New AxisTick()
at.Label.Text = "Max<br/>{%value:c}"
at.Value = "'%max'"
shadow.ExtraTicks.Add(at)
at = New AxisTick()
at.Label.Text = "Min<br/>{%value:c}"
at.Value = "'%min'"
shadow.ExtraTicks.Add(at)
at = New AxisTick()
at.Label.Text = "Range<br/>{%max - %min:c}"
at.Value = "['%min','%max']"
shadow.ExtraTicks.Add(at)
Chart.AxisCollection.Add(shadow)
' *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(2020,1,1)
For a As Integer = 1 To 1
Dim s As Series = New Series()
s.Name = "Purchases"
For b As Integer = 1 To 39
Dim e As Element = New Element()
e.YValue = myR.Next(20, 30)
dt = dt.AddDays(1)
e.XDateTime = dt
s.Elements.Add(e)
Next b
For b As Integer = 40 To 65
Dim e As Element = New Element()
e.YValue = myR.Next(28, 40)
dt = dt.AddDays(1)
e.XDateTime = dt
s.Elements.Add(e)
Next b
For b As Integer = 66 To 105
Dim e As Element = New Element()
e.YValue = myR.Next(20, 40)
dt = dt.AddDays(1)
e.XDateTime = dt
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
Return SC
End Function
</script>
</head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server" Width="700px" Height="500px">
</dotnet:Chart>
</div>
</body>
</html>
- Sample FilenameJsAxisTickLineCaps.aspx
- Version9.3
- Uses DatabaseNo