📄 javascripttooltips.aspx
字号:
<%@ Page Language="C#" debug="true" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<HTML>
<HEAD>
<TITLE>JavaScript Element ToolTips</TITLE>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
Chart.Type = ChartType.Combo;
Chart.Width = 500;
Chart.Height = 250;
Chart.TempDirectory = "temp";
Chart.Debug = true;
Chart.Title = "Hover your mouse over a country's column";
//Disable the legend box, we will use the tooltips to view information typically shown there.
Chart.LegendBox.Visible = false;
//Add a shading effect to give the columns some more visual polish.
Chart.ShadingEffect = true;
Chart.ShadingEffectMode = ShadingEffectMode.Three;
//This is the bulk of the work forthis sample, a custom HTML attribute is added
//to render the tooltip using javascript onmouseover.
Chart.DefaultElement.Hotspot.Attributes.Custom.Add("OnMouseOver", "this.T_WIDTH=60;return escape('%Name %YValue <img src=%flag>')");
// y axis label.
Chart.YAxis.Label.Text = "GDP (Millions)";
Chart.YAxis.SmartScaleBreak = true;
// Add the first element.
Chart.Series.Element.Name = "United States";
Chart.Series.Element.YValue = 5452500;
// Specify the image for the us flag as custom attribute for the element.
// This is used above in HotSpot the %flag token is replaced with this data dynamically
Chart.Series.Element.CustomAttributes["Flag"]="us.png";
//Setting a series level palette name assigns a unique color to each element in a single series.
Chart.Series.PaletteName = Palette.Two;
// Add the element
Chart.Series.Elements.Add();
// Repeat for other elements.
Chart.Series.Element.Name = "Canada";
Chart.Series.Element.YValue = 786052;
Chart.Series.Element.CustomAttributes["Flag"]="ca.png";
Chart.Series.Elements.Add();
Chart.Series.Element.Name = "United Kingdom";
Chart.Series.Element.YValue = 477338;
Chart.Series.Element.CustomAttributes["Flag"]="uk.png";
Chart.Series.Elements.Add();
Chart.Series.Element.Name = "Mexico";
Chart.Series.Element.YValue = 155313;
Chart.Series.Element.CustomAttributes["Flag"]="mx.png";
Chart.Series.Elements.Add();
// Finally we add the series.
Chart.SeriesCollection.Add();
}
</script>
</HEAD>
<BODY>
<br>
<DIV align="center">
<dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px">
</dotnet:Chart>
</DIV>
<script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -