asp.net c# tutorials and examples code for beginners

ASP.NET - Chart Title TextStyle Shadow

How to set change Chart Title TextStyle Shadow programmatically in asp.net
ChartTitleTextStyleShadow.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@Import Namespace="System.Web.UI.DataVisualization.Charting" %>

<!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.Titles[0].TextStyle = TextStyle.Shadow;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set change Chart Title TextStyle Shadow programmatically in asp.net</title>
    <style type="text/css">
        h2
        {
            color:DarkBlue;
            font-style:italic;
            }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>Chart example and tutorial: How to set change<br /> Chart Title TextStyle Shadow programmatically in asp.net</h2>
        <hr width="625" align="left" color="LightBlue" />
        <br />
        <asp:Chart 
            ID="Chart1" 
            runat="server"
            Width="625" 
            BackColor="DarkCyan"
            BorderlineColor="Cyan"
            BorderlineDashStyle="Solid"
            BorderlineWidth="2"
            >
            <Titles>
                <asp:Title 
                    Text="Adobe Creative Suite 5"
                    ForeColor="Green"
                    Docking="Top"
                    BackColor="YellowGreen"
                    Font="Comic Sans MS, 15pt, style=Bold"
                    BorderColor="DarkGreen"
                    >
                </asp:Title>
            </Titles>
            <Series>
                <asp:Series 
                    Name="AdobeCreativeSuite5" 
                    YValueType="Int32" 
                    ChartArea="DefaultChartArea"
                    ChartType="Bar"
                    Palette="Chocolate"
                    >
                    <Points>
                        <asp:DataPoint AxisLabel="Design Premium" YValues="1899" />
                        <asp:DataPoint AxisLabel="Design Standard" YValues="1299" />
                        <asp:DataPoint AxisLabel="Web Premium" YValues="1799" />
                        <asp:DataPoint AxisLabel="Production Premium" YValues="1699" />
                        <asp:DataPoint AxisLabel="Master Collection" YValues="2599" />
                    </Points>
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea 
                    Name="DefaultChartArea" 
                    BorderDashStyle="Dot"
                    BorderWidth="2"
                    BorderColor="DarkRed"
                    BackColor="SandyBrown"
                    >
                    <Area3DStyle Enable3D="true" LightStyle="Realistic" />
                    <AxisX>
                        <MajorGrid 
                            Enabled="false"
                            />
                        <LabelStyle ForeColor="Snow" />
                        <MajorTickMark Size="5" LineWidth="2" LineColor="PaleGoldenrod" LineDashStyle="DashDot" />
                    </AxisX>
                    <AxisY>
                        <MajorGrid 
                            Enabled="true" 
                            LineColor="IndianRed" 
                            />
                        <LabelStyle ForeColor="Snow" />
                        <MajorTickMark Size="5" LineWidth="2" LineColor="PaleGoldenrod" LineDashStyle="DashDot" />
                    </AxisY>
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            Text="Set Chart Title TextStyle Shadow"
            Font-Bold="true"
            OnClick="Button1_Click"
            ForeColor="DarkBlue"
            Height="45"
            />
    </div>
    </form>
</body>
</html>






Related asp.net example