Hi, I’m having trouble setting tickvals and ticktext dynamically depending on the traces that are loaded in a 3D Surface chart.
The below code in my Layout declaration works as expected, but its set at compile time -
layoutRibbon = new Layout {
// Title and other declarations,
Scene = new[] {
new Scene {
YAxis = new YAxis { Title = new Plotly.Blazor.LayoutLib.SceneLib.YAxisLib.Title { Text = "Date/Time" } },
ZAxis = new ZAxis { Title = new Plotly.Blazor.LayoutLib.SceneLib.ZAxisLib.Title { Text = "Fuel Level" } },
XAxis = new XAxis { Title = new Plotly.Blazor.LayoutLib.SceneLib.XAxisLib.Title { Text = "Machine" },
TickMode = Plotly.Blazor.LayoutLib.SceneLib.XAxisLib.TickModeEnum.Array,
TickVals = new List<object> { 0,1,2 },
TickText = new List<object> { "text 1", "text 2" , "text 3" }
},
}
},
I’m trying to achieve the same result but at runtime. I’ve tried declaring like this
TickVals = new List<object>(),
TickText = new List<object>()
and then at runtime I do this
layoutRibbon.Scene[0].XAxis.TickVals.Add(0);
layoutRibbon.Scene[0].XAxis.TickVals.Add(1);
layoutRibbon.Scene[0].XAxis.TickVals.Add(2);
layoutRibbon.Scene[0].XAxis.TickText.Add("text 0");
layoutRibbon.Scene[0].XAxis.TickText.Add("text 1");
layoutRibbon.Scene[0].XAxis.TickText.Add("text 2");
but my ticktext is entirely blank.
Can someone show me the correct way to do this?
Thanks