当我//line2.XValues.Add(new DateTimeValue { Value = chartData.Label });
为第二个折线图提供第二列时,我在这里遇到问题,但是当我删除两个 xvalues 时,它显示了两个列。
<jqChart:Chart ID="Chart1" Width="700px" Height="300px" runat="server">
<Title Text="Sentiment Title"></Title>
<Animation Enabled="True" Duration="00:00:01" />
<Axes>
<jqChart:DateTimeAxis Location="Bottom" ZoomEnabled="True">
</jqChart:DateTimeAxis>
</Axes>
<Series>
</Series>
</jqChart:Chart>
C# 页面加载
var dat = ChartData.GetData();
var line = new ColumnSeries();
line.Title = "Obama";
foreach (var chartData in dat)
{
line.YValues.Add(new DoubleValue { Value = chartData.Value1 });
line.XValues.Add(new DateTimeValue { Value = chartData.Label });
line.CustomValues.Add(new StringValue { Value = chartData.TotalDocumentValue1 });
}
Chart1.Series.Add(line);
var dat2 = ChartData.GetData2();
var line2 = new ColumnSeries();
line2.Title = "White House";
foreach (var chartData in dat2)
{
line2.YValues.Add(new DoubleValue { Value = chartData.Value1 });
//line2.XValues.Add(new DateTimeValue { Value = chartData.Label });
line2.CustomValues.Add(new StringValue { Value = chartData.TotalDocumentValue1 });
}
Chart1.Series.Add(line2);