-
-
Notifications
You must be signed in to change notification settings - Fork 267
Analyzer: Refactor and Add support of oh-state-series #3187
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
base: main
Are you sure you want to change the base?
Conversation
#3273 Bundle Size — 11.28MiB (-0.02%).90ee77b(current) vs 005e58d main#3264(baseline) Warning Bundle contains 2 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch jsjames:analyzer-state-series Project dashboard Generated by RelativeCI Documentation Report issue |
|
Hi @jsjames and thanks for your PRs!
I like the idea of having an analyzer available for discrete Items 👍
I will try to track this down myself. |
15b7b1d to
232ec39
Compare
|
Rebased this PR. |
florian-h05
left a comment
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.
Code LGTM now, I have also been able to fix the TypeError.
Waiting for the discussion about the Dimmer.
80b6800 to
ede1965
Compare
Thanks for fixing that - not having done much in Vue, i am interested to learn how you were able to track that down? |
The error message hinted to the Framework7 smart select. |
e7b377b to
6ae8682
Compare
|
What would be nice would be to provide both options for Dimmer Items so the user can select the representation. |
I thought about that and it would be good. I was looking at the logic to do this though - and it seems there are a lot of nuances in the code with the different types of graphs/charts and then which series types are allowed. Wondering if we should delay this until 5.1 and/or the vue 3. Maybe we can clean up the code a bit so its easier to understand. |
6ae8682 to
de9e6c5
Compare
|
Do we need Vue 3 to clean up the code? I don’t see a real technical reason for that. |
Correct, no technical reason - just that I didn't want to start restructuring things so close to the 5.0 release. I can take a look at it more this week if you'd like. |
Added support for discrete items to use oh-state-series on a separate grid BUG: Had to add this.showChart = false in updateItems in order for echarts to update the options w/o error when there are multiple unit y-axis value-series. However, with that change, when selecting additional items from the item list - it now generates a Vue rendterItem error. Signed-off-by: Jeff James <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Signed-off-by: Florian Hotze <[email protected]>
Fixes:
```
smart-select-class.js:105 Uncaught TypeError: Cannot read properties of undefined (reading 'options')
at HTMLInputElement.handleInputChange (smart-select-class.js:105:41)
at HTMLDivElement.handleLiveEvent (dom7.module.js:320:48)
```
Signed-off-by: Florian Hotze <[email protected]>
Fixed xAxisIndex when both value and state graphs are displayed Signed-off-by: Jeff James <[email protected]>
de9e6c5 to
cd0649a
Compare
@florian-h05 - I did a refactor / clean-up of the code. I've tested fairly thoroughly, but would welcome more testing. The feature to select between State and Line/Area for a Dimmer is now possible. I still have some console.log messages for debugging - are those automatically removed in the production build process or do I have to manually remove them? |
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.
Pull Request Overview
This PR refactors the analyzer to support the new oh‑state‑series while standardizing coordinate system initialization and chart configuration across multiple views. Key changes include:
- Introducing oh‑state‑series support and refactoring series initialization in chart‑time.js.
- Updating coordinate system handling (coordSettings) and UI adjustments in analyzer.vue.
- Adapting visual map rendering and i18n keys across chart‑calendar.js, chart‑aggregate.js, and localization files.
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| bundles/org.openhab.ui/web/src/pages/analyzer/chart-time.js | Updated series initialization to account for discrete items via oh‑state‑series and adjusted grid handling. |
| bundles/org.openhab.ui/web/src/pages/analyzer/chart-calendar.js | Modified coordinate and visualMap rendering using coordSettings. |
| bundles/org.openhab.ui/web/src/pages/analyzer/chart-aggregate.js | Introduced DIMENSION_MAP for dimension mapping and updated axis initialization. |
| bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue | Refactored coordinate system handling, series option updates, and list iterations to use coordSettings; updated UI controls. |
| bundles/org.openhab.ui/web/src/pages/analyzer/analyzer-helpers.js | Added helper methods for parsing units, axis rendering, and visual map generation. |
| bundles/org.openhab.ui/web/src/components/widgets/chart/series/oh-state-series.js | Implemented oh‑state‑series support with a note on deprecated API usage. |
| bundles/org.openhab.ui/web/src/components/item/item-state-preview.vue | Extended item type checks to include String items. |
| i18n files | Updated translation keys to reflect the switch from “week” to “isoWeek”. |
| </thead> | ||
| <tbody> | ||
| <tr v-for="(options, item) in seriesOptions" :key="item"> | ||
| <tr v-for="(options, idx) in seriesOptions" :key="idx"> |
Copilot
AI
Jun 28, 2025
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.
[nitpick] Using the array index as a key can lead to issues with list reordering; consider using a unique identifier from the series options if available.
| <tr v-for="(options, idx) in seriesOptions" :key="idx"> | |
| <tr v-for="(options, idx) in seriesOptions" :key="options.id"> |
Dimmer can now be either a line/bar/area or state graph Fixed xAxisIndex when both value and state graphs are displayed Signed-off-by: Jeff James <[email protected]>
cd0649a to
90ee77b
Compare
|
@jsjames Can you release this please? |
This PR is dependent on the #3179 which adds support for the a new chart series for state types. This PR further adds support and default behavior for discrete items to use this new state-series. Depending on the selected items, it will use separate grids - one using a y-axis of a oh-value-series and one use oh-category-series (discrete items).
Note, that there seems to be a issue with echarts where if the chart is showing when updates are made where there are multiple value-axis with different units AND there are multiple grids, there is an echart exception complaining about y- and x-axis having to be on the same chart. To address this, i added a showChart=false in the updateItems function. However, this now causes an exception in the vue framework:
@florian-h05, before spending more time debugging: