Lakpa Sherpa
Lakpa Sherpa

Reputation: 126

asp:chart, charttype='column' with legend visible

I am a bit confused with Asp:Chart, I have a table that returns one row

enter image description here

now I want it to be displayed in Asp:chart with ChartType="Column".

  1. I converted the above table into the format

    enter image description here

    I used one series

    <asp:Chart ID="charttest" runat="server" Width="950px" Height="250px">
                <Series>
                    <asp:Series Name="Categories" IsValueShownAsLabel="true"        
           ChartArea="MainChartArea"
                        ChartType="Column" Legend="legend1"  >
                    </asp:Series>
                  </Series>
                <ChartAreas>
                    <asp:ChartArea Name="MainChartArea" Area3DStyle-Enable3D="true" 
                             Area3DStyle-IsClustered="true" BorderWidth="1" 
                           Area3DStyle-WallWidth="1" Area3DStyle-
                         PointGapDepth="50" Area3DStyle-PointDepth="100" Area3DStyle-                    
                           Rotation="10">
    
                    </asp:ChartArea>
                </ChartAreas>
               <Legends>
             <asp:Legend Name="legend1" BorderColor="Blue" ></asp:Legend>
               </Legends>
            </asp:Chart>
    

    Problem:

    a. The graph was showing properly but there was only one legend, couldn't change the label into percentage from code behind.

  2. Then, I used multiple series but

       <asp:Chart ID="charttest" runat="server" Width="950px" 
                 Height="250px">
                <Series>
                    <asp:Series Name="Categories" IsValueShownAsLabel="true"   
                     ChartArea="MainChartArea"
                        ChartType="Column" Legend="legend1"  >
                    </asp:Series>
                    <asp:Series Name="Categories2" IsValueShownAsLabel="true" 
                       ChartArea="MainChartArea"
                        ChartType="Column" Legend="legend1" >
                    </asp:Series>
                    <asp:Series Name="Categories3" IsValueShownAsLabel="true" 
                   ChartArea="MainChartArea"
                        ChartType="Column" Legend="legend1" >
                    </asp:Series>
                    <asp:Series Name="Categories4" IsValueShownAsLabel="true" 
                      ChartArea="MainChartArea"
                        ChartType="Column" Legend="legend1" >
                   </asp:Series>
                       </Series>
                   <ChartAreas>
                    <asp:ChartArea Name="MainChartArea" Area3DStyle-Enable3D="true"  
                        Area3DStyle-IsClustered="true" BorderWidth="1" Area3DStyle- 
                        WallWidth="1" Area3DStyle-PointGapDepth="50" Area3DStyle-
                         PointDepth="100" Area3DStyle-Rotation="10">
    
                    </asp:ChartArea>
                </ChartAreas>
               <Legends>
             <asp:Legend Name="legend1" BorderColor="Blue" ></asp:Legend>
               </Legends>
            </asp:Chart>
    

    Problem:

    a. The legend was showing properly and I was able to show label in percentage but the axis value weren't getting displayed, It must be displaying those bars with space between them.

enter image description here

Can you tell me how should I solve this problem.

  1. Use single or multiple series to solve this problem. I did lots of research but couldn't find a perfect solution.
  2. A column name must be displayed just below each block.

Upvotes: 0

Views: 3928

Answers (1)

tmc
tmc

Reputation: 324

For your second question, "A column name must be displayed just below each block." you would want to add an AxisLabel to each of your DataPoints under your series.

<asp:DataPoint AxisLabel="Celtics" YValues="17" />

Here is a link I found that shows an example.

Upvotes: 2

Related Questions