⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invisiblelegendentry.aspx

📁 掌握学习.net开发的非常好的资料
💻 ASPX
字号:
<%@ Page Language="C#"  debug="true" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet"  Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>


<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
	//set global properties
    Chart.Title="Item sales";
    Chart.XAxis.Label.Text ="months";
    Chart.YAxis.FormatString="currency";
    Chart.TempDirectory="temp";
    Chart.Debug=true;
    Chart.Size="800X500";
    Chart.TitleBox.Position = TitleBoxPosition.FullWithLegend;
    
    //Make series legend entries invisible and add 3 custom legend entries
    Chart.DefaultSeries.LegendEntry.Visible=false;
    LegendEntry singleLegendEntry = new LegendEntry();
    singleLegendEntry.Name="Sales < $3500";
    singleLegendEntry.Background.Color=Color.Red;
    Chart.ExtraLegendEntries.Add(singleLegendEntry);
    singleLegendEntry = new LegendEntry();
    singleLegendEntry.Name="$3500 < Sales < $5000";
    singleLegendEntry.Background.Color=Color.Yellow;
    Chart.ExtraLegendEntries.Add(singleLegendEntry);
    singleLegendEntry = new LegendEntry();
    singleLegendEntry.Name="$5000 < Sales ";
    singleLegendEntry.Background.Color=Color.Green;
    Chart.ExtraLegendEntries.Add(singleLegendEntry);


     
    //Add a series
     DataEngine de = new DataEngine();
    de.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;data source=" + Server.MapPath("../../database/chartsample.mdb");  
    de.StartDate=new DateTime (2002,1,1,0,0,0);
    de.EndDate = new DateTime (2002,12,31,23,59,59);
    de.DateGrouping = TimeInterval.Year;
	de.SqlStatement= @"SELECT OrderDate,Total, Name FROM Orders  WHERE OrderDate >= #STARTDATE# AND OrderDate <= #ENDDATE# ORDER BY OrderDate"; 
    SeriesCollection sc = de.GetSeries();
    // customize element settings
    //set the color for different customers in each month based on their total sale.
	foreach(dotnetCHARTING.Series sr in sc)
	{
		foreach(dotnetCHARTING.Element el in sr.Elements)
		{
      		if (el.YValue < 3500)
           		el.Color = Color.Red;
           	else if (el.YValue < 5000)
           		el.Color = Color.Yellow;
      		else
      			el.Color = Color.Green;
      	}
 	}
    Chart.SeriesCollection.Add(sc);
}
</script>
<HTML><HEAD><TITLE>Invisible Legend Entry</TITLE></HEAD>
<BODY>
<DIV align=center>
 <dotnet:Chart id="Chart"  runat="server"/>
</DIV>
</BODY>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -