You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, i need some help with the configuration of the ModeBar. I want to add a new custom Button, but i don't get what the 'click' Parameter in ModeBarButtonsToAdd expects. According to the JS documentation ( -> https://plotly.com/javascript/configuration-options/#add-buttons-to-modebar) it needs a function, but how would that look like in C#?
This is what i got so far for the configuration:
<PlotlyChart style="height: 70vh; min-height: 350px" @ref="_Chart" @bind-Config="_Config" @bind-Layout="_Layout" @bind-Data="_Data" />
@code
{
[CascadingParameter]
private MudTheme Theme { get; set; }
private PlotlyChart _Chart;
private Config _Config;
private Layout _Layout;
private IList<ITrace> _Data;
protected override void OnInitialized()
{
_Config = new Config
{
DisplayLogo = false,
ModeBarButtonsToRemove = new[]
{
"lasso2d",
"select2d"
},
DisplayModeBar = DisplayModeBarEnum.True,
ModeBarButtonsToAdd = new[]
{
new
{
name = "TestButton",
icon = Icons.Material.Filled.Agriculture,
click = // to be filled
}
}
};
_Data = new List<ITrace>
{
new Scatter
{
Name = "DeviceChartLine",
Line = new Line
{
Simplify = false
},
Mode = ModeFlag.Lines | ModeFlag.Markers,
X = new List<object>(),
Y = new List<object>()
}
};
_Layout = new Layout
{
Title = new Title
{
Text = "Test"
},
XAxis = new[]
{
new XAxis()
},
YAxis = new[]
{
new YAxis()
}
};
base.OnInitialized();
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey guys, i need some help with the configuration of the ModeBar. I want to add a new custom Button, but i don't get what the 'click' Parameter in ModeBarButtonsToAdd expects. According to the JS documentation ( -> https://plotly.com/javascript/configuration-options/#add-buttons-to-modebar) it needs a function, but how would that look like in C#?
This is what i got so far for the configuration:
Beta Was this translation helpful? Give feedback.
All reactions