0

我有一个应用了运行总盎司的剑道图。当我不应用“组”设置时,它会按预期呈现迄今为止的整个年份。但是,当我应用组设置时,例如通过人名,它只呈现 2 个月的数据。

我有以下课程的列表

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

这将返回从乞讨到今年的运行总计列表。这是应用组后的样子。

代码:

    @(
        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");
            })       
    )
4

1 回答 1

0

如果您在缺少数据点时遇到图表无法正确呈现的问题,请尝试添加 .CategoryField('fieldname') 并删除 .Categories(m => m.TransactionDay)。

我能够通过这些更改解决我的问题。

于 2015-06-25T13:18:27.870 回答