How to add a custom toolbox in ui.echart #4023
Replies: 2 comments
-
That's a pretty good solution, @wasabismile. The only downside might be to rely on echart3D = ui.echart({
'xAxis3D': {'type': 'value'},
'yAxis3D': {'type': 'value'},
'zAxis3D': {'type': 'value'},
'grid3D': {'viewControl': {'projection': 'orthographic'}},
'series': [{'type': 'line3D', 'data': [[1, 1, 1], [3, 3, 3]]}]
}).classes('w-64')
echart3D.options['toolbox'] = {
'feature': {
'myViewFront': {
'show': True,
'title': 'FrontView',
'icon': 'image://https://echarts.apache.org/zh/images/favicon.png',
':onclick': f'() => getElement({echart3D.id}).$emit("myFrontView")',
},
},
}
def on_myFrontView(e: events.GenericEventArguments):
e.sender.options['grid3D']['viewControl']['beta'] = 0
e.sender.options['grid3D']['viewControl']['alpha'] = 0
e.sender.update()
ui.notify('FrontView')
echart3D.on('myFrontView', on_myFrontView) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you very much, I always learn new usages from you, @falkoschindler very nice. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I tried to add a custom function button on the toolbox of ui.echart to implement the view switching of 3D charts. I created an object named echart3D and used the variable name as an event parameter in the
In the event handling function on_myFrontView(e), I used the eval function to convert it into a real variable and then updated the echart.
I don't know if there is a more NiceGui way to implement this function, and here is my code.
Beta Was this translation helpful? Give feedback.
All reactions