Link to home
Start Free TrialLog in
Avatar of ErinTheCoderGirl
ErinTheCoderGirl

asked on

asp.net pie chart -> dynamic title from db?

Hi  all,

I'm using the below asp.net vb.net pie chart code.  It's all fine except for two things:

1. How do i dynamically assign a field from the sql database to the title of the pie chart?  As you can see I have an X where I'd like a field called 'theDate' to be inserted, how do i do that?

2. the BackImage property is a transparent 1x1px gif...  however, when applied to the pie chart as below i only get a solid white background and not transparent as expected - any ideas why?


            <asp:Chart ID="Chart1" runat="server" Width="676px" Height="410px" 
                       BackImage="../img/spacer_clear.gif" BackImageTransparentColor="White" 
                       DataSourceID="srcWBUsage_ByDate">
                <series>
                    <asp:Series Name="Series1" ChartType="Pie" Legend="Legend1" XValueMember="name" YValueMembers="percent"></asp:Series>  
                </series>
                <chartareas>
                    <asp:ChartArea Name="ChartArea1">
                        <Area3DStyle
                            rotation="10"
                            Perspective="10"
                            Enable3D="true"
                            Inclination="15"
                            IsRightAngleAxes="false"
                            WallWidth="0"
                            IsClustered="false" />
                        <AxisY IsLogarithmic="true" />
                    </asp:ChartArea>
                </chartareas>
                       <Legends>
                           <asp:Legend Name="Legend1">
                           </asp:Legend>
                       </Legends>
                       <Titles>
                           <asp:Title Name="Title1" Text="Chart Date: X">
                           </asp:Title>
                       </Titles>
            </asp:Chart>  

Open in new window


Thanks,
Avatar of ErinTheCoderGirl
ErinTheCoderGirl

ASKER

Any ideas in how I can assign a chart title from the database?
Avatar of Rainer Jeschor
Hi,
which .Net Framework version?
You can write code in code behind to get the field from DB and then use something like

Chart1.Titles(0).Text = Field
Hi, I'm using version 4.
Codecruiser - I'm not able to just implement that vague answer, do you have a link to an article I can reference and learn from?
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial