Gallery
Map Click Info
<%@ Page Language="C#" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="dotnetCHARTING.Mapping" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
// Demonstrates using hotspots and annotations with manually added map points.
void Page_Load(Object sender, EventArgs e)
{
// Setup the chart.
Chart.Type = ChartType.Map;
Chart.Size = "850x550";
Chart.Title = "Click on a point of interest for more information";
Chart.TempDirectory = "temp";
Chart.Debug = true;
Chart.LegendBox.Visible = false;
Chart.ChartArea.Background.ShadingEffectMode = ShadingEffectMode.Background2;
Chart.ChartArea.Background.Color = Color.FromArgb(182,222,255);
// Style the title box.
Chart.TitleBox.Position = TitleBoxPosition.Full;
Chart.TitleBox.Label.Color = Color.DarkBlue;
Chart.TitleBox.Background.Color = Color.LightSkyBlue;
Chart.TitleBox.CornerTopLeft = Chart.TitleBox.CornerTopRight = BoxCorner.Round;
Chart.Mapping.ZoomPercentage = 150;
// By default the ID is -1, meaning; no location is selected.
int id = -1;
if (Page.Request.QueryString.Count > 0)
{
string query = Page.Request.QueryString["id"];
id = int.Parse(query);
}
// Create a layer for the map.
MapLayer layer = MapDataEngine.LoadLayer("../../images/MapFiles/primusa.shp");
layer.DefaultShape.Line.Color = Color.Black;
layer.DefaultShape.Background.Color = Color.FromArgb(240, 240, 240);
// Create a layer for the map points representing stores.
MapLayer stores = new MapLayer();
// Create default annotation settings.
Annotation defaultAn = new Annotation();
defaultAn.DynamicSize = false;
defaultAn.DefaultCorner = BoxCorner.Round;
defaultAn.Background.ShadingEffectMode = ShadingEffectMode.Background2;
defaultAn.Background.Color = Color.DeepSkyBlue;
// By default the annotations will be null, unless the query string specifies the id 1-3.
// Create the annotations.
Annotation an1 = new Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Chicago IL<br>(312) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn);
if (id != 1) an1 = null;
Annotation an2 = new Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Wisconsin Dells WI<br>(608) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn);
if (id != 2) an2 = null;
Annotation an3 = new Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Las Vegas NV<br>(702) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn);
if (id != 3) an3 = null;
// Add the points along with markers, hotspots and annotations.
stores.AddLatLongPoint(new PointF(41.75f, -87.99f),
new ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red),
new dotnetCHARTING.Hotspot("?id=1", ""), an1);
stores.AddLatLongPoint(new PointF(43.62f, -89.77f),
new ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red),
new dotnetCHARTING.Hotspot("?id=2", ""), an2);
stores.AddLatLongPoint(new PointF(36.17f, -115.139f),
new ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red),
new dotnetCHARTING.Hotspot("?id=3", ""), an3);
// Add both layers to the map.
Chart.Mapping.MapLayerCollection.Add(layer, stores);
Chart.GetChartBitmap();
}
</script>
</head>
<body>
<div style="text-align: center">
<dotnet:Chart ID="Chart" runat="server">
</dotnet:Chart>
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="dotnetCHARTING.Mapping" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>.netCHARTING Sample</title>
<script runat="server">
' Demonstrates using hotspots and annotations with manually added map points.
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Setup the chart.
Chart.Type = ChartType.Map
Chart.Size = "850x550"
Chart.Title = "Click on a point of interest for more information"
Chart.TempDirectory = "temp"
Chart.Debug = True
Chart.LegendBox.Visible = False
Chart.ChartArea.Background.ShadingEffectMode = ShadingEffectMode.Background2
Chart.ChartArea.Background.Color = Color.FromArgb(182,222,255)
' Style the title box.
Chart.TitleBox.Position = TitleBoxPosition.Full
Chart.TitleBox.Label.Color = Color.DarkBlue
Chart.TitleBox.Background.Color = Color.LightSkyBlue
Chart.TitleBox.CornerTopRight = BoxCorner.Round
Chart.TitleBox.CornerTopLeft = Chart.TitleBox.CornerTopRight
Chart.Mapping.ZoomPercentage = 150
' By default the ID is -1, meaning; no location is selected.
Dim id As Integer = -1
If Page.Request.QueryString.Count > 0 Then
Dim query As String = Page.Request.QueryString("id")
id = Integer.Parse(query)
End If
' Create a layer for the map.
Dim layer As MapLayer = MapDataEngine.LoadLayer("../../images/MapFiles/primusa.shp")
layer.DefaultShape.Line.Color = Color.Black
layer.DefaultShape.Background.Color = Color.FromArgb(240, 240, 240)
' Create a layer for the map points representing stores.
Dim stores As MapLayer = New MapLayer()
' Create default annotation settings.
Dim defaultAn As Annotation = New Annotation()
defaultAn.DynamicSize = False
defaultAn.DefaultCorner = BoxCorner.Round
defaultAn.Background.ShadingEffectMode = ShadingEffectMode.Background2
defaultAn.Background.Color = Color.DeepSkyBlue
' By default the annotations will be null, unless the query string specifies the id 1-3.
' Create the annotations.
Dim an1 As Annotation = New Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Chicago IL<br>(312) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn)
If id <> 1 Then
an1 = Nothing
End If
Dim an2 As Annotation = New Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Wisconsin Dells WI<br>(608) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn)
If id <> 2 Then
an2 = Nothing
End If
Dim an3 As Annotation = New Annotation("<img:../../images/PetStoreLogo.png> Pet Store<br>Las Vegas NV<br>(702) 555-2345<row><block fColor='blue' url='http://dotnetcharting.com'>Pet Store Website", defaultAn)
If id <> 3 Then
an3 = Nothing
End If
' Add the points along with markers, hotspots and annotations.
stores.AddLatLongPoint(New PointF(41.75f, -87.99f), New ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red), New dotnetCHARTING.Hotspot("?id=1", ""), an1)
stores.AddLatLongPoint(New PointF(43.62f, -89.77f), New ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red), New dotnetCHARTING.Hotspot("?id=2", ""), an2)
stores.AddLatLongPoint(New PointF(36.17f, -115.139f), New ElementMarker(ElementMarkerType.FivePointStar, 20, Color.Red), New dotnetCHARTING.Hotspot("?id=3", ""), an3)
' Add both layers to the map.
Chart.Mapping.MapLayerCollection.Add(layer, stores)
Chart.GetChartBitmap()
End Sub
</script>
</head>
<body>
<div style="text-align: center">
<dotnet:Chart ID="Chart" runat="server">
</dotnet:Chart>
</div>
</body>
</html>
- Sample FilenameMapClickInfo.aspx
- Version5.3
- Uses DatabaseNo