Gallery
<%@ Import Namespace="System.Drawing" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// Demonstrates a thmatic election map.
Chart.Type = ChartType.Map;//Horizontal;
Chart.Width = 600;
Chart.Height = 450;
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.JS.Enabled = true;
Chart.LegendBox.Visible = false;
Chart.TitleBox.Label.Text = "2012 Presidential Election Results (Obama vs. Romney)";
// *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
Chart.DefaultElement.ToolTip = "%name<br/><b>Obama</b>: %obama% <br/><b>Romney</b>: %Romney%";
Chart.DefaultElement.ShowValue = true;
Chart.DefaultElement.SmartLabel.Text = "%stateCode";
Chart.SmartPalette.Add("*", new SmartColor(Color.FromArgb(187, 78, 85), Color.FromArgb(187, 78, 85), new ScaleRange(0, 40), ElementValue.ZValue));
Chart.SmartPalette.Add("*", new SmartColor(Color.FromArgb(187, 78, 85),Color.FromArgb(64, 105, 139), new ScaleRange(40, 60), ElementValue.ZValue));
Chart.SmartPalette.Add("*", new SmartColor(Color.FromArgb(64, 105, 139), Color.FromArgb(64, 105, 139), new ScaleRange(60, 100), ElementValue.ZValue));
Chart.SeriesCollection.Add(getMapData());
}
SeriesCollection getMapData()
{
string[] states = new string[] { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "D. C.", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" };
double[] obama = new double[] { 38.36, 40.81, 44.45, 36.88, 60.16, 51.45, 58.06, 58.61, 90.91, 49.9, 45.39, 70.55, 32.4, 57.5, 43.84, 51.99, 38, 37.78, 40.58, 56.27, 61.97, 60.67, 54.04, 52.65, 43.79, 44.28, 41.66, 38.03, 52.36, 51.98, 58.25, 52.99, 63.35, 48.35, 38.69, 50.58, 33.23, 54.24, 51.95, 62.7, 44.09, 39.87, 39.04, 41.35, 24.67, 66.57, 51.16, 55.8, 35.45, 52.83, 27.82 };
double[] romney = new double[] { 60.55, 54.8, 53.48, 60.57, 37.07, 46.09, 40.72, 39.98, 7.28, 49.03, 53.19, 27.84, 64.09, 40.66, 54.04, 46.18, 59.59, 60.47, 57.78, 40.98, 35.9, 37.52, 44.58, 44.96, 55.29, 53.64, 55.3, 59.8, 45.68, 46.4, 40.5, 42.84, 35.17, 50.39, 58.32, 47.6, 66.77, 42.15, 46.57, 35.24, 54.56, 57.89, 59.42, 57.13, 72.55, 30.97, 47.28, 41.03, 62.14, 45.89, 68.64 };
SeriesCollection SC = new SeriesCollection();
Series s = new Series();
s.JsMap = "US";
for (int i = 0; i < states.Length; i++)
{
Element el = new Element();
el.JsMap = "US.name:"+states[i];
el.ZValue = obama[i];
el.CustomAttributes.Add("obama", obama[i]);
el.CustomAttributes.Add("romney", romney[i]);
s.Elements.Add(el);
}
SC.Add(s);
return SC;
}
</script>
</head>
<body>
<div align="center">
<dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px"></dotnet:Chart></div>
</body>
</html>
<%@ Import Namespace="System.Drawing" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates a thmatic election map.
Chart.Type = ChartType.Map 'Horizontal;
Chart.Width = 600
Chart.Height = 450
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.JS.Enabled = True
Chart.LegendBox.Visible = False
Chart.TitleBox.Label.Text = "2012 Presidential Election Results (Obama vs. Romney)"
' *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
Chart.DefaultElement.ToolTip = "%name<br/><b>Obama</b>: %obama% <br/><b>Romney</b>: %Romney%"
Chart.DefaultElement.ShowValue = True
Chart.DefaultElement.SmartLabel.Text = "%stateCode"
Chart.SmartPalette.Add("*", New SmartColor(Color.FromArgb(187, 78, 85), Color.FromArgb(187, 78, 85), New ScaleRange(0, 40), ElementValue.ZValue))
Chart.SmartPalette.Add("*", New SmartColor(Color.FromArgb(187, 78, 85),Color.FromArgb(64, 105, 139), New ScaleRange(40, 60), ElementValue.ZValue))
Chart.SmartPalette.Add("*", New SmartColor(Color.FromArgb(64, 105, 139), Color.FromArgb(64, 105, 139), New ScaleRange(60, 100), ElementValue.ZValue))
Chart.SeriesCollection.Add(getMapData())
End Sub
Function getMapData() As SeriesCollection
Dim states As String() = New String() { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "D. C.", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" }
Dim obama As Double() = New Double() { 38.36, 40.81, 44.45, 36.88, 60.16, 51.45, 58.06, 58.61, 90.91, 49.9, 45.39, 70.55, 32.4, 57.5, 43.84, 51.99, 38, 37.78, 40.58, 56.27, 61.97, 60.67, 54.04, 52.65, 43.79, 44.28, 41.66, 38.03, 52.36, 51.98, 58.25, 52.99, 63.35, 48.35, 38.69, 50.58, 33.23, 54.24, 51.95, 62.7, 44.09, 39.87, 39.04, 41.35, 24.67, 66.57, 51.16, 55.8, 35.45, 52.83, 27.82 }
Dim romney As Double() = New Double() { 60.55, 54.8, 53.48, 60.57, 37.07, 46.09, 40.72, 39.98, 7.28, 49.03, 53.19, 27.84, 64.09, 40.66, 54.04, 46.18, 59.59, 60.47, 57.78, 40.98, 35.9, 37.52, 44.58, 44.96, 55.29, 53.64, 55.3, 59.8, 45.68, 46.4, 40.5, 42.84, 35.17, 50.39, 58.32, 47.6, 66.77, 42.15, 46.57, 35.24, 54.56, 57.89, 59.42, 57.13, 72.55, 30.97, 47.28, 41.03, 62.14, 45.89, 68.64 }
Dim SC As SeriesCollection = New SeriesCollection()
Dim s As Series = New Series()
s.JsMap = "US"
For i As Integer = 0 To states.Length - 1
Dim el As Element = New Element()
el.JsMap = "US.name:" & states(i)
el.ZValue = obama(i)
el.CustomAttributes.Add("obama", obama(i))
el.CustomAttributes.Add("romney", romney(i))
s.Elements.Add(el)
Next i
SC.Add(s)
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>
- Sample FilenameJsMappingElection.aspx
- Version8.3
- Uses DatabaseNo