Gallery
JS Axis Line Caps
<%@ Page Language="C#" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// Demonstrates arrow and circle axis line caps.
// Enable JSCharting
Chart.JS.Enabled = true;
// Set the directory where the related JSC files will be created and stored.
Chart.TempDirectory="temp";
// Specify chart type.
Chart.Type = ChartType.Combo;
Chart.DefaultSeries.Type = SeriesType.Spline;
Chart.DefaultSeries.DefaultElement.Color = Color.FromArgb(0,191,128);
// Set he chart size.
Chart.Width = 700;
Chart.Height = 450;
Chart.DefaultElement.ToolTip = "<b>%name</b> %yValue�C";
Chart.DefaultElement.Marker.Visible = false;
// Set the title.
Chart.TitleBox.Label.Text = "Average Temperature (�C)";
Chart.TitleBox.Label.Font = new Font("Arial", 15, FontStyle.Bold);
Chart.TitleBox.ClearColors();
Chart.ChartArea.LegendBox.Visible = false;
Chart.Debug = false;
Chart.YAxis.DefaultTick.Label.Font = new Font("Arial", 10, FontStyle.Bold);
Chart.YAxis.Label.Text = "";
Chart.YAxis.DefaultTick.Label.Text = "%value�C";
Chart.YAxis.Line.Width = 5;
Chart.YAxis.Line.Color = Color.FromArgb(119, 162, 238);
Chart.YAxis.Line.StartCap = System.Drawing.Drawing2D.LineCap.Round;
Chart.YAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
Chart.YAxis.Line.AnchorCapScale = 2;
Chart.YAxis.DefaultTick.Line.Color = Color.FromArgb(119, 162, 238);
AxisMarker am = new AxisMarker(" ", Color.FromArgb(119,162,238), 0);
am.Line.Width = 3;
Chart.YAxis.Markers.Add(am);
Chart.XAxis.Line.Width = 5;
Chart.XAxis.Line.Color = Color.FromArgb(119, 162, 238);
Chart.XAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
Chart.XAxis.Line.AnchorCapScale = 2;
Chart.XAxis.DefaultTick.Line.Color = Color.FromArgb(119, 162, 238);
Chart.XAxis.TimeInterval = TimeInterval.Month;
Chart.XAxis.FormatString = "MMM";
// Add the random data.
Chart.SeriesCollection.Add(getRandomData());
}
SeriesCollection getRandomData()
{
DateTime[] dta = {
new DateTime(2014, 1, 1),
new DateTime(2014, 2, 1),
new DateTime(2014, 3, 1),
new DateTime(2014, 4, 1),
new DateTime(2014, 5, 1),
new DateTime(2014, 6, 1),
new DateTime(2014, 7, 1),
new DateTime(2014, 8, 1),
new DateTime(2014, 9, 1),
new DateTime(2014, 10, 1),
new DateTime(2014, 11, 1),
new DateTime(2014, 12, 1)
};
double[] vla = { -6.5, -6.7, -1, 6.7, 13.2, 17, 19.2, 17, 11.3, 5.6, -1.2, -5.2 };
SeriesCollection SC = new SeriesCollection();
Random myR = new Random();
for(int a = 1; a < 2; a++)
{
Series s = new Series();
s.Name = "Average Temp Range";
for(int b = 0; b < 12; b++)
{
Element e = new Element();
e.XDateTime = dta[b];
e.YValue = vla[b];
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery 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" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates arrow and circle axis line caps.
' Enable JSCharting
Chart.JS.Enabled = True
' Set the directory where the related JSC files will be created and stored.
Chart.TempDirectory="temp"
' Specify chart type.
Chart.Type = ChartType.Combo
Chart.DefaultSeries.Type = SeriesType.Spline
Chart.DefaultSeries.DefaultElement.Color = Color.FromArgb(0,191,128)
' Set he chart size.
Chart.Width = 700
Chart.Height = 450
Chart.DefaultElement.ToolTip = "<b>%name</b> %yValue�C"
Chart.DefaultElement.Marker.Visible = False
' Set the title.
Chart.TitleBox.Label.Text = "Average Temperature (�C)"
Chart.TitleBox.Label.Font = New Font("Arial", 15, FontStyle.Bold)
Chart.TitleBox.ClearColors()
Chart.ChartArea.LegendBox.Visible = False
Chart.Debug = False
Chart.YAxis.DefaultTick.Label.Font = New Font("Arial", 10, FontStyle.Bold)
Chart.YAxis.Label.Text = ""
Chart.YAxis.DefaultTick.Label.Text = "%value�C"
Chart.YAxis.Line.Width = 5
Chart.YAxis.Line.Color = Color.FromArgb(119, 162, 238)
Chart.YAxis.Line.StartCap = System.Drawing.Drawing2D.LineCap.Round
Chart.YAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor
Chart.YAxis.Line.AnchorCapScale = 2
Chart.YAxis.DefaultTick.Line.Color = Color.FromArgb(119, 162, 238)
Dim am As AxisMarker = New AxisMarker(" ", Color.FromArgb(119,162,238), 0)
am.Line.Width = 3
Chart.YAxis.Markers.Add(am)
Chart.XAxis.Line.Width = 5
Chart.XAxis.Line.Color = Color.FromArgb(119, 162, 238)
Chart.XAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor
Chart.XAxis.Line.AnchorCapScale = 2
Chart.XAxis.DefaultTick.Line.Color = Color.FromArgb(119, 162, 238)
Chart.XAxis.TimeInterval = TimeInterval.Month
Chart.XAxis.FormatString = "MMM"
' Add the random data.
Chart.SeriesCollection.Add(getRandomData())
End Sub
Function getRandomData() As SeriesCollection
Dim dta As DateTime() = { New DateTime(2014, 1, 1), New DateTime(2014, 2, 1), New DateTime(2014, 3, 1), New DateTime(2014, 4, 1), New DateTime(2014, 5, 1), New DateTime(2014, 6, 1), New DateTime(2014, 7, 1), New DateTime(2014, 8, 1), New DateTime(2014, 9, 1), New DateTime(2014, 10, 1), New DateTime(2014, 11, 1), New DateTime(2014, 12, 1) }
Dim vla As Double() = { -6.5, -6.7, -1, 6.7, 13.2, 17, 19.2, 17, 11.3, 5.6, -1.2, -5.2 }
Dim SC As SeriesCollection = New SeriesCollection()
Dim myR As Random = New Random()
For a As Integer = 1 To 1
Dim s As Series = New Series()
s.Name = "Average Temp Range"
For b As Integer = 0 To 11
Dim e As Element = New Element()
e.XDateTime = dta(b)
e.YValue = vla(b)
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>Gallery Sample</title></head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server"/>
</div>
</body>
</html>
- Sample FilenameJsAxisLineCaps.aspx
- Version9.3
- Uses DatabaseNo