如何使用bootstrap使asp.net图表控件响应

时间:2015-06-26 19:59:46

标签: asp.net charts twitter-bootstrap-3 asp.net-charts

我在asp.net c#中使用bootstrap。除了asp.net图表控件之外,每件事都运行良好(响应)。任何人都可以建议我怎么能像btn-block一样阻止它。请检查代码和图像。感谢

<body class="container-fluid">
<form id="form1" runat="server">
<div >
<asp:Button ID="Button1" runat="server" Text="Button" class="btn btn-info col-lg-12"/>
<asp:Table ID="Tbl_chart" runat="server" CssClass="table  table-bordered table-condensed table-responsive">
<asp:TableRow>
<asp:TableCell>
<asp:Chart ID="Chart2" runat="server" AlternateText="Column chart of daily walking time" Height="432" Palette="Fire" class="col-lg-12">
<Series>
<asp:Series Name="Series1" XValueMember="date" YValueMembers="TimePerDay" ChartArea="ChartArea2" ChartType="column" YValuesPerPoint="6" IsValueShownAsLabel="true" LabelFormat="{0:N0}">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea2">
<AxisY Interval="50">
<MajorGrid Enabled="true" LineColor="lightgray" />
</AxisY>
<AxisX IsLabelAutoFit="false" TitleForeColor="black" Interval="1">
<LabelStyle Format="dddd, dd-MM-yy" Angle="-90" IsEndLabelVisible="false" />
<MajorGrid Enabled="false" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
<Titles>
<asp:Title Docking="Top" Font="Arial, 12pt" Name="Title1" Text="Daily walking time in minutes">
</asp:Title>
</Titles>
</asp:Chart>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>

enter image description here

1 个答案:

答案 0 :(得分:2)

有效!谢谢你,你所要做的就是将这个类添加到你的图表中:

<asp:Chart ID="Chart1" CanResize="true" CssClass="table  table-bordered table-condensed table-responsive" runat="server" Height="410px" Width="1000px">
     <Series>
         <asp:Series Name="Series1"></asp:Series>
     </Series>
     <ChartAreas>
         <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
     </ChartAreas>
</asp:Chart>