我第一次使用ASP.NET图表并取得了巨大成功。我想要做的一件事是放大我的图表,以便y值不会从0到100。例如,假设我有一些从72到89的点值。我想要做的是将y值最低的值设为72,y值最高的y值设置为89(目前显示值为0,最低值为100作为最高)。下面是我使用的代码:如何使用ASP.NET图表显示Y值的特定范围(MS图表)
<asp:Chart ID="Chart1" ImageLocation="~/content/images/temp/charts/ChartPic_#SEQ(300,3)" Height="325px" Width="900px" runat="server">
<Titles>
<asp:Title Text="Overview" Font="Arial, 12pt, style=Bold" />
</Titles>
<Legends>
<asp:Legend Font="Segoe UI, 8pt" Alignment="Center" BorderWidth="1" BorderDashStyle="Solid" BorderColor="#C6C6C6" Docking="Bottom" />
</Legends>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisY LineColor="#C6C6C6" IsInterlaced="true" InterlacedColor="#F0F0F0">
<LabelStyle Font="Segoe UI, 8pt" ForeColor="#787878" />
<MajorGrid LineColor="#C6C6C6" />
</AxisY>
<AxisX LineColor="#C6C6C6">
<LabelStyle Font="Segoe UI, 8pt" ForeColor="#787878" />
<MajorGrid LineColor="#C6C6C6" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
protected void Page_Load(object sender, EventArgs e)
{
var series = new Series("Overview")
{
Name = "Series1",
ChartType = SeriesChartType.Line,
MarkerStyle = MarkerStyle.Circle,
MarkerSize = 7,
XValueType = ChartValueType.Date,
YValueType = ChartValueType.Double,
};
foreach (var survey in Surveys)
{
series.Points.AddXY(String.Format("{0:MMM yyyy}", survey.Month), survey.Score);
}
Chart1.Series.Add(series);
}
真棒!感谢您的专业知识。有这么多的属性,我真的不知道该找什么。这正是我需要的! – Halcyon
@Halcyon难道我不知道!我刚刚才知道使用它之前的控制权。这就是这个网站真棒=) – jadarnel27