RomRider / apexcharts-card

📈 A Lovelace card to display advanced graphs and charts based on ApexChartsJS for Home Assistant
MIT License
1.08k stars 75 forks source link

Now line, invalid pos #704

Open daimonkor opened 2 months ago

daimonkor commented 2 months ago

I created chart

experimental:
  color_threshold: true
type: custom:apexcharts-card
update_interval: 5m
apex_config:
  chart:
    height: 350px
all_series_config:
  unit: ' kWh'
  opacity: 0.6
show:
  last_updated: true
header:
  title: Solar Forecast + Hourly PV Accumulated Energy
  show: true
  standard_format: true
  show_states: true
  colorize_states: true
graph_span: 16h
span:
  start: day
  offset: +4h
now:
  show: true
  label: Now
yaxis:
  - id: kwh
    min: 0
    apex_config:
      tickAmount: 5
  - id: header_only
    show: false
series:
  - entity: sensor.ph1800_custom_hourly_accumulated_power
    yaxis_id: kwh
    color: '#0D8EC9'
    type: column
    curve: smooth
    stroke_width: 1
    float_precision: 2
    group_by:
      func: max
      duration: 1h
    show:
      legend_value: false
      in_header: false
  - entity: sensor.solcast_pv_forecast_forecast_today
    yaxis_id: kwh
    type: line
    curve: smooth
    name: Today
    color: orange
    data_generator: |
      var today = entity.attributes.detailedForecast.map((start, index) => {
        return [new Date(start["period_start"]).getTime(), entity.attributes.detailedForecast[index]["pv_estimate"]];
      });
      var data = today
      return data;
    show:
      legend_value: false
      in_header: false
    stroke_width: 1
    float_precision: 2
    extend_to: false
  - entity: sensor.solcast_pv_forecast_forecast_today
    yaxis_id: header_only
    name: Today
    color: orange
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_remaining_today
    yaxis_id: header_only
    name: Remaining
    color: orange
    show:
      legend_value: true
      in_header: true
      in_chart: false

Screenshot_2024-05-10-01-13-01-516_io homeassistant companion android

So Now line position is invalid. Please help.

RomRider commented 1 week ago

Your chart is offset by +4h so it starts at 4am. Between midnight and 4am, the line would be displayed outside of the chart. I can probably filter it to not be displayed if that's what you want?