Gallery
JS Variwide
<%@ 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 a Variwide chart type with a single series and point z values.
Chart.Title = "2016 Human Development Index";
Chart.TitleBox.ClearColors();
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.Type = ChartType.Variwide;
Chart.Size = "750x450";
Chart.LegendBox.Visible = false;
Chart.JS.Enabled = true;
Chart.ChartArea.ClearColors();
Chart.YAxis.Line.Visible = false;
Chart.DefaultElement.ToolTip = "<b>%name</b><br>GDP (PPP) per capita: $%yValue<br>HDI: %zValue";
Chart.DefaultElement.ShowValue = true;
Chart.Palette = new Color[] { };//prevents setting palette
Chart.JS.Settings.Add("defaultSeries_palette.colors","['#f7fcfd','#e0ecf4','#bfd3e6','#9ebcda','#8c96c6','#8c6bb1','#88419d','#810f7c','#4d004b']");
Chart.JS.Settings.Add("defaultSeries_palette.pointValue", "%zValue");
Chart.JS.Settings.Add("defaultSeries_palette.ranges", "{min:0.3,max:1,interval:0.05}");
// *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()
{
Series reps = new Series("2016 Human Development Index");
Element e1 = new Element("United States", 59501);
e1.ZValue = 0.796;
Element e2 = new Element("Canada", 49775);
e2.ZValue = 0.839;
Element e3 = new Element("Cuba", 22237);
e3.ZValue = 0.775;
Element e4 = new Element("Mexico", 20028);
e4.ZValue = 0.587;
Element e5 = new Element("Guatemala", 8429);
e5.ZValue = 0.45;
reps.AddElements(e1, e2, e3, e4,e5);
return new SeriesCollection(reps);
}
SeriesCollection getLiveData()
{
DataEngine de = new DataEngine("ConnectionString goes here");
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>
</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 a Variwide chart type with a single series and point z values.
Chart.Title = "2016 Human Development Index"
Chart.TitleBox.ClearColors()
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.Type = ChartType.Variwide
Chart.Size = "750x450"
Chart.LegendBox.Visible = False
Chart.JS.Enabled = True
Chart.ChartArea.ClearColors()
Chart.YAxis.Line.Visible = False
Chart.DefaultElement.ToolTip = "<b>%name</b><br>GDP (PPP) per capita: $%yValue<br>HDI: %zValue"
Chart.DefaultElement.ShowValue = True
Chart.Palette = New Color() { } 'prevents setting palette
Chart.JS.Settings.Add("defaultSeries_palette.colors","['#f7fcfd','#e0ecf4','#bfd3e6','#9ebcda','#8c96c6','#8c6bb1','#88419d','#810f7c','#4d004b']")
Chart.JS.Settings.Add("defaultSeries_palette.pointValue", "%zValue")
Chart.JS.Settings.Add("defaultSeries_palette.ranges", "{min:0.3,max:1,interval:0.05}")
' *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 reps As Series = New Series("2016 Human Development Index")
Dim e1 As Element = New Element("United States", 59501)
e1.ZValue = 0.796
Dim e2 As Element = New Element("Canada", 49775)
e2.ZValue = 0.839
Dim e3 As Element = New Element("Cuba", 22237)
e3.ZValue = 0.775
Dim e4 As Element = New Element("Mexico", 20028)
e4.ZValue = 0.587
Dim e5 As Element = New Element("Guatemala", 8429)
e5.ZValue = 0.45
reps.AddElements(e1, e2, e3, e4,e5)
Return New SeriesCollection(reps)
End Function
Function getLiveData() As SeriesCollection
Dim de As DataEngine = New DataEngine("ConnectionString goes here")
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>
</head>
<body>
<div align="center">
<dotnet:Chart ID="Chart" runat="server" />
</div>
</body>
</html>
- Sample FilenameJsVariwide.aspx
- Version9.2
- Uses DatabaseNo