Search code examples
asp.net-mvc-3shieldui

Error setting the Shield UI ASP.NET MVC chart ZoomMode


I am trying to enable the ZoomMode of a Shield ASP.NET MVC chart but I am receiving the following error:

Server Error in '/' Application.
________________________________________
Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1502: The best overloaded method match for 'Shield.Mvc.UI.Chart.ChartBuilder<object>.ZoomMode(Shield.Mvc.UI.Chart.ZoomMode)' has some invalid arguments

According to documentation (https://www.shieldui.com/documentation/javascript.chart/api/zoomMode) there are 3 zoom modes:

Possible values are: 'x', 'y' and 'xy'. Why do I receive that error since I declare it as in the documentation:

@(Html.ShieldChart()
    .Name("chart")
    .ZoomMode("XY")
    .Export(false)

?


Solution

  • The mistake you are making is that you are using a string and not the predefined type that needs to be used when working with MVC. It is true, that for the JavaScript Shield UI chart the zoom mode is defined by passing a string parameter, but in MVC you need to use following code:

    .ZoomMode(Shield.Mvc.UI.Chart.ZoomMode.XY)