2015-06-24 23 views
0

我有一個應用了盎司的運行總數的kendo圖表。如果我不應用「組」設置,則按預期呈現整個年份。但是,當我應用羣組設置時,例如通過人名,它只能提供2個月的數據。Kenodo ui mvc圖表 - 數據源分組無法正常工作

我有下面的類

public class BreakoutData 
{ 
    public string BreakoutField { get; set; } 
    public decimal TotalAcres { get; set; } 
    public decimal RunningAcresTotal { get; set; } 
    public decimal TotalOunces { get; set; } 
    [DisplayName("")] 
    public decimal RunningOuncesTotal { get; set; } 
    public DateTime TransactionDay { get; set; } 
    public Color Color { get; set; } 
} 

名單將從乞討到一年TODATE返回運行總計列表。以下是團隊應用的樣子。

代碼:

@(
     Html.Kendo().Chart<BreakoutData>() 
      .Name("BreakoutChart") 
      .Title("Breakout") 
      .Series(series => 
      { 
       series.Line(model => model.RunningOuncesTotal, model => model.Color.ToString(), model => model.TransactionDay.ToString()).Name("") ; 
      }) 
      .CategoryAxis(axis => axis 
       .Categories(m => m.TransactionDay) 
       .Date() 
       .BaseUnit(ChartAxisBaseUnit.Days) 
       .Labels(labels => 
       { 
        labels.Format("MM/dd/yyyy"); 
        labels.Rotation(-45); 
       }) 
      ) 
      .DataSource(d => d.Read(read => read.Action("LoadBreakOutChart", "Breakout").Data("getAdditionalData")) 
       .Group(m => m.Add(g => g.BreakoutField)) 
      ) 
      .Tooltip(
       tooltip => tooltip.Visible(true) 
        .Template("#=kendo.toString(category, 'ddd, MMM dd,yyyy')#" + 
           "<br> #=series.name # : <strong>#=value #</strong>") 
      ) 
      .Legend(legend => legend.Position(ChartLegendPosition.Bottom)) 
      .Events(e => e.DataBound("HideLoading")) 
      .HtmlAttributes(new { style = "height:500px;min-width:900px;" }) 
      .Pdf(p => 
      { 
       p.FileName("text.pdf"); 
       p.Author("FarmChem"); 
      })  
    ) 

回答

0

如果你有一個問題,用圖表呈現不正確,如果你丟失的數據點嘗試加入.CategoryField(「字段名」),然後卸下.Categories(M => m.TransactionDay) 。

我能夠通過這些更改解決我的問題。