Skip to content
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

Issue with "autorange_after_scroll" when using an arbitrary function #279

Open
rjgrandy opened this issue May 6, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@rjgrandy
Copy link

rjgrandy commented May 6, 2023

The "autorange_after_scroll" function does not seem to work correctly when I use an arbitrary function to define different X and Y values (put new values into xs and ys. It scales the largest Y axis to the largest Y value in the data.

If I only change the return xs and ys to return the orginal xs and ys and nothing else, it seems to work fine. So maybe there is something wrong with the data I am passing, but it seems to display fine and I can't see a difference when I debug.

Displayed Graphs
image

Debug Data
image

- type: custom:plotly-graph
  hours_to_show: 1M
  autorange_after_scroll: true
  defaults:
    yaxes:
      side: left
      overlaying: "n"
      visible: true
      showgrid: true
  entities:
    - entity: sensor.yearly_downstairs_heat
      type: bar
      filters:
        - fn: |-
            ({xs, ys, hass}) => {
              let xx = [];
              let yy = [];
              for (const [key, value] of Object.entries(hass.states["sensor.yearly_downstairs_heat"].attributes)) {
                  let d = new Date(key);
                  d.setMinutes(d.getMinutes());
                  if (d > 0){
                      xx.push(d);
                      yy.push(value);
                  }
              }
              return {
                xs: xx,
                ys: yy
              };
            }
        - fn: |-
            ({xs, ys}) => {
              console.log([i,xs,ys,x,y]);
            }
@rjgrandy rjgrandy added the bug Something isn't working label May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant