Solved pie chart  -> dynamic title from db?

Posted on 2014-03-07
Last Modified: 2014-03-24
Hi  all,

I'm using the below 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" 
                    <asp:Series Name="Series1" ChartType="Pie" Legend="Legend1" XValueMember="name" YValueMembers="percent"></asp:Series>  
                    <asp:ChartArea Name="ChartArea1">
                            IsClustered="false" />
                        <AxisY IsLogarithmic="true" />
                           <asp:Legend Name="Legend1">
                           <asp:Title Name="Title1" Text="Chart Date: X">

Open in new window

Question by:ErinTheCoderGirl
  • 3
  • 2

Author Comment

ID: 39914324
Any ideas in how I can assign a chart title from the database?
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39914368
which .Net Framework version?
LVL 83

Expert Comment

ID: 39914523
You can write code in code behind to get the field from DB and then use something like

Chart1.Titles(0).Text = Field
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Author Comment

ID: 39915175
Hi, I'm using version 4.

Author Comment

ID: 39915555
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?
LVL 83

Accepted Solution

CodeCruiser earned 500 total points
ID: 39940190

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now