Skip to content

zoom without scrolling axis #614

@paolostivanin

Description

@paolostivanin

Hello,
I currently have, for example:

type: custom:plotly-graph
title: Production VS Consumption
refresh_interval: 60
hours_to_show: |
  $fn () => {
    const now = new Date();
    const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
    return (now - startOfDay) / 1000 / 60 / 60;
  }
layout:
  showlegend: true
  hovermode: x unified
  dragmode: zoom
  xaxis:
    tickformat: "%H:%M"
    autorange: true
  yaxis:
    title: kW
    autorange: true
  legend:
    orientation: h
    x: 0.5
    xanchor: center
    "y": -0.2
entities:
  - entity: sensor.solarnet_power_photovoltaics
    name: Production
    fill: tozeroy
    filters:
      - resample: 1m
    line:
      color: "#FFA500"
      width: 1.5
      shape: spline
    fillcolor: rgba(255, 165, 0, 0.3)
  - entity: sensor.solarnet_power_load_consumed
    name: Consumption
    fill: tozeroy
    filters:
      - resample: 1m
    line:
      color: "#1E90FF"
      width: 1.5
      shape: spline
    fillcolor: rgba(30, 144, 255, 0.3)
config:
  displayModeBar: true
  scrollZoom: false
  doubleClick: reset
  modeBarButtonsToRemove:
    - pan2d
    - select2d
    - lasso2d
    - zoomin
    - zoomout
    - zoom
    - toImage
    - resetScale

but, on mobile, when I scroll the page the y/x axis can move to "infinity". Is there a way to lock the axis to only what is shown but still being able to zoom?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions