0

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); 
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
SOF User
  • 7,590
  • 22
  • 75
  • 121

1 Answers1

-1

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.

Dragan Matek
  • 507
  • 1
  • 3
  • 6
  • but definately both have same x value because both are data for 1 januray so it should not be overlap and just for info nothing is showing not only first one empty chart is showing then when i add both x values – SOF User Jun 07 '13 at 00:07
  • 1
    if you see this example http://www.jqchart.com/aspnet/chart/ChartTypes/ColumnChart in this case also both have same x-axis valu 'A' , 'B'.... .. I just want this kind of chart with C# code like I expected in my question. – SOF User Jun 07 '13 at 00:08
  • In this case you need to add your x-values as strings - "02/02/2000", but not date time. In the column chart, when the x-values are numeric or date time the columns need to be placed on their exact x-positions. When the x-values are strings, the jqChart creates a categories for them and the columns are rendered side by side. – Dragan Matek Jun 07 '13 at 16:00
  • but if i am passing it as string i will loose datetime axes functionality then – SOF User Jun 10 '13 at 00:45
  • That's also true. You can also try using stacked column series http://www.jqchart.com/aspnet/chart/ChartTypes/StackedColumnChart – Dragan Matek Jun 11 '13 at 06:46