Skip to content

how to define Args parameter for UpdateMenuButton.init for release version 5.0 #456

Answered by kMutagene
kunjiangkun asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kunjiangkun,

The original intention of changing the argument type to DynamicObj[] was to support arguments of different types (see #414), because in the final schema, args is a json array with arbitrary types.

This means that you now have to create dynamic objects with field names set to your argument names. Here is a simple example:

using Plotly.NET;
using Plotly.NET.LayoutObjects;
using DynamicObj;

var mode1 = new DynamicObj.DynamicObj();
mode1.SetValue("mode", "markers");

var mode2 = new DynamicObj.DynamicObj();
mode2.SetValue("mode", "lines");

var myBtn1 = UpdateMenuButton.init(
    Args: new DynamicObj.DynamicObj[] {mode1}, Label: "Markers", Method: StyleParam.UpdateMethod.Res…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kunjiangkun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants