Apexcharts question: scale y axis based on brush selection

Has anyone been able to figure out how to scale the y axis based on the brush selection? I have a graph that spans across 3 days with a brush selection that defaults to 12 hours. The plot shows the total daily rain (reset to 0.0mm at midnight) and the current rain rate (in mm/hr). Currently the both y-axis (left and right side) are scaled to the largest value in the 3 day span. I want both y-axis to independently scale and update as I move the brush selection.

You can see in my code below I have tried several things (unsuccessfully) to force the auto-scale of the y-axis by setting the in-brush config and the apex_config using (neither of which have worked):

brush:
  selection_span: 12hrs
  apex_config:
    enabled: true
    autoScaleYaxis: true
apex_config:
  brush:
    autoScaleYaxis: true

Yaml config:

type: custom:apexcharts-card
graph_span: 3days
yaxis:
  - id: first
  - id: second
    opposite: true
header:
  show: true
  title: Daily Total Rain
  show_states: true
  colorize_states: true
experimental:
  brush: true
brush:
  selection_span: 12hrs
  apex_config:
    enabled: true
    autoScaleYaxis: true
apex_config:
  brush:
    autoScaleYaxis: true
series:
  - entity: sensor.gw1100c_v2_2_1_daily_rain_rate
    type: line
    color: aqua
    yaxis_id: first
    stroke_width: 3
    curve: smooth
    show:
      in_brush: false
      in_chart: true
  - entity: sensor.gw1100c_v2_2_1_rain_rate
    type: line
    name: Rain Rate
    yaxis_id: second
    stroke_width: 2
    curve: stepline
all_series_config:
  show:
    in_brush: true
  opacity: 1
  float_precision: 2

1 Like

It does the exact same thing to me too, I’ve tried everything, but the y-scale is set to the maximum value found in the contents of the graph_span: range and not as it should be in the selection_span: range.
The original library works fine:
https://apexcharts.com/javascript-chart-demos/line-charts/brush-chart/

I am attaching some screenshots, as per my previous post:
… is it a bug to report or is it a problem with my code?



My code of latest screenshot:

type: custom:apexcharts-card
graph_span: 7d
experimental:
  brush: true
brush:
  selection_span: 2d
span:
  end: day
apex_config:
  chart:
    height: 400px
    zoom:
      enabled: true
    brush:
      autoScaleYaxis: true
    toolbar:
      show: true
      tools:
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true
        download: false
  plotOptions:
    bar:
      dataLabels:
        position: center
  xaxis:
    labels:
      format: dd/MM
  yaxis:
    min: 0
    max: 12
  legend:
    show: false
  stroke:
    show: true
    width: 2
    curve: smooth
  fill:
    type: gradient
    gradient:
      type: horizontal
      shadeIntensity: 0.1
      opacityFrom: 0.3
      opacityTo: 0.9
show:
  last_updated: true
header:
  show: false
  show_states: true
  colorize_states: true
  title: Aggregato
series:
  - entity: sensor.generale_energy_daily
    name: Totale
    type: area
    unit: ' kWh'
    color: Grey
    group_by:
      func: max
      duration: 1d
    show:
      in_brush: true
      in_chart: true
  - entity: sensor.other_energy_daily
    name: Altri Servizi
    type: column
    unit: ' kWh'
    color: HotPink
    group_by:
      func: max
      duration: 1d
  - entity: sensor.condizionatori_energy_daily
    name: Condizionatori
    type: column
    unit: ' kWh'
    color: Orange
    group_by:
      func: max
      duration: 1d
  - entity: sensor.tvsala_plug_energy_daily
    name: Sala TV
    type: column
    unit: ' kWh'
    color: Yellow
    group_by:
      func: max
      duration: 1d
  - entity: sensor.box_energy_daily
    name: Asciugatrice
    type: column
    unit: ' kWh'
    color: GreenYellow
    group_by:
      func: max
      duration: 1d
  - entity: sensor.lavatrice_energy_daily
    name: Lavatrice
    type: column
    unit: ' kWh'
    color: DodgerBlue
    group_by:
      func: max
      duration: 1d

Hi all,
Anyone found a solution already for this issue?
I have a graph that once in a few days shows some bursts but for the rest very small values. And the beauty about the brush in the original Apexchart.js is that it zooms in the y-axis automatically