1

Using Kendo MVC Kendo Chart. I want to disable legend of the chart. It looks like that:

:enter image description here

I don't want to show left side of my chart so how can i disappear this legend? I tried to make true's to false but i am failed many times.

   @(Html.Kendo().Chart(Model)
  .Name("chart")

.Title(title => title

    .Align(ChartTextAlignment.Center)

)

.Series(series =>
{
    series.Bar(
        model => model.Deger,
        model => model.Color
    )
    .Labels(labels => labels.Background("transparent").Visible(true));
})
.CategoryAxis(axis => axis
    .Categories(model => model.Parameter)
    .MajorGridLines(lines => lines.Visible(true))
            .Line(line => line.Visible(true))
)
.ValueAxis(axis => axis.Numeric()

            .MajorGridLines(lines => lines.Visible(true))
    .Visible(true)
)
  .ChartArea(chartArea => chartArea.Background("transparent"))
   .Tooltip(tooltip => tooltip
   .Visible(true)
                .Template("#= category #: #= value #"))
    )
Nic
  • 12,220
  • 20
  • 77
  • 105
kojirosan
  • 497
  • 10
  • 25

1 Answers1

1

Just add .Legend(false) to your chart.

@(Html.Kendo().Chart(Model)
    .Name("chart")
    .Title(title => title.Align(ChartTextAlignment.Center))
    .Series(series =>
    {
        series.Bar(
            model => model.Deger,
            model => model.Color
        )
        .Labels(labels => labels.Background("transparent").Visible(true));
    })
    .CategoryAxis(axis => axis
        .Categories(model => model.Parameter)
        .MajorGridLines(lines => lines.Visible(true))
            .Line(line => line.Visible(true))
    )
    .ValueAxis(axis => axis.Numeric()
            .MajorGridLines(lines => lines.Visible(true)).Visible(true)
    )
    .ChartArea(chartArea => chartArea.Background("transparent"))
   .Tooltip(tooltip => tooltip
       .Visible(true)
       .Template("#= category #: #= value #"))
   .Legend(false)   
)

Alternatively, you can control the legend using JavaScript. Useful if you want to hide certain legend items.

var chart = $("#chart").data("kendoChart");
chart.options.series[0].visibleInLegend = false;
chart.redraw();
Nic
  • 12,220
  • 20
  • 77
  • 105
  • Nicholas, can you try answer to my question? I think you will be able to answer. link: http://stackoverflow.com/questions/33889722/kendo-chart-legend-label-at-left-color-at-right – user5260143 Nov 25 '15 at 09:36