Defines objects used to fill a specified section or point on an axis.
For a list of all members of this type, see AxisMarker members.
Object Model
Inheritance Hierarchy
System.Object
dotnetCHARTING.ScaleRange
dotnetCHARTING.AxisMarker
Syntax
[Visual Basic]
Public Class AxisMarker
Inherits ScaleRange
Remarks
Each marker displayed on the chart will also have a LegendEntry in
the LegendBox.
There are two ways to use AxisMarkers.
- Attach to axis
An AxisMarker can be added to the Markers collection of any axis. In
this case, a numeric, time, or text: value or range must be specified.
When Value is specified, ValueLow and ValueHigh are both set to this value.
When ValueLow and ValueHigh are equivalent, this AxisMarker is represented by
the Line object, otherwise, Background fills the range between ValueLow and
ValueHigh. - Attach to element
An AxisMarker is instantiated and passed to the AxisMarker property
of any element. In such a case, the axis marker is drawn on the Axis where
the element's name is displayed.
Example
[C#] This sample will demonstrates how to use and attach axis markers to axes and elements.
<%@ Page Language="C#" Description="dotnetCHARTING Component" %> <%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%> <%@ Import Namespace="System.Drawing" %> <HTML> <HEAD> <TITLE>.netCHARTING Sample</TITLE> <script runat="server"> void Page_Load(Object sender,EventArgs e) { Chart.Type = ChartType.Combo;//Horizontal; Chart.Width = 600; Chart.Height = 350; Chart.TempDirectory = "temp"; Chart.Debug = true; Chart.DefaultSeries.Type = SeriesType.Spline; Chart.LegendBox.Orientation = Orientation.Bottom; Chart.LegendBox.Template="%name %icon"; // This sample will demonstrates how to use and attach axis markers to axes and elements. // *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(); // 1. SINGLE VALUES AxisMarker am1 = new AxisMarker("Marker at 45",new Line(Color.Orange),45); Chart.YAxis.Markers.Add(am1); AxisMarker am2 = new AxisMarker("Text marker at 'Element 0'",new Line(Color.Green),"Element 0"); Chart.XAxis.Markers.Add(am2); // 2. RANGE MARKERS AxisMarker am3 = new AxisMarker("20-30",new Background(Color.FromArgb(100,Color.LightGreen)),20,30); Chart.YAxis.Markers.Add(am3); AxisMarker am4 = new AxisMarker("'Element 1'-'Element 2'",new Background(Color.FromArgb(100,Color.LightBlue)),"Element 1","Element 2"); am4.Label.LineAlignment = StringAlignment.Near; Chart.XAxis.Markers.Add(am4); // 3.ELEMENT MARKERS mySC[0].Elements[3].AxisMarker = new AxisMarker("Attached to element 3",new Line(Color.Blue),0); // Add the random data. Chart.SeriesCollection.Add(mySC); } SeriesCollection getRandomData() { SeriesCollection SC = new SeriesCollection(); Random myR = new Random(); for(int a = 0; a < 4; a++) { Series s = new Series(); s.Name = "Series " + a; for(int b = 0; b < 4; b++) { Element e = new Element(); e.Name = "Element " + b; //e.YValue = -25 + myR.Next(50); e.YValue = myR.Next(50); s.Elements.Add(e); } SC.Add(s); } // Set Different Colors for our Series SC[0].DefaultElement.Color = Color.FromArgb(49,255,49); SC[1].DefaultElement.Color = Color.FromArgb(255,255,0); SC[2].DefaultElement.Color = Color.FromArgb(255,99,49); SC[3].DefaultElement.Color = Color.FromArgb(0,156,255); return SC; } </script> </HEAD> <BODY> <DIV align="center"> <dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px"> </dotnet:Chart> </DIV> </BODY> </HTML> |
[Visual Basic] This sample will demonstrates how to use and attach axis markers to axes and elements.
<%@ Page Language="VB" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<HTML>
<HEAD>
<TITLE>.netCHARTING Sample</TITLE>
<script runat="server">
Sub Page_Load(sender As [Object], e As EventArgs)
Chart.Type = ChartType.Combo
Chart.Width = Unit.Parse(600)
Chart.Height = Unit.Parse(350)
Chart.TempDirectory = "temp"
Chart.Debug = True
Chart.DefaultSeries.Type = SeriesType.Spline
Chart.LegendBox.Orientation = Orientation.Bottom
Chart.LegendBox.Template="%name %icon"
Dim mySC As SeriesCollection = getRandomData()
Dim am1 As New AxisMarker("Marker at 45", New Line(Color.Orange), 45)
Chart.YAxis.Markers.Add(am1)
Dim am2 As New AxisMarker("Text marker at 'Element 0'", New Line(Color.Green), "Element 0")
Chart.XAxis.Markers.Add(am2)
Dim am3 As New AxisMarker("20-30", New Background(Color.FromArgb(100, Color.LightGreen)), 20, 30)
Chart.YAxis.Markers.Add(am3)
Dim am4 As New AxisMarker("'Element 1'-'Element 2'", New Background(Color.FromArgb(100, Color.LightBlue)), "Element 1", "Element 2")
am4.Label.LineAlignment = StringAlignment.Near
Chart.XAxis.Markers.Add(am4)
mySC(0).Elements(3).AxisMarker = New AxisMarker("Attached to element 3", New Line(Color.Blue), 0)
Chart.SeriesCollection.Add(mySC)
End Sub
Function getRandomData() As SeriesCollection
Dim SC As New SeriesCollection()
Dim myR As New Random()
Dim a As Integer
For a = 0 To 3
Dim s As New Series()
s.Name = "Series " + a.ToString()
Dim b As Integer
For b = 0 To 3
Dim e As New Element()
e.Name = "Element " + b.ToString()
e.YValue = myR.Next(50)
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
SC(0).DefaultElement.Color = Color.FromArgb(49, 255, 49)
SC(1).DefaultElement.Color = Color.FromArgb(255, 255, 0)
SC(2).DefaultElement.Color = Color.FromArgb(255, 99, 49)
SC(3).DefaultElement.Color = Color.FromArgb(0, 156, 255)
Return SC
End Function
</script>
</HEAD>
<BODY>
<DIV align="center">
<dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px">
</dotnet:Chart>
</DIV>
</BODY>
</HTML> |
See Also
AxisMarker Members
| dotnetCHARTING Namespace
2002 - 2005 Webavail Productions Inc. & Corporate Web Solutions Ltd.. All Rights Reserved.