ChartLegendTitleSeparatorColor.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Chart1.Legends["Legend1"].TitleSeparatorColor = System.Drawing.Color.BlanchedAlmond;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to set change Chart Legend TitleSeparatorColor programmatically in asp.net</title>
<style type="text/css">
h2
{
color:Crimson;
font-style:italic;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Chart example and tutorial: How to set change Chart Legend<br /> TitleSeparatorColor programmatically in asp.net</h2>
<hr width="625" align="left" color="IndianRed" />
<br />
<asp:Chart
ID="Chart1"
runat="server"
Width="625"
BackColor="DarkCyan"
BorderlineColor="AliceBlue"
BorderlineDashStyle="Solid"
BorderlineWidth="2"
>
<Legends>
<asp:Legend
Name="Legend1"
BackColor="DodgerBlue"
ForeColor="Snow"
BorderColor="MidnightBlue"
Docking="Right"
TableStyle="Wide"
Title="Nokia Phone Legend"
TitleForeColor="Snow"
TitleSeparator="DoubleLine"
>
</asp:Legend>
</Legends>
<Series>
<asp:Series
Name="NokiaPhone"
YValueType="Double"
ChartArea="DefaultChartArea"
ChartType="Pyramid"
Palette="Excel"
>
<Points>
<asp:DataPoint AxisLabel="Nokia N8" YValues="549" />
<asp:DataPoint AxisLabel="Nokia N97 Mini Driver Ed." YValues="399.99" />
<asp:DataPoint AxisLabel="Nokia E72 Driver Edition" YValues="349" />
<asp:DataPoint AxisLabel="X6 16GB Driver Edition" YValues="329" />
<asp:DataPoint AxisLabel="Nokia C6" YValues="309" />
<asp:DataPoint AxisLabel="Nokia 5800 Driver Edition" YValues="289" />
</Points>
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea
Name="DefaultChartArea"
BorderDashStyle="Solid"
BorderWidth="2"
BorderColor="OliveDrab"
BackColor="DarkOliveGreen"
>
<Area3DStyle Enable3D="true" LightStyle="Realistic" />
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
<br />
<asp:Button
ID="Button1"
runat="server"
Text="Set Chart Legend TitleSeparatorColor BlanchedAlmond"
Font-Bold="true"
OnClick="Button1_Click"
ForeColor="DarkBlue"
Height="45"
/>
</div>
</form>
</body>
</html>
No comments:
Post a Comment