ASP.net条形图控制 - 入门

时间:2011-12-20 09:12:57

标签: c# asp.net text charts background

几乎完成了我的民意调查网页部分,但需要对我的条形图进行一些修改,但无法在线找到任何相关资源

enter image description here

我需要从两个轴(-1,0,1,2,3...)删除数字(x and y)吗? 我还需要删除默认图表的背景图像,如果我可以用纯白色

切换它,效果会更好

谢谢

1 个答案:

答案 0 :(得分:2)

已停用标签

您可以通过添加 LabelStyle Enabled =“false”按照以下方式执行此操作

<asp:Chart ID="Chart1" runat="server">
    <Series>
        <asp:Series Name="Series1">
        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1">
            <AxisY>
                <LabelStyle Enabled="false" />
            </AxisY>
            <AxisX>
                <LabelStyle Enabled="false" />
            </AxisX>
        </asp:ChartArea>
    </ChartAreas>
</asp:Chart>

更改背景

<asp:Chart id="Chart1" runat="server">
  <BorderSkin BackColor="Transparent" PageColor="Transparent" 
    SkinStyle="Emboss" />
</asp:Chart>

PageColor &amp; BackColor 属性可帮助您更改图表背景

更新:

按照以下更新您的ChartArea以禁用网格线并使其变为白色

<asp:ChartArea Name="ChartArea1" BorderColor="black" BorderDashStyle="Solid" BackSecondaryColor="White"
            BackGradientStyle="TopBottom">
            <AxisY LineColor="64, 64, 64, 64">
                <MajorGrid Enabled="false"></MajorGrid>
            </AxisY>
            <AxisX LineColor="64, 64, 64, 64" IsStartedFromZero="true">
                <MajorGrid Enabled="false"></MajorGrid>
            </AxisX>
        </asp:ChartArea>