Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Charts: Add "Show legend" option for "Default" charts #229

Merged
merged 1 commit into from Oct 8, 2017

Conversation

hreichert
Copy link
Contributor

@hreichert hreichert commented Oct 5, 2017

The ESH DefaultChartProvider recently got a new feature to hide the legend:
eclipse-archived/smarthome#4291


  • Add the Option "Show legend" to the chart settings. Only shown if the "Default" chart is selected.
    • "automatic" -> let the chart provider decide (current behaviour: hide if there is only one chart series, show otherwise)
    • "always" -> force show
    • "never" -> force hide
  • Send legend=true/false to the chart servlet, if "always" or "never" is choosen. If "automatic" is selected, do not send the paramater, as this triggers the automatic decision.

Chart settings:
chart-settings

Setting Show legend: Never results in:
chart-legend-never

@ghys
Copy link
Member

ghys commented Oct 6, 2017

Great!
Just one minor nitpick:

Around line 327 here:
https://github.com/openhab/org.openhab.ui.habpanel/pull/229/files#diff-ec117370212c2c630426d1b711598a6eR327

can you add something along the lines of

if (widget.charttype !== "default") {
    delete widget.showlegend;
}

to make sure the option doesn't appear in the models of the non-default charts.

Thanks ;)

* Add the Option "Show legend" to the chart settings. Only shown if the "Default" chart is selected.
* Send `legend=true/false` to the chart servlet

Signed-off-by: Holger Reichert <mail@h0lger.de>
@hreichert hreichert force-pushed the defaultchartprovider-show-legend branch from cae354e to cba17d0 Compare October 6, 2017 17:17
@hreichert
Copy link
Contributor Author

Sure, here you go!

@ghys ghys merged commit 81e18a1 into openhab:master Oct 8, 2017
@ghys
Copy link
Member

ghys commented Oct 8, 2017

Thanks again @hreichert!

@hreichert hreichert deleted the defaultchartprovider-show-legend branch October 8, 2017 14:29
@ghys ghys added this to the 2.2.0 milestone Dec 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants