这是一个我想要展示的简单条形图。
这是我的图表:
<telerik:RadHtmlChart runat="server" ID="Chart_WarrantiesByMonth" Width="800" Height="500" Transitions="true">
<Appearance>
<FillStyle BackgroundColor="White"></FillStyle>
</Appearance>
<ChartTitle Text="Warranties By Month">
</ChartTitle>
</telerik:RadHtmlChart>
这是我的数据绑定调用
DataTable chartSource = new DataTable();
MySqlCommand mysqlcmdChart = new MySqlCommand();
mysqlcmdChart.CommandText = "_DealerPortal_Chart_WarrantiesByMonth";
mysqlcmdChart.Parameters.AddWithValue("DealershipIdParam", DealershipIdParam);
chartSource = MySQLProcessing.MySQLProcessor.DataTable_StoredProcedure(mysqlcmdChart,mysqlCon,CommandType.StoredProcedure);
Chart_WarrantiesByMonth.DataSource = chartSource;
Chart_WarrantiesByMonth.PlotArea.XAxis.DataLabelsField = "Date";
Chart_WarrantiesByMonth.PlotArea.XAxis.Name = "Date";
Chart_WarrantiesByMonth.PlotArea.YAxis.Name = "Warranties";
Chart_WarrantiesByMonth.DataBind();
我确保我的图表有数据;
Warranties Date
1 August 2014
13 December 2013
40 February 2014
8 January 2014
13 March 2014
1 May 2015
这真令人沮丧,我会让我尖叫。无论我做什么,我都无法让图表显示除此之外的任何内容:有一件事是我在按钮上执行一个简单的asp按钮来执行数据绑定。我期待我的x轴是月/年,y是计数。谢谢!
谢谢!
答案 0 :(得分:0)
我认为你需要定义一个系列:http://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/dateaxis/defaultcs.aspx。否则,图表应显示哪些数据?从它的外观来看,你需要一个LineSeries(就像那个演示一样),它的DataFieldY属性应该设置为&#34; Warranties&#34;