feat: add SimpleGraph class#8
Conversation
|
Please @frank-zsy help look into this and see if there are anything needed but not implemented yet, or totally unnecessary.
In the current implementation, While BTW, is it necessary to move the WDYT @frank-zsy ? |
frank-zsy
left a comment
There was a problem hiding this comment.
We may use single quotes rather than double quotes for strings, is there a certain reason you change all quotes to double quotes?
And I think besides the
I think it is all good, if you move the class into another file, need to add it to |
Signed-off-by: LinHaiming <lhming23@outlook.com>
|
I have updated the PR, please @frank-zsy have a look.
Because I used BTW, maybe we can specify the lint tool and configuration to avoid this problem.
I have added that to this pr, please review it again.
Yes. I have moved the |
|
I will approve this PR now and refactor later on default styles. /approve |
This PR implements the
SimpleGraphclass based onEcharts. Fix #4.How to use
First, we need to prepare a DOM container with width and height for ECharts.
Then we can initialize an SimpleGraph instance to create a simple chart:
API
render(option)This is the most powerful interface. All parameters and data can all be passed and modified through
option.EChartswill merge new parameters and data, and then refresh chart. The function can be used to:Dynamic Data Updating
Implementing dynamic data updating is extremely easy. You only need to get data as you wish, fill in data to
option, then pass it torender().Asynchronous Loading
The same as
Dynamic Data Updating. You can pass theoptiontorender()once the data is ready after asynchronous loading.Loading Animation
showLoading()is used to show the simple loading animation, andhideLoading()is used to hide it after data loading.Theme
Besides the original default theme, you can use 'light' and 'dark' theme:
You can also call
updateTheme(theme)to update the theme color.Events
bindEvent(eventName, func)is provided to bind some events on the chart and handle accordingly through callback functions. You can refer to Events and Actions in ECharts for more information.Actions
dispatchAction()is provided to trigger certain actions in the program, such as showing tooltip, or selecting legend. You can refer to action for more information.Signed-off-by: LinHaiming lhming23@outlook.com