Gallery
JS Variwide Multi
<%@ 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 Variwide chart using z point values with crosshair and combined tooltip.
Chart.TitleBox.Label.Text = "Worldwide Smartphone Sales to End Users by Vendor";
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.Type = ChartType.Variwide;
Chart.Size = "750x450";
Chart.JS.Enabled = true;
Chart.XAxis.Label.Text = "Vendors";
Chart.YAxis.Label.Text = "Thousands of Units Sold";
Chart.DefaultSeries.DefaultElement.ToolTip = "js:'<span style=\"width:50px; color:%color;\">%seriesName</span><span style=\"width:50px\"> %yValue</span><span style=\"width:40px\">%zValue%</span>'";
Chart.DefaultElement.ShowValue = false;
Chart.JS.Settings.Add("defaultTooltip.label.text","js:'<span style=\"width:50px\">Quarter</span><span style=\"width:50px\">Units</span><span style=\"width:40px\">Share</span><hr>%points'");
Chart.JS.Settings.Add("xAxis.crosshair.enabled", "true");
Chart.JS.Settings.Add("xAxis.crosshair.gridLine.width", "column");
Chart.JS.Settings.Add("xAxis.crosshair.gridLine.opacity:", "true");
// *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 companies = new Series("4Q14");
Element e1 = new Element("Samsung", 73031);
Element e2 = new Element("Apple", 74831 );
Element e3 = new Element("Huawei", 21038);
Element e4 = new Element("Xiaomi", 18581 );
e1.ZValue = 19.9;
e2.ZValue = 20.4;
e3.ZValue = 5.7;
e4.ZValue = 5.1;
companies.AddElements(e1, e2, e3, e4);
sc.Add(companies);
companies = new Series("4Q15");
e1 = new Element("Samsung", 83437);
e2 = new Element("Apple", 71525 );
e3 = new Element("Huawei", 32116 );
e4 = new Element("Xiaomi", 18216 );
e1.ZValue = 20.7;
e2.ZValue = 17.7;
e3.ZValue = 8;
e4.ZValue = 4.5;
companies.AddElements(e1, e2, e3, e4);
sc.Add(companies);
companies = new Series("4Q16");
e1 = new Element("Samsung",76782 );
e2 = new Element("Apple", 77038 );
e3 = new Element("Huawei", 40803);
e4 = new Element("Xiaomi", 15751);
e1.ZValue = 17.8;
e2.ZValue = 17.8;
e3.ZValue = 9.4;
e4.ZValue = 3.6;
companies.AddElements(e1, e2, e3, e4);
sc.Add(companies);
companies = new Series("4Q17");
e1 = new Element("Samsung",74026 );
e2 = new Element("Apple", 73175 );
e3 = new Element("Huawei", 43887 );
e4 = new Element("Xiaomi", 28187 );
e1.ZValue = 18.2;
e2.ZValue = 17.9;
e3.ZValue = 10.8;
e4.ZValue = 6.9;
companies.AddElements(e1, e2, e3, e4);
sc.Add(companies);
return sc;
}
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 Variwide chart using z point values with crosshair and combined tooltip.
Chart.TitleBox.Label.Text = "Worldwide Smartphone Sales to End Users by Vendor"
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.Type = ChartType.Variwide
Chart.Size = "750x450"
Chart.JS.Enabled = True
Chart.XAxis.Label.Text = "Vendors"
Chart.YAxis.Label.Text = "Thousands of Units Sold"
Chart.DefaultSeries.DefaultElement.ToolTip = "js:'<span style=""width:50px; color:%color;"">%seriesName</span><span style=""width:50px""> %yValue</span><span style=""width:40px"">%zValue%</span>'"
Chart.DefaultElement.ShowValue = False
Chart.JS.Settings.Add("defaultTooltip.label.text","js:'<span style=""width:50px"">Quarter</span><span style=""width:50px"">Units</span><span style=""width:40px"">Share</span><hr>%points'")
Chart.JS.Settings.Add("xAxis.crosshair.enabled", "true")
Chart.JS.Settings.Add("xAxis.crosshair.gridLine.width", "column")
Chart.JS.Settings.Add("xAxis.crosshair.gridLine.opacity:", "true")
' *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 companies As Series = New Series("4Q14")
Dim e1 As Element = New Element("Samsung", 73031)
Dim e2 As Element = New Element("Apple", 74831)
Dim e3 As Element = New Element("Huawei", 21038)
Dim e4 As Element = New Element("Xiaomi", 18581)
e1.ZValue = 19.9
e2.ZValue = 20.4
e3.ZValue = 5.7
e4.ZValue = 5.1
companies.AddElements(e1, e2, e3, e4)
sc.Add(companies)
companies = New Series("4Q15")
e1 = New Element("Samsung", 83437)
e2 = New Element("Apple", 71525)
e3 = New Element("Huawei", 32116)
e4 = New Element("Xiaomi", 18216)
e1.ZValue = 20.7
e2.ZValue = 17.7
e3.ZValue = 8
e4.ZValue = 4.5
companies.AddElements(e1, e2, e3, e4)
sc.Add(companies)
companies = New Series("4Q16")
e1 = New Element("Samsung",76782)
e2 = New Element("Apple", 77038)
e3 = New Element("Huawei", 40803)
e4 = New Element("Xiaomi", 15751)
e1.ZValue = 17.8
e2.ZValue = 17.8
e3.ZValue = 9.4
e4.ZValue = 3.6
companies.AddElements(e1, e2, e3, e4)
sc.Add(companies)
companies = New Series("4Q17")
e1 = New Element("Samsung",74026)
e2 = New Element("Apple", 73175)
e3 = New Element("Huawei", 43887)
e4 = New Element("Xiaomi", 28187)
e1.ZValue = 18.2
e2.ZValue = 17.9
e3.ZValue = 10.8
e4.ZValue = 6.9
companies.AddElements(e1, e2, e3, e4)
sc.Add(companies)
Return sc
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 FilenameJsVariwideMulti.aspx
- Version9.2
- Uses DatabaseNo