如何禁用自定义图例剑道图 - javascript

使用Kendo MVC Kendo图表。我想禁用图表图例。看起来像这样:

我不想显示图表的左侧,所以如何消失此图例?我试图将对错定为真,但我失败了很多次。

   @(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)添加到图表中即可。

@(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)   
)

或者,您可以使用JavaScript控制图例。如果要隐藏某些图例项,则很有用。

var chart = $("#chart").data("kendoChart");
chart.options.series[0].visibleInLegend = false;
chart.redraw();

javascript popupwindow之后的行如何工作? - javascript

好的,我有一个来自后面代码的方法,可以创建一个popupwindow。然后有一行代码要在那之后执行,我想知道那行代码何时执行,是在使用popupwindow之后执行还是在创建popupwindow之后执行?例如:void exPopupWindowMethod() { string scr = "window.open('exampleP…

jQuery发布不会将数据发布到ASP.NET API控制器 - javascript

我有一次噩梦般的时间通过jquery post将数据发送到ASP.NET Controller。这是JSON.stringify之后的数据:[{"scheduleTaskID":"203","task":"Permit","baselineDate":…

ddl在服务器中未更新-asp.net - javascript

我在ASP.NET c#上工作。我有一个DropDownList。 (runat =“ server”)在$ {document).ready上,我更新了它的值:$(document).ready(function () { document.getElementById("ddl").value = "abc"; ……

.NET C#Webbrowser填充输入,不带ID或类名 - javascript

我需要在网络浏览器中填写一个输入,但这不起作用。我认为必须使用name属性来完成,但是怎么做呢?foreach (HtmlElement login in webBrowser1.Document.GetElementsByTagName("input")) { if (login.GetAttribute("name"…

将asp.net.core 2.0应用发布到IIS时JavaScript无法运行 - javascript

我是这里的新手。我有一个VS2017 asp.net C#Web应用程序。我目前不在使用Angular。这是一个简单的网站。我隐藏了div,当用户单击菜单项时,相关的div出现,而我隐藏了其余的div。我使用JavaScript完成此任务。在开发和IIS Express中,它可以工作。当我发布到IIS时,它不起作用。静态页面显示“确定”,但菜单按钮不执行任何…