下午好,
我正在使用数据库中的数据动态创建许多雷达图。
数据集看起来像
X | Y
--------
1 2
2 2
3 1
4 4
5 0
6 2
当图表显示时,Xaxis 标签不可见 谁能推荐为什么会发生这种情况?
到目前为止,这是我的代码...
Chart aRadarChart = new Chart();
aRadarChart.Width = Unit.Pixel(450);
aRadarChart.DataSource = dt;
// Add title
Title t = new Title(title, Docking.Top, new Font("Helvetica Neue", 12f, FontStyle.Bold), ColorTranslator.FromHtml("#696969"));
aRadarChart.Titles.Add(t);
//aRadarChart.Titles.
// Add a legend
Legend lgnd = new Legend();
lgnd.Enabled = true;
aRadarChart.Legends.Add(lgnd);
//Important: add ChartArea, otherwise no graph will be shown
ChartArea ca = new ChartArea("myChartArea");
ca.AxisX.Interval = 1;
ca.AxisX.TextOrientation = TextOrientation.Horizontal;
aRadarChart.ChartAreas.Add(ca);
ca.AxisY.Maximum = 4;
string car = String.Empty;
for (int i = 1; i < dt.Columns.Count; i++)
{
car = dt.Columns[i].ColumnName;
aRadarChart.Series.Add(car);
aRadarChart.Series[car].YValueMembers = car;
aRadarChart.Series[car].XValueMember = dt.Columns[0].ColumnName.ToString();
//Define here: what kind of Chart you want
aRadarChart.Series[car].ChartType = SeriesChartType.Radar;
aRadarChart.Series[car]["RadarDrawingStyle"] = "Line";
aRadarChart.Series[car].BorderWidth = 3;
}
//binding data
aRadarChart.DataBind();
aRadarChart.ImageStorageMode = ImageStorageMode.UseImageLocation;//.UseHttpHandler;
//Add Chart to a PlaceHolder Control
pnlMainContent.Controls.Add(aRadarChart);
谢谢,我已阅读有关将间隔设置为 1 的信息。但这并不能解决问题。