SOF User
SOF User

Reputation: 7840

JqChart ASP.net Webforms with Multiple Column series

I have problem here when I guve //line2.XValues.Add(new DateTimeValue { Value = chartData.Label }); for second line chart does not show this second column but when I remove both xvalues it shows both columns.

 <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# Page Load

  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); 

Upvotes: 0

Views: 544

Answers (1)

Dragan Matek
Dragan Matek

Reputation: 507

I believe the second column series is rendering over the first column series and that's way the first is not visible. They have the same x and y values.

Disclaimer: I am CTO of jqChart.

Upvotes: -1

Related Questions