plotly / dash-daq

Control components for Dash
MIT License
141 stars 40 forks source link

daq.Gauge does not display gradients when color ranges max doesn't match 'max' prop #125

Closed wbrgss closed 3 years ago

wbrgss commented 4 years ago

I think the gradient could be interpolated, or an error message could be shown.

E.g. with a gradient that has a red range of [8,10] (i.e. 10 is the max) but a max value of 11, the gradient is simply not displayed:

image

With an appropriate max value of 10:

image

E.g.

Minimal example:

import dash
import dash_daq as daq
import dash_html_components as html

app = dash.Dash(__name__)

app.layout = html.Div([
    daq.Gauge(
      max=11,
      color={"gradient":True,"ranges":{"green":[0,6],"yellow":[6,8],"red":[8,10]}},
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)