Chart does not show 0 value

1 posts, 0 answers
  1. A
    A avatar
    3 posts
    Member since:
    Jan 2012

    Posted 18 Oct 2012 Link to this post

    Hi,
    Im trying the telerick mvc chart control:
    <% Chart<CollectionItem<decimal?>> chart =
                                                Html.Telerik().Chart(Model.GraphData)
                                                    .Name("chart")
                                                    .Title(title => title
                                                        .Text(Model.GraphTitle)
                                                        .Visible(false)
                                                    )
                                                    .Legend(legend => legend
                                                        .Position(ChartLegendPosition.Top)
                                                        .Visible(false)
                                                    )
                                                    .SeriesDefaults(series =>
                                                    {
                                                        series.Column().Stack(false);
                                                    })
                                                    .Series(series =>
                                                    {
                                                        series.Column(s => s.Value)
                                                            .Name("Totalen")
                                                            .Color("#1f3975")
                                                            .Labels(labels => labels
                                                                .Margin(-6)
                                                                .Visible(true)
                                                                .Template("<#= value #>")
                                                                .Position(ChartBarLabelsPosition.OutsideEnd));
                                                    })
                                                    .CategoryAxis(axis => axis
                                                        .Categories(s => s.Text)
                                                        .Color("#000000")
                                                        .Labels(labels => labels.Margin(-6).Visible(true))
                                                        .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
                                                    )
                                                    .ValueAxis(axis => axis
                                                        .Numeric().Labels(labels => labels.Margin(0).Format("{0:#,##0}")).Min(0)
                                                        .MajorUnit(Model.GraphMajorUnit)
                                                        .Color("#000000")
                                                        .Labels(labels => labels.Visible(false))
                                                        .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
                                                                     )
                                                    .Tooltip(tooltip => tooltip
                                                        .Visible(false)
                                                        .Template("<#= category #>: <#= value #>")
                                                        .Format("{0:#,##0}")
                                                    )
                                                    .HtmlAttributes(new { style = "width: 225px; height: 78px;" });
     
                   chart.Render();
                %>


    The problem is that when one of my bars, has 0 as value, i dont' see the value on the bar, it's then empty. How can i show the 0 on the bar? i tried :
    .ValueAxis(axis => axis
                                                       .Numeric().Labels(labels => labels.Margin(0).Format("{0:#,##0}")).Min(0)
                                                       .MajorUnit(Model.GraphMajorUnit)
                                                       .Color("#000000")
                                                       .Labels(labels => labels.Visible(false))
                                                       .MajorGridLines(majorGridLines => majorGridLines.Color("#ddd"))
    But it does not work. 
Back to Top