syncfusion ASP.NET Core Chart 控件禁用点击事件

问题描述

我正在从 WEB API 获取周一至周五的班级数据并将其分配给 VIEWBAG,该数据显示在同步融合图表中。现在,在运行期间,当我单击“周一至周五” 时,它会显示空白 图表。我想禁用图表中“周一至周五”文本的点击

<ejs-chart id="container" title="Daily Class Taken" width="60%">
        <e-chart-primaryxaxis valueType="ClassData"></e-chart-primaryxaxis>
        <e-series-collection>
            <e-series dataSource="ViewBag.dataSource" fill="#FFFF00" name="Monday - Sunday" xName="DateModified" width="2" opacity="1" yName="ViewDuration" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column">
            </e-series>
        </e-series-collection>
    </ejs-chart>

解决方法

我们建议您禁用图例的 toggleVisibility 以实现您所需的场景。请检查以下示例和代码片段。

<ejs-chart>
    <e-chart-legendsettings toggleVisibility="false"></e-chart-legendsettings>
</ejs-chart>

示例: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ToggleVisibility-1693683250.zip

UG : https://ej2.syncfusion.com/aspnetcore/documentation/chart/legend/#series-selection-on-legend

如果您有任何疑问,请回复我们。