Gallery
Image Map Text
<%@ 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>Save Legend Image</title>
<script runat="server">
SeriesCollection getRandomData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random();
for(int a = 1; a < 5; a++)
{
Series s = new Series();
s.Name = "Series " + a;
for(int b = 1; b < 5; b++)
{
Element e = new Element();
e.Name = "Element " + b;
//e.YValue = -25 + myR.Next(50);
e.YValue = myR.Next(50);
s.Elements.Add(e);
}
SC.Add(s);
}
return SC;
}
void Page_Load(Object sender,EventArgs e)
{
dotnetCHARTING.Chart Chart = new dotnetCHARTING.Chart();
Chart.Type = ChartType.Combo;//Horizontal;
Chart.Width = 600;
Chart.Height = 350;
Chart.TempDirectory = "temp";
Chart.LegendBox.Position = LegendBoxPosition.BottomMiddle;
Chart.DefaultSeries.DefaultElement.ToolTip = "%yvalue";
Chart.LegendBox.Template ="%icon %name";
//Chart.DefaultSeries.LegendEntry.URL="%Xvalue,%Yvalue";
Chart.DefaultSeries.LegendEntry.ToolTip = "Total %name: %YSum";
// Add the random data.
Chart.SeriesCollection.Add(getRandomData());
// Save the legend as a separate image file
ImageLegend.ImageUrl = Chart.FileManager.SaveImage(Chart.GetLegendBitmap());
ImageLegend.Attributes.Add("usemap", Chart.ImageMapName);
ImageLegendMapLabel.Text = Chart.ImageMapText;
// Remove the legend from the chart and save the chart as a separate image file
Chart.LegendBox.Position = LegendBoxPosition.None;
ImageChart.ImageUrl = Chart.FileManager.SaveImage(Chart.GetChartBitmap());
ImageChart.Attributes.Add("usemap", Chart.ImageMapName);
ImageMapLabel.Text = Chart.ImageMapText;
}
</script>
</head>
<body style="margin:auto;width:680px;">
<font size="2" face="Arial">This chart image can be placed freely in your page
and treated as a regular image file with image map setting option:<br>
<asp:Image id="ImageChart" runat="server"/>
<asp:Label id="ImageMapLabel" runat="server"/><br><br>
<br><br>
The legend below is a separate image file which can be independently placed in
the page with image map setting option.<br><br></font>
<table border="0" style="border-collapse: collapse" id="table1" cellpadding="4">
<tr>
<td><asp:Image id="ImageLegend" runat="server"/>
<asp:Label id="ImageLegendMapLabel" runat="server"/></td>
<td> </td>
</tr>
</table>
<p> </p>
</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>Save Legend Image</title>
<script runat="server">
Function getRandomData() As SeriesCollection
Dim SC As SeriesCollection = New SeriesCollection()
Dim myR As Random = New Random()
For a As Integer = 1 To 4
Dim s As Series = New Series()
s.Name = "Series " & a
For b As Integer = 1 To 4
Dim e As Element = New Element()
e.Name = "Element " & b
'e.YValue = -25 + myR.Next(50);
e.YValue = myR.Next(50)
s.Elements.Add(e)
Next b
SC.Add(s)
Next a
Return SC
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim Chart As dotnetCHARTING.Chart = New dotnetCHARTING.Chart()
Chart.Type = ChartType.Combo 'Horizontal;
Chart.Width = 600
Chart.Height = 350
Chart.TempDirectory = "temp"
Chart.LegendBox.Position = LegendBoxPosition.BottomMiddle
Chart.DefaultSeries.DefaultElement.ToolTip = "%yvalue"
Chart.LegendBox.Template ="%icon %name"
'Chart.DefaultSeries.LegendEntry.URL="%Xvalue,%Yvalue";
Chart.DefaultSeries.LegendEntry.ToolTip = "Total %name: %YSum"
' Add the random data.
Chart.SeriesCollection.Add(getRandomData())
' Save the legend as a separate image file
ImageLegend.ImageUrl = Chart.FileManager.SaveImage(Chart.GetLegendBitmap())
ImageLegend.Attributes.Add("usemap", Chart.ImageMapName)
ImageLegendMapLabel.Text = Chart.ImageMapText
' Remove the legend from the chart and save the chart as a separate image file
Chart.LegendBox.Position = LegendBoxPosition.None
ImageChart.ImageUrl = Chart.FileManager.SaveImage(Chart.GetChartBitmap())
ImageChart.Attributes.Add("usemap", Chart.ImageMapName)
ImageMapLabel.Text = Chart.ImageMapText
End Sub
</script>
</head>
<body style="margin:auto;width:680px;">
<font size="2" face="Arial">This chart image can be placed freely in your page
and treated as a regular image file with image map setting option:<br>
<asp:Image id="ImageChart" runat="server"/>
<asp:Label id="ImageMapLabel" runat="server"/><br><br>
<br><br>
The legend below is a separate image file which can be independently placed in
the page with image map setting option.<br><br></font>
<table border="0" style="border-collapse: collapse" id="table1" cellpadding="4">
<tr>
<td><asp:Image id="ImageLegend" runat="server"/>
<asp:Label id="ImageLegendMapLabel" runat="server"/></td>
<td> </td>
</tr>
</table>
<p> </p>
</body>
</html>
- Sample FilenameImageMapText.aspx
- VersionLegacy (Pre 3.0)
- Uses DatabaseNo