Gallery
JS Pie Shape Slider
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dnc" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
// Demonstrates how to adjust pie shape elements using 2 sliders with JSC Charts.
Chart.Type = ChartType.Donuts;
Chart.Size = "600x600";
Chart.TitleBox.Label.Text = "Use the sliers to adjust the pie angle and inner size hole";
Chart.TitleBox.Position = TitleBoxPosition.Full;
Chart.TitleBox.ClearColors();
Chart.TitleBox.Label.Font = new Font("Arial", 12, FontStyle.Bold);
Chart.TitleBox.Label.Alignment = StringAlignment.Center;
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.JS.ControlID = "myJSC";
Chart.JS.Enabled = true;
Chart.LegendBox.Template = "%value {%percentOfTotal:n1}% %icon %name";
Chart.LegendBox.Orientation = dotnetCHARTING.Orientation.Bottom;
Chart.DefaultElement.SmartLabel.Text = "<b>%Name</b>";
Chart.DefaultElement.ShowValue = true;
Chart.YAxis.Label.Text = "GDP";
Chart.YAxis.FormatString = "n";
Chart.DonutHoleSize = 10;
Chart.JS.Settings.Add("toolbar_items_angle_type", "range");
Chart.JS.Settings.Add("toolbar_items_angle_margin", "14");
Chart.JS.Settings.Add("toolbar_items_angle_width", "200");
Chart.JS.Settings.Add("toolbar_items_angle_events_change", "js:angleChange");
Chart.JS.Settings.Add("toolbar_items_angle_position", "inside top left");
Chart.JS.Settings.Add("toolbar_items_angle_min", "js:0");
Chart.JS.Settings.Add("toolbar_items_angle_max", "js:360");
Chart.JS.Settings.Add("toolbar_items_angle_value", "js:0");
Chart.JS.Settings.Add("toolbar_items_innerSize_type", "range");
Chart.JS.Settings.Add("toolbar_items_innerSize_margin", "14");
Chart.JS.Settings.Add("toolbar_items_innerSize_width", "200");
Chart.JS.Settings.Add("toolbar_items_innerSize_events_change", "js:innerSizeChange");
Chart.JS.Settings.Add("toolbar_items_innerSize_position", "inside top right");
Chart.JS.Settings.Add("toolbar_items_innerSize_min", "js:0");
Chart.JS.Settings.Add("toolbar_items_innerSize_max", "js:95");
Chart.JS.Settings.Add("toolbar_items_innerSize_value", "js:10");
Chart.JS.Buttons.EnableExportButton = false;
Chart.JS.Buttons.EnablePrintButton = false;
// *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
SeriesCollection mySC = getData();
// Add the random data.
Chart.SeriesCollection.Add(mySC);
}
SeriesCollection getData()
{
SeriesCollection SC = new SeriesCollection();
Series s1 = new Series();
s1.Name = "Countries";
Element el = new Element();
el.Name = "United States";
el.YValue = 5452500;
s1.Elements.Add(el);
el = new Element();
el.Name = "Canada";
el.YValue = 786052;
s1.Elements.Add(el);
el = new Element();
el.Name = "United Kingdom";
el.YValue = 477338;
s1.Elements.Add(el);
el = new Element();
el.Name = "Mexico";
el.YValue = 155313;
s1.Elements.Add(el);
SC.Add(s1);
return SC;
}
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>
<script type="text/javascript">
function angleChange(value) {
var series = myJSC.series(0);
series.options(
{ angle: value }
);
};
function innerSizeChange(value) {
var series = myJSC.series(0);
series.options(
{ shape_innerSize: value + '%'}
);
};
</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" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates how to adjust pie shape elements using 2 sliders with JSC Charts.
Chart.Type = ChartType.Donuts
Chart.Size = "600x600"
Chart.TitleBox.Label.Text = "Use the sliers to adjust the pie angle and inner size hole"
Chart.TitleBox.Position = TitleBoxPosition.Full
Chart.TitleBox.ClearColors()
Chart.TitleBox.Label.Font = New Font("Arial", 12, FontStyle.Bold)
Chart.TitleBox.Label.Alignment = StringAlignment.Center
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.JS.ControlID = "myJSC"
Chart.JS.Enabled = True
Chart.LegendBox.Template = "%value {%percentOfTotal:n1}% %icon %name"
Chart.LegendBox.Orientation = dotnetCHARTING.Orientation.Bottom
Chart.DefaultElement.SmartLabel.Text = "<b>%Name</b>"
Chart.DefaultElement.ShowValue = True
Chart.YAxis.Label.Text = "GDP"
Chart.YAxis.FormatString = "n"
Chart.DonutHoleSize = 10
Chart.JS.Settings.Add("toolbar_items_angle_type", "range")
Chart.JS.Settings.Add("toolbar_items_angle_margin", "14")
Chart.JS.Settings.Add("toolbar_items_angle_width", "200")
Chart.JS.Settings.Add("toolbar_items_angle_events_change", "js:angleChange")
Chart.JS.Settings.Add("toolbar_items_angle_position", "inside top left")
Chart.JS.Settings.Add("toolbar_items_angle_min", "js:0")
Chart.JS.Settings.Add("toolbar_items_angle_max", "js:360")
Chart.JS.Settings.Add("toolbar_items_angle_value", "js:0")
Chart.JS.Settings.Add("toolbar_items_innerSize_type", "range")
Chart.JS.Settings.Add("toolbar_items_innerSize_margin", "14")
Chart.JS.Settings.Add("toolbar_items_innerSize_width", "200")
Chart.JS.Settings.Add("toolbar_items_innerSize_events_change", "js:innerSizeChange")
Chart.JS.Settings.Add("toolbar_items_innerSize_position", "inside top right")
Chart.JS.Settings.Add("toolbar_items_innerSize_min", "js:0")
Chart.JS.Settings.Add("toolbar_items_innerSize_max", "js:95")
Chart.JS.Settings.Add("toolbar_items_innerSize_value", "js:10")
Chart.JS.Buttons.EnableExportButton = False
Chart.JS.Buttons.EnablePrintButton = False
' *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
Dim mySC As SeriesCollection = getData()
' Add the random data.
Chart.SeriesCollection.Add(mySC)
End Sub
Function getData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim s1 As Series = New Series()
s1.Name = "Countries"
Dim el As Element = New Element()
el.Name = "United States"
el.YValue = 5452500
s1.Elements.Add(el)
el = New Element()
el.Name = "Canada"
el.YValue = 786052
s1.Elements.Add(el)
el = New Element()
el.Name = "United Kingdom"
el.YValue = 477338
s1.Elements.Add(el)
el = New Element()
el.Name = "Mexico"
el.YValue = 155313
s1.Elements.Add(el)
SC.Add(s1)
Return SC
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>
<script type="text/javascript">
function angleChange(value) {
var series = myJSC.series(0);
series.options(
{ angle: value }
);
};
function innerSizeChange(value) {
var series = myJSC.series(0);
series.options(
{ shape_innerSize: value + '%'}
);
};
</script>
</head>
<body>
<div align="center">
<dnc:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsPieShapeSlider.aspx
- Version9.2
- Uses DatabaseNo