在asp.net图表控件中,我们如何将图表宽度设置为百分比,下面的场景是需要使用面板宽度设置图表宽度。因为图表只占用像素。帮助。
<table style="width:100%;">
<tr>
<td style="width:50%;border:1px solid black;">
<asp:Panel ID="pnl" runat="server" Width="100%">
<asp:Chart ID="Chart2" runat="server" >
<Titles><asp:Title Text="ChartSample1"></asp:Title></Titles>
<Series>
<asp:Series Name="Series1"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1"></asp:ChartArea>
</ChartAreas>
</asp:Chart>
</asp:Panel>
</td>
<td style="width:50%;border:1px solid black;">
<asp:Panel ID="pnl2" runat="server" Width="100%">
<asp:Chart ID="Chart3" runat="server">
<Titles><asp:Title Text="ChartSample2"></asp:Title></Titles>
<Series>
<asp:Series Name="Series1"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1"></asp:ChartArea>
</ChartAreas>
</asp:Chart>
</asp:Panel>
</td>
</tr>
</table>
代码背后: protected void Page_Load(object sender,EventArgs e) {
Chart2.Series[0].Points.AddXY(1, 1);
Chart2.Series[0].Points.AddXY(1, 2);
Chart2.Series[0].Points.AddXY(2, 1);
Chart2.Series[0].Points.AddXY(2, 2);
Chart2.Series[0].Points.AddXY(3, 1);
Chart2.Series[0].Points.AddXY(3, 2);
Chart3.Series[0].Points.AddXY(1, 10);
Chart3.Series[0].Points.AddXY(1, 20);
Chart3.Series[0].Points.AddXY(2, 10);
Chart3.Series[0].Points.AddXY(2, 20);
Chart3.Series[0].Points.AddXY(3, 10);
Chart3.Series[0].Points.AddXY(3, 20);
}
答案 0 :(得分:0)
如果您还没有找到解决方案,可以尝试在代码隐藏中获取onChange(selectedValue) {
console.log(this.selectedData);
console.log(this.selectedList);
this.selectedData["exercisesProgress"] = this.selectedData["exercisesProgress"].filter(x=>x.id == selectedValue);
}
的{{1}}和width
属性。
我更喜欢在网站中使用height
而不是panel
。
panels