Click here to Skip to main content
15,906,081 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi experts,

I want to generate a dynamic chart report.
in this chart columns are not fixed
it can grow dynamically...
below the chart description should be added in the table format as alegend to the chart is there any free tools to draw this chart

can any one please help me to solve this issue?

thanks in advance
(Keerthi Kumar)
Posted
Comments
Dave963 30-Aug-13 7:52am    
"below the chart description should be added in the table format as alegend to the chart" could you just explain this a little bit clearer
Keerthi Kumar(Andar) 31-Aug-13 1:40am    
like if am using bar chart completed in red color and pending in green
below the chart i need to explain in numbers how many are completed and how many are pending

1 solution

If you declare a normal asp.net Chart like this in your markup...
XML
<asp:Chart ID="Chart1" runat="server" Height="600px" Width="900px">
                <Series>
                    <asp:Series Name="Series1" IsValueShownAsLabel="true"></asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="caMain">
                        <Area3DStyle IsClustered="true" Enable3D="True" />
                        <AxisX>
                            <LabelStyle Interval="1" />
                        </AxisX>
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>


then you could dymanically add as many columns as you wish by just getting a DataTable from your database where the first column is your x-axis labels and your second column is your data points, so your table will look something like this...

Column A Column B
Dave 65
John 13

Then when you bind the chart you could just do something like this...

C#
Chart1.Titles.Add("Your Chart Description");
        Chart1.Series["Series1"].Points.Clear();
        foreach (DataRow r in dtReport.Rows)
                Chart1.Series["Series1"].Points.AddXY(r[0].ToString(), r[1].ToString());


Hope this helps....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900