This is a migrated thread and some comments may be shown as answers.

Chart does not show 0 value

0 Answers 109 Views
Chart
This is a migrated thread and some comments may be shown as answers.
A
Top achievements
Rank 1
A asked on 18 Oct 2012, 08:47 AM
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. 

No answers yet. Maybe you can help?

Tags
Chart
Asked by
A
Top achievements
Rank 1
Share this question
or