-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade ECharts to v5, add support for ECharts gauge & chart widget #814
Conversation
Love the result, some initial thoughts on the implementation:
Have a look at this: #648 (comment) And execute |
That was my impression too, but wanted to start with a minimal set of changes first so if going into the wrong direction, would not be going too far ;) Thanks for the lazy loading info, now ECharts are back in their own bundle. |
Chart widget is now embedded into chart page, where styles might not be the cleanest (it's been years since I did CSS) but at least after initial testing seems as its working ... of course more testing is required. The newly introduced
Compared to other widgets, there is usually an
vs.
Another example for controlling the gauge's scale, ECharts syntax is:
so mapped to yaml example (with dynamic ranges) would be something like:
While it works perfectly fine, syntax might feel a bit odd. Comments and suggestions welcome and appreciated. Did some testing with chart pages, tabs, layouts, ... testing if existing functionality still works + new features ... since there are plenty of areas that might be affected, if there is any brave sole who would be willing to test gauges and chart widget (and everything else :) ), please download the ui bundle from here or install directly using
Bundle contains latest Worth mentioning is that it seems gauges don't play super nice with dark theme (probably can be solved with setting appropriated colours in yaml) but AFAIK dark mode has better support in ECharts ver 5 so this will probably improve when we migrate to latest version of ECharts. Please report back any issues and/or comments. Disclamer: please also be aware that PR might change and so will the YAML structure&format - meaning you might need to re-do at least parts of things you do with the ui bundle in its current state. |
Updated
and tested a bit - seems as it works out of the box, did not find any issue so far, working with gauges is easier and more powerfull charts seem more colorfull by default too dark mode plays better too If someone wants to test Main UI with ECharts 5, please run
Please report back any issues - thank you! |
Excellent!
that blueish background looks a bit weird though, we'll probably have to override it. @crnjan remove the [WIP] in the title when you're ready and I'll have a look. |
Blueish background comes with ECharts as it seems, will try to get rid of it - that said, does it make sense for you if I include the |
Yes there were some problems with the calendar and others when in dark mode so I added a bunch of code to override the default unless there's specified by the user in the configuration, for example: openhab-webui/bundles/org.openhab.ui/web/src/components/widgets/chart/axis/oh-calendar-axis.js Line 19 in 639abb3
Definitely. We'll have to check everything but migration looks like smooth sailing. |
f9603bb
to
ab9e087
Compare
Removed blueish background, same page as in my previous posts, but now from my phone with dark mode Only thing I noticed is a console log
While all seems to work regardless, changing
to
in 'ECharts.vue' fixes this - not sure what is the best way to approach this - ignore until it's fixed in Also removed the WIP and looking forward to feedback. |
Thanks for taking care of this.
That's unfortunate, we can't leave that warning there. and we can't really change code in dependencies. Forking is an option, but seeing there's already demand for it ecomfe/vue-echarts#491, I can't imagine it being a problem for very long, either it will be solved or a fork will appear and we'll just use that. Thanks for your efforts, I'll do a proper review soon! |
Signed-off-by: Boris Krivonog <[email protected]>
Signed-off-by: Boris Krivonog <[email protected]>
Signed-off-by: Boris Krivonog <[email protected]>
Signed-off-by: Boris Krivonog <[email protected]>
…rts with dark theme. Signed-off-by: Boris Krivonog <[email protected]>
…values (NaN). Signed-off-by: Boris Krivonog <[email protected]>
Signed-off-by: Boris Krivonog <[email protected]>
194762e
to
9693781
Compare
@crnjan I have tested https://github.com/ambit-tsai/echarts-for-vue as a replacement of vue-echarts, it does work and removes the error in the console, but introduces some bugs as well... |
I've seen
However, it does seem as the later is more active while Nevertheless, I forked the Updated reference to:
and been playing a bit last couple of days, i.e. hosting charts on overview screen (if someone sees a need for it :) ): While it seems to fit my use-cases, I guess more testing would be welcome ... |
You're right about vue-echarts being the more popular option, but it indeed looks abandoned. I noticed the warning (error) message about the import only appears in development, not in production, so I'd be willing to not consider it a blocking issue anymore for this PR, and either ignore it (since it will not be shown to users' consoles) and eventually upgrade vue-echarts when the fix is integrated, or use your fork. |
Fix some linting errors, remove param group for page, widget definition for oh-chart-component, background color in z-wave network chart, OhChartPageDefinition in YAML hints for chart pages. Signed-off-by: Yannick Schaus <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few fixes regarding linting - having #833 will ensure further PRs won't have these problems because it will not build if there are linting errors - and a few other things here and there, but overall, LGTM.
The fact that the new features are only available in YAML is probably something that we'll have to improve, like:
- a gauge card widget in the standard library (or integrate the EChart gauge to the existing gauge card), or a chart card;
- an ability to add gauges in the chart page designer (like grids & calendars).
Many thanks @crnjan for your work!
(the queue in Jenkins is full and the PR build will not be made tonight, I'll merge tomorrow if it succeeds).
Thank you @ghys for your guidance and all the hard work! |
…penhab#814) Add a oh-chart widget to add charts to layout pages; change oh-chart-page to use it. Add a oh-data-series component with the ability to add gauges representing a single value. Upgrade ECharts to v5.0.1. Also-by: Yannick Schaus <[email protected]> Signed-off-by: Boris Krivonog <[email protected]> Signed-off-by: Brian Homeyer <[email protected]>
…penhab#814) Add a oh-chart widget to add charts to layout pages; change oh-chart-page to use it. Add a oh-data-series component with the ability to add gauges representing a single value. Upgrade ECharts to v5.0.1. Also-by: Yannick Schaus <[email protected]> Signed-off-by: Boris Krivonog <[email protected]> Signed-off-by: Brian Homeyer <[email protected]>
Based on feedback prepared a PR - implemented support for gauge. Adding it to chart page example:
renders
Also added a widget wrapper for
oh-chart-page
so one can use all available ECharts goodies in layout pages, i.e.renders
A bit heavier example with gauges, line chart and some other cards ...
There are still some pending tasks, as adding ability to hide period controls, ... but would like first to get feedback if going into the right direction.
I look forward to any feedback or comments.
Signed-off-by: Boris Krivonog [email protected]