【问题标题】:asp:chart, charttype='column' with legend visibleasp:chart, charttype='column' 带有可见的图例
【发布时间】:2013-04-24 14:14:07
【问题描述】:

我对 Asp:Chart 有点困惑,我有一个返回一行的表

现在我希望它显示在 Asp:chart 中,ChartType="Column"。

  1. 我把上面的表格转换成格式

    我用了一个系列

    <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>
    

    问题:

    一个。图表显示正常,但只有一个图例,无法将标签从后面的代码更改为百分比。

  2. 然后,我使用了多个系列,但是

       <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>
    

    问题:

    一个。图例显示正确,我能够以百分比显示标签,但未显示轴值,它必须显示那些条之间有空格。

你能告诉我应该如何解决这个问题。

  1. 使用单个或多个系列来解决此问题。我做了很多研究,但找不到完美的解决方案。
  2. 列名必须显示在每个块的正下方。

【问题讨论】:

    标签: asp.net mschart


    【解决方案1】:

    对于第二个问题,“列名必须显示在每个块的正下方。”您可能希望在您的系列下的每个 DataPoints 中添加一个 AxisLabel。

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

    这是我发现的link,它显示了一个示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多