Gallery
JS Circular Marker
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dnc" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Demonstrates circular Gauge with axis line breaks and a point on top of the axis line.
Chart.Size = "400x450";
Chart.TempDirectory = "temp";
Chart.Type = ChartType.Gauges;
Chart.DefaultSeries.GaugeType = GaugeType.CircularBars;
Chart.Debug = false;
Chart.Palette = new Color[] { };
Chart.LegendBox.Visible = false;
Chart.Size = "400x370";
Chart.ChartArea.ClearColors();
Chart.JS.Enabled = true;
Chart.DefaultSeries.LegendEntry.Visible = false;
//Used to position marker on top of axis line.
Chart.JS.Settings.Add("xAxis_scale_range", "[0,1]");
Chart.JS.Settings.Add("defaultPoint_marker_fill", "white");
Chart.JS.Settings.Add("defaultPoint_marker_outline_width", "10");
Chart.JS.Settings.Add("defaultPoint_marker_type", "circle");
Chart.JS.Settings.Add("defaultPoint_marker_size", "30");
Chart.JS.Settings.Add("defaultSeries_type", "marker");
Chart.JS.Settings.Add("yAxis.line.color", "smartPalette");
Chart.JS.Settings.Add("palette_ranges", "js:ranges");
Chart.JS.Settings.Add("yAxis_customTicks", "[600, 700, 800]");
Chart.YAxis.DefaultTick.Value = "";
// Axis line breaks
Chart.YAxis.LineBreaks.Enabled = true;
Chart.YAxis.LineBreaks.Gap = 0.03;
Chart.YAxis.Line.Width = 15;
Chart.YAxis.ScaleRange = new ScaleRange(350, 850);
Chart.YAxis.TickLabelPadding = 13;
Chart.DefaultElement.ToolTip = "%value";
// *DYNAMIC DATA NOTE*
// This sample uses random data to populate the chart. To populate
// a chart with database data see the following resources:
// - Use the getLiveData() method using the dataEngine to query a database.
// - Help File > Getting Started > Data Tutorials
// - DataEngine Class in the help file
// - Sample: features/DataEngine.aspx
// // Add the random data.
Chart.SeriesCollection.Add(getData());
}
Series getData()
{
Series series = new Series();
series.Type = SeriesType.Marker;
series.Name = "score";
dotnetCHARTING.Label label1 = new dotnetCHARTING.Label();
label1.Text = "<span style='fontSize: 45'>720</span><br><span style='fontSize: 35'>Great!</span>";
label1.LineAlignment = StringAlignment.Center;
series.ShapeLabels.Add(label1);
Element el = new Element();
el.YValueStart =1;
el.YValue = 720;
series.Elements.Add(el);
return series;
}
SeriesCollection getLiveData()
{
DataEngine de = new DataEngine(ConfigurationManager.AppSettings["DNCConnectionString"]);
de.ChartObject = Chart; // Necessary to view any errors the dataEngine may throw.
de.SqlStatement = "SELECT XAxisColumn, YAxisColumn FROM ....";
return de.GetSeries();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<style type="text/css">
</style>
<script type="text/javascript">
var weekdayLabels = [600, 700, 800];
var ranges = [
{ value: 350, color: '#FF5353' },
{ value: 600, color: '#FFD221' },
{ value: 700, color: '#77E6B4' },
{ value: [800, 850], color: '#21D683' }
];
</script>
</head>
<body>
<div align="center">
<dnc:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dnc" 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 circular Gauge with axis line breaks and a point on top of the axis line.
Chart.Size = "400x450"
Chart.TempDirectory = "temp"
Chart.Type = ChartType.Gauges
Chart.DefaultSeries.GaugeType = GaugeType.CircularBars
Chart.Debug = False
Chart.Palette = New Color() { }
Chart.LegendBox.Visible = False
Chart.Size = "400x370"
Chart.ChartArea.ClearColors()
Chart.JS.Enabled = True
Chart.DefaultSeries.LegendEntry.Visible = False
'Used to position marker on top of axis line.
Chart.JS.Settings.Add("xAxis_scale_range", "[0,1]")
Chart.JS.Settings.Add("defaultPoint_marker_fill", "white")
Chart.JS.Settings.Add("defaultPoint_marker_outline_width", "10")
Chart.JS.Settings.Add("defaultPoint_marker_type", "circle")
Chart.JS.Settings.Add("defaultPoint_marker_size", "30")
Chart.JS.Settings.Add("defaultSeries_type", "marker")
Chart.JS.Settings.Add("yAxis.line.color", "smartPalette")
Chart.JS.Settings.Add("palette_ranges", "js:ranges")
Chart.JS.Settings.Add("yAxis_customTicks", "[600, 700, 800]")
Chart.YAxis.DefaultTick.Value = ""
' Axis line breaks
Chart.YAxis.LineBreaks.Enabled = True
Chart.YAxis.LineBreaks.Gap = 0.03
Chart.YAxis.Line.Width = 15
Chart.YAxis.ScaleRange = New ScaleRange(350, 850)
Chart.YAxis.TickLabelPadding = 13
Chart.DefaultElement.ToolTip = "%value"
' *DYNAMIC DATA NOTE*
' This sample uses random data to populate the chart. To populate
' a chart with database data see the following resources:
' - Use the getLiveData() method using the dataEngine to query a database.
' - Help File > Getting Started > Data Tutorials
' - DataEngine Class in the help file
' - Sample: features/DataEngine.aspx
' // Add the random data.
Chart.SeriesCollection.Add(getData())
End Sub
Function getData() As Series
Dim series As Series = New Series()
series.Type = SeriesType.Marker
series.Name = "score"
Dim label1 As dotnetCHARTING.Label = New dotnetCHARTING.Label()
label1.Text = "<span style='fontSize: 45'>720</span><br><span style='fontSize: 35'>Great!</span>"
label1.LineAlignment = StringAlignment.Center
series.ShapeLabels.Add(label1)
Dim el As Element = New Element()
el.YValueStart =1
el.YValue = 720
series.Elements.Add(el)
Return series
End Function
Function getLiveData() As SeriesCollection
Dim de As DataEngine = New DataEngine(ConfigurationManager.AppSettings("DNCConnectionString"))
de.ChartObject = Chart ' Necessary to view any errors the dataEngine may throw.
de.SqlStatement = "SELECT XAxisColumn, YAxisColumn FROM ...."
Return de.GetSeries()
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<style type="text/css">
</style>
<script type="text/javascript">
var weekdayLabels = [600, 700, 800];
var ranges = [
{ value: 350, color: '#FF5353' },
{ value: 600, color: '#FFD221' },
{ value: 700, color: '#77E6B4' },
{ value: [800, 850], color: '#21D683' }
];
</script>
</head>
<body>
<div align="center">
<dnc:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsCircularMarker.aspx
- Version10.3
- Uses DatabaseNo