Gallery
JS MappingZoomUI
<%@ 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 controlling the map zoom/pan using JS functions.
Chart.Type = ChartType.Map;//Horizontal;
Chart.Width = 600;
Chart.Height = 350;
Chart.TempDirectory = "temp";
Chart.Debug = false;
Chart.JS.Enabled = true;
//Necessary to refer to this chart in JS.
Chart.JS.ControlID = "jsChart";
Chart.LegendBox.Visible = false;
// *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.SeriesCollection.Add(getMapData());
}
SeriesCollection getMapData()
{
SeriesCollection SC = new SeriesCollection();
Series s = new Series();
s.JsMap = "US";
s.PaletteName = Palette.Autumn;
SC.Add(s);
return SC;
}
</script>
<script type="text/javascript">
function zoom(val) {
if (val.length) { val = [val[0] * 100000, val[1] * 100000]; }
jsChart.zoom(val);
}
</script>
</head>
<body>
<div style="text-align:center;margin: auto;width:640px;">
<input type="button" value=" ←" onclick="zoom([-5.055,0])">
<input type="button" value=" ↑" onclick="zoom([0,5.055])">
<input type="button" value=" →" onclick="zoom([5.055,0])">
<input type="button" value=" ↓" onclick="zoom([0,-5.055])">
<input type="button" value=" + " onclick="jsChart.zoom('+150')">
<input type="button" value=" - " onclick="jsChart.zoom('-50')">
<input type="button" value=" 100%" onclick="zoom(1)">
<input type="button" value=" 200%" onclick="zoom(2)">
<input type="button" value=" 500%" onclick="zoom(5)">
<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 controlling the map zoom/pan using JS functions.
Chart.Type = ChartType.Map 'Horizontal;
Chart.Width = 600
Chart.Height = 350
Chart.TempDirectory = "temp"
Chart.Debug = False
Chart.JS.Enabled = True
'Necessary to refer to this chart in JS.
Chart.JS.ControlID = "jsChart"
Chart.LegendBox.Visible = False
' *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.SeriesCollection.Add(getMapData())
End Sub
Function getMapData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim s As Series = New Series()
s.JsMap = "US"
s.PaletteName = Palette.Autumn
SC.Add(s)
Return SC
End Function
</script>
<script type="text/javascript">
function zoom(val) {
if (val.length) { val = [val[0] * 100000, val[1] * 100000]; }
jsChart.zoom(val);
}
</script>
</head>
<body>
<div style="text-align:center;margin: auto;width:640px;">
<input type="button" value=" ?" onclick="zoom([-5.055,0])">
<input type="button" value=" ?" onclick="zoom([0,5.055])">
<input type="button" value=" ?" onclick="zoom([5.055,0])">
<input type="button" value=" ?" onclick="zoom([0,-5.055])">
<input type="button" value=" + " onclick="jsChart.zoom('+150')">
<input type="button" value=" - " onclick="jsChart.zoom('-50')">
<input type="button" value=" 100%" onclick="zoom(1)">
<input type="button" value=" 200%" onclick="zoom(2)">
<input type="button" value=" 500%" onclick="zoom(5)">
<dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px"></dotnet:Chart></div>
</body>
</html>
- Sample FilenameJsMappingZoomUI.aspx
- Version8.3
- Uses DatabaseNo